Skip to content

Commit c66de71

Browse files
committed
fix
1 parent f58707c commit c66de71

File tree

6 files changed

+23
-30
lines changed

6 files changed

+23
-30
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
# Omnipay: :gateway
1+
# Omnipay: Gomypay
22

33
**Gomypay gateway for the Omnipay PHP payment processing library**
44

5-
[![Latest Version on Packagist](https://img.shields.io/packagist/v/omnipay-taiwan/omnipay-:gateway.svg?style=flat-square)](https://packagist.org/packages/omnipay-taiwan/omnipay-:gateway)
5+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/omnipay-taiwan/omnipay-gomypay.svg?style=flat-square)](https://packagist.org/packages/omnipay-taiwan/omnipay-gomypay)
66
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
7-
[![Build Status](https://img.shields.io/travis/omnipay-taiwan/omnipay-:gateway/master.svg?style=flat-square)](https://travis-ci.org/omnipay-taiwan/omnipay-:gateway)
8-
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/omnipay-taiwan/omnipay-:gateway.svg?style=flat-square)](https://scrutinizer-ci.com/g/omnipay-taiwan/omnipay-:gateway/code-structure)
9-
[![Quality Score](https://img.shields.io/scrutinizer/g/omnipay-taiwan/omnipay-:gateway.svg?style=flat-square)](https://scrutinizer-ci.com/g/omnipay-taiwan/omnipay-:gateway)
10-
[![Total Downloads](https://img.shields.io/packagist/dt/omnipay-taiwan/omnipay-:gateway.svg?style=flat-square)](https://packagist.org/packages/omnipay-taiwan/omnipay-:gateway)
11-
7+
[![Build Status](https://img.shields.io/travis/omnipay-taiwan/omnipay-gomypay/master.svg?style=flat-square)](https://travis-ci.org/omnipay-taiwan/omnipay-gomypay)
8+
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/omnipay-taiwan/omnipay-gomypay.svg?style=flat-square)](https://scrutinizer-ci.com/g/omnipay-taiwan/omnipay-gomypay/code-structure)
9+
[![Quality Score](https://img.shields.io/scrutinizer/g/omnipay-taiwan/omnipay-gomypay.svg?style=flat-square)](https://scrutinizer-ci.com/g/omnipay-taiwan/omnipay-gomypay)
10+
[![Total Downloads](https://img.shields.io/packagist/dt/omnipay-taiwan/omnipay-gomypay.svg?style=flat-square)](https://packagist.org/packages/omnipay-taiwan/omnipay-gomypay)
1211

1312
[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
14-
processing library for PHP 5.3+. This package implements :gateway support for Omnipay.
13+
processing library for PHP 5.3+. This package implements Gomypay support for Omnipay.
1514

16-
**Note:** Replace `omnipay-taiwan`, `recca0120`, `recca0120), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE.md](LICENSE.md) and [composer.json](composer.json) files, then delete this line.
15+
**Note:** Replace `omnipay-taiwan`, `recca0120`, `
16+
recca0120), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE.md](LICENSE.md)
17+
and [composer.json](composer.json) files, then delete this line.
1718

1819
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what
1920
PSRs you support to avoid any confusion with users and contributors.
@@ -23,14 +24,14 @@ PSRs you support to avoid any confusion with users and contributors.
2324
Instal the gateway using require. Require the `league/omnipay` base package and this gateway.
2425

2526
``` bash
26-
$ composer require league/omnipay omnipay-taiwan/omnipay-:gateway
27+
$ composer require league/omnipay omnipay-taiwan/omnipay-gomypay
2728
```
2829

2930
## Usage
3031

3132
The following gateways are provided by this package:
3233

33-
* :gateway
34+
* Gomypay
3435

3536
For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay) repository.
3637

@@ -44,7 +45,8 @@ If you want to keep up to date with release announcements, discuss ideas for the
4445
or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which
4546
you can subscribe to.
4647

47-
If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/omnipay-taiwan/omnipay-:gateway/issues),
48+
If you believe you have found a bug, please report it using
49+
the [GitHub issue tracker](https://github.com/omnipay-taiwan/omnipay-gomypay/issues),
4850
or better yet, fork the library and submit a pull request.
4951

5052
## Change log

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"omnipay/common": "^3.0"
1919
},
2020
"require-dev": {
21-
"roave/security-advisories": "dev-latest",
2221
"omnipay/tests": "^3.0|^4.0",
2322
"squizlabs/php_codesniffer": "^3"
2423
},

src/Message/AcceptNotificationRequest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Omnipay\Gomypay\Message;
44

55
use Omnipay\Common\Exception\InvalidRequestException;
6-
use Omnipay\Common\Exception\InvalidResponseException;
76
use Omnipay\Common\Message\NotificationInterface;
87
use Omnipay\Gomypay\Traits\HasGomypay;
98

@@ -18,14 +17,12 @@ public function getData()
1817

1918
/**
2019
* @throws InvalidRequestException
21-
* @throws InvalidResponseException
2220
*/
2321
public function sendData($data)
2422
{
2523
$data = array_merge(['Amount' => (int) $this->getAmount()], $data);
26-
27-
if (! hash_equals($this->makeHash($data), $data['str_check'])) {
28-
throw new InvalidResponseException('Invalid hash');
24+
if (! hash_equals($this->makeHash($data), $data['str_check'] ?: '')) {
25+
throw new InvalidRequestException('Incorrect hash');
2926
}
3027

3128
return $this->response = new AcceptNotificationResponse($this, $data);

src/Message/CompletePurchaseRequest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Omnipay\Gomypay\Message;
44

55
use Omnipay\Common\Exception\InvalidRequestException;
6-
use Omnipay\Common\Exception\InvalidResponseException;
76
use Omnipay\Gomypay\Traits\HasGomypay;
87

98
class CompletePurchaseRequest extends AbstractRequest
@@ -17,18 +16,17 @@ public function getData()
1716

1817
/**
1918
* @throws InvalidRequestException
20-
* @throws InvalidResponseException
2119
*/
2220
public function sendData($data)
2321
{
2422
$data = array_merge(['Amount' => (int) $this->getAmount()], $data);
2523

2624
if (! array_key_exists('e_orderno', $data)) {
27-
throw new InvalidResponseException($data['ret_msg']);
25+
throw new InvalidRequestException($data['ret_msg']);
2826
}
2927

30-
if (! hash_equals($this->makeHash($data), $data['str_check'])) {
31-
throw new InvalidResponseException('Invalid hash');
28+
if (! hash_equals($this->makeHash($data), $data['str_check'] ?: '')) {
29+
throw new InvalidRequestException('Invalid hash');
3230
}
3331

3432
return $this->response = new CompletePurchaseResponse($this, $data);

src/Message/GetPaymentInfoRequest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Omnipay\Gomypay\Message;
44

55
use Omnipay\Common\Exception\InvalidRequestException;
6-
use Omnipay\Common\Exception\InvalidResponseException;
76
use Omnipay\Gomypay\Traits\HasGomypay;
87

98
class GetPaymentInfoRequest extends AbstractRequest
@@ -17,14 +16,12 @@ public function getData()
1716

1817
/**
1918
* @throws InvalidRequestException
20-
* @throws InvalidResponseException
2119
*/
2220
public function sendData($data)
2321
{
2422
$data = array_merge(['Amount' => (int) $this->getAmount()], $data);
25-
26-
if (! hash_equals($this->makeHash($data), $data['str_check'])) {
27-
throw new InvalidResponseException('Invalid hash');
23+
if (! hash_equals($this->makeHash($data), $data['str_check'] ?: '')) {
24+
throw new InvalidRequestException('Invalid hash');
2825
}
2926

3027
return $this->response = new GetPaymentInfoResponse($this, $data);

tests/Message/CompletePurchaseRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Omnipay\Gomypay\Tests\Message;
44

5-
use Omnipay\Common\Exception\InvalidResponseException;
5+
use Omnipay\Common\Exception\InvalidRequestException;
66
use Omnipay\Gomypay\Message\CompletePurchaseRequest;
77
use Omnipay\Tests\TestCase;
88

@@ -71,7 +71,7 @@ public function testGetUnionPayData()
7171

7272
public function testInvalidResponse()
7373
{
74-
$this->expectException(InvalidResponseException::class);
74+
$this->expectException(InvalidRequestException::class);
7575
$this->expectExceptionMessage('此特店未啟用信用卡交易功能');
7676
$this->getHttpRequest()->query->replace([
7777
'result' => '0',

0 commit comments

Comments
 (0)