Skip to content

Commit 66d9abb

Browse files
committed
get amount directly
1 parent 4aa0c40 commit 66d9abb

File tree

8 files changed

+75
-59
lines changed

8 files changed

+75
-59
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ dirlist.cache
99
dirlist.vendor
1010

1111
.php-cs-fixer.cache
12+
.phpunit.result.cache

composer.json

Lines changed: 53 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,57 @@
11
{
2-
"name": "omnipay-taiwan/omnipay-payware",
3-
"type": "library",
4-
"description": "Payware driver for the Omnipay payment processing library",
5-
"keywords": [
6-
"payware",
7-
"gateway",
8-
"merchant",
9-
"omnipay",
10-
"pay",
11-
"payment"
12-
],
13-
"homepage": "https://github.com/omnipay-taiwan/omnipay-payware",
14-
"license": "MIT",
15-
"authors": [
16-
{
17-
"name": "Adrian Macneil",
18-
"email": "adrian@adrianmacneil.com"
19-
},
20-
{
21-
"name": "Omnipay Contributors",
22-
"homepage": "https://github.com/thephpleague/omnipay-dummy/contributors"
23-
},
24-
{
25-
"name": "recca0120",
26-
"email": "recca0120@gmail.com"
27-
}
28-
],
29-
"autoload": {
30-
"psr-4": {
31-
"Omnipay\\Payware\\": "src/"
32-
}
2+
"name": "omnipay-taiwan/omnipay-payware",
3+
"type": "library",
4+
"description": "Payware driver for the Omnipay payment processing library",
5+
"keywords": [
6+
"payware",
7+
"gateway",
8+
"merchant",
9+
"omnipay",
10+
"pay",
11+
"payment"
12+
],
13+
"homepage": "https://github.com/omnipay-taiwan/omnipay-payware",
14+
"license": "MIT",
15+
"authors": [
16+
{
17+
"name": "Adrian Macneil",
18+
"email": "adrian@adrianmacneil.com"
3319
},
34-
"autoload-dev": {
35-
"psr-4": {
36-
"Omnipay\\Payware\\Tests\\": "tests/"
37-
}
20+
{
21+
"name": "Omnipay Contributors",
22+
"homepage": "https://github.com/thephpleague/omnipay-dummy/contributors"
3823
},
39-
"require": {
40-
"omnipay/common": "~3.0"
41-
},
42-
"require-dev": {
43-
"omnipay/tests": "~3.0|~4.0",
44-
"squizlabs/php_codesniffer": "^3.0"
45-
},
46-
"extra": {
47-
"branch-alias": {
48-
"dev-master": "3.1.x-dev"
49-
}
50-
},
51-
"prefer-stable": true
24+
{
25+
"name": "recca0120",
26+
"email": "recca0120@gmail.com"
27+
}
28+
],
29+
"autoload": {
30+
"psr-4": {
31+
"Omnipay\\Payware\\": "src/"
32+
}
33+
},
34+
"autoload-dev": {
35+
"psr-4": {
36+
"Omnipay\\Payware\\Tests\\": "tests/"
37+
}
38+
},
39+
"require": {
40+
"omnipay/common": "~3.0"
41+
},
42+
"require-dev": {
43+
"omnipay/tests": "~3.0|~4.0",
44+
"squizlabs/php_codesniffer": "^3.0"
45+
},
46+
"extra": {
47+
"branch-alias": {
48+
"dev-master": "3.1.x-dev"
49+
}
50+
},
51+
"prefer-stable": true,
52+
"config": {
53+
"allow-plugins": {
54+
"php-http/discovery": true
55+
}
56+
}
5257
}

src/Gateway.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ public function getDefaultParameters()
107107
}
108108

109109
/**
110-
* @param array $options
111110
* @return RequestInterface
112111
*/
113112
public function purchase(array $options = [])
@@ -116,7 +115,6 @@ public function purchase(array $options = [])
116115
}
117116

118117
/**
119-
* @param array $options
120118
* @return RequestInterface
121119
*/
122120
public function completePurchase(array $options = [])
@@ -127,7 +125,6 @@ public function completePurchase(array $options = [])
127125
}
128126

129127
/**
130-
* @param array $options
131128
* @return RequestInterface|NotificationInterface
132129
*/
133130
public function acceptNotification(array $options = [])
@@ -136,7 +133,6 @@ public function acceptNotification(array $options = [])
136133
}
137134

138135
/**
139-
* @param array $options
140136
* @return RequestInterface
141137
*/
142138
public function receiveTransactionInfo(array $options = [])

src/Message/CompletePurchaseRequest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Omnipay\Common\Exception\InvalidRequestException;
66
use Omnipay\Common\Exception\InvalidResponseException;
77
use Omnipay\Payware\Support\Helper;
8+
use Omnipay\Payware\Traits\HasAmount;
89
use Omnipay\Payware\Traits\HasBooking;
910
use Omnipay\Payware\Traits\HasCreditCard;
1011
use Omnipay\Payware\Traits\HasCVS;
@@ -16,6 +17,7 @@ class CompletePurchaseRequest extends AbstractRequest
1617
use HasBooking;
1718
use HasCreditCard;
1819
use HasCVS;
20+
use HasAmount;
1921

2022
/**
2123
* @param int $authAmount
@@ -86,7 +88,6 @@ public function getPaymentDate()
8688
}
8789

8890
/**
89-
* @param $transferOutAccount
9091
* @return CompletePurchaseRequest
9192
*/
9293
public function setTransferOutAccount($transferOutAccount)
@@ -131,8 +132,8 @@ public function getData()
131132
'PayType' => $this->getPayType(),
132133
'BookingId' => $this->getTransactionReference(),
133134
'CustOrderNo' => $this->getTransactionId(),
134-
'Amount' => (int) $this->getAmount(),
135-
'AuthAmount' => (int) $this->getAuthAmount(),
135+
'Amount' => $this->getAmount(),
136+
'AuthAmount' => $this->getAuthAmount(),
136137
'RtnCode' => $this->getRtnCode(),
137138
'Card4no' => $this->getCard4No(),
138139
'Payment_no' => $this->getPaymentNo(),
@@ -169,7 +170,6 @@ private function checkMacValue($data)
169170
}
170171

171172
/**
172-
* @param $data
173173
* @return false|string
174174
*/
175175
private function makeHash($data)

src/Message/PurchaseRequest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
use Omnipay\Common\Exception\InvalidRequestException;
66
use Omnipay\Payware\Support\Helper;
7+
use Omnipay\Payware\Traits\HasAmount;
78
use Omnipay\Payware\Traits\HasMerchant;
89

910
class PurchaseRequest extends AbstractRequest
1011
{
1112
use HasMerchant;
13+
use HasAmount;
1214

1315
/**
1416
* @param string $orderNo
@@ -235,7 +237,7 @@ public function getData()
235237
'MerchantId' => $this->getMerchantId(),
236238
'TerminalId' => $this->getTerminalId(),
237239
'MerchantName' => $this->getMerchantName(),
238-
'Amount' => (int) $this->getAmount(),
240+
'Amount' => $this->getAmount(),
239241
'OrderNo' => $this->getTransactionId(),
240242
'ReturnURL' => $this->getReturnUrl(),
241243
'ReceiveURL' => $this->getReceiveUrl(),

src/Message/ReceiveTransactionInfoRequest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Omnipay\Common\Exception\InvalidRequestException;
66
use Omnipay\Common\Message\ResponseInterface;
77
use Omnipay\Payware\Support\Helper;
8+
use Omnipay\Payware\Traits\HasAmount;
89
use Omnipay\Payware\Traits\HasBooking;
910
use Omnipay\Payware\Traits\HasCVS;
1011
use Omnipay\Payware\Traits\HasMerchant;
@@ -16,6 +17,7 @@ class ReceiveTransactionInfoRequest extends AbstractRequest
1617
use HasBooking;
1718
use HasWebATM;
1819
use HasCVS;
20+
use HasAmount;
1921

2022
/**
2123
* @param string $payEndDate
@@ -45,7 +47,7 @@ public function getData()
4547
'MerchantId' => $this->getMerchantId(),
4648
'TerminalId' => $this->getTerminalId(),
4749
'PayType' => $this->getPayType(),
48-
'Amount' => (int) $this->getAmount(),
50+
'Amount' => $this->getAmount(),
4951
'BookingId' => $this->getBookingId(),
5052
'CustOrderNo' => $this->getTransactionId(),
5153
'SendType' => $this->getSendType(),

src/Traits/HasAmount.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Omnipay\Payware\Traits;
4+
5+
trait HasAmount
6+
{
7+
public function getAmount()
8+
{
9+
return $this->getParameter('amount');
10+
}
11+
}

src/Traits/HasMerchant.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
trait HasMerchant
88
{
99
/**
10-
* @param $endpoint
1110
* @return $this
1211
*/
1312
public function setEndpoint($endpoint)

0 commit comments

Comments
 (0)