Skip to content

Commit 0203b02

Browse files
committed
Merge branch 'upgrading-v3' of https://github.com/sudiptpa/omnipay-nabtransact into upgrading-v3
2 parents 565e61c + 36c30f7 commit 0203b02

13 files changed

+94
-94
lines changed

index.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require __DIR__ . '/vendor/autoload.php';
3+
require __DIR__.'/vendor/autoload.php';
44

55
use Omnipay\Common\CreditCard;
66
use Omnipay\Omnipay;
@@ -13,19 +13,19 @@
1313
$gateway->setTestMode(true);
1414

1515
$card = new CreditCard([
16-
'firstName' => 'Sujip',
17-
'lastName' => 'Thapa',
18-
'number' => '4444333322221111',
16+
'firstName' => 'Sujip',
17+
'lastName' => 'Thapa',
18+
'number' => '4444333322221111',
1919
'expiryMonth' => '12',
20-
'expiryYear' => date('Y'),
21-
'cvv' => '123',
20+
'expiryYear' => date('Y'),
21+
'cvv' => '123',
2222
]);
2323

2424
$response = $gateway->purchase([
25-
'amount' => '12.00',
25+
'amount' => '12.00',
2626
'transactionId' => 'ORDER-ZYX8789',
27-
'currency' => 'AUD',
28-
'card' => $card,
27+
'currency' => 'AUD',
28+
'card' => $card,
2929
])->send();
3030

3131
$message = sprintf(

src/DirectPostGateway.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public function getName()
2222
public function getDefaultParameters()
2323
{
2424
return [
25-
'merchantId' => '',
25+
'merchantId' => '',
2626
'transactionPassword' => '',
27-
'testMode' => false,
27+
'testMode' => false,
2828
];
2929
}
3030

@@ -69,7 +69,7 @@ public function setTransactionPassword($value)
6969
*
7070
* @return mixed
7171
*/
72-
public function authorize(array $parameters = array())
72+
public function authorize(array $parameters = [])
7373
{
7474
return $this->createRequest('\Omnipay\NABTransact\Message\DirectPostAuthorizeRequest', $parameters);
7575
}
@@ -79,7 +79,7 @@ public function authorize(array $parameters = array())
7979
*
8080
* @return mixed
8181
*/
82-
public function completeAuthorize(array $parameters = array())
82+
public function completeAuthorize(array $parameters = [])
8383
{
8484
return $this->createRequest('\Omnipay\NABTransact\Message\DirectPostCompletePurchaseRequest', $parameters);
8585
}
@@ -89,7 +89,7 @@ public function completeAuthorize(array $parameters = array())
8989
*
9090
* @return mixed
9191
*/
92-
public function purchase(array $parameters = array())
92+
public function purchase(array $parameters = [])
9393
{
9494
return $this->createRequest('\Omnipay\NABTransact\Message\DirectPostPurchaseRequest', $parameters);
9595
}
@@ -99,7 +99,7 @@ public function purchase(array $parameters = array())
9999
*
100100
* @return mixed
101101
*/
102-
public function completePurchase(array $parameters = array())
102+
public function completePurchase(array $parameters = [])
103103
{
104104
return $this->createRequest('\Omnipay\NABTransact\Message\DirectPostCompletePurchaseRequest', $parameters);
105105
}

src/HostedPaymentGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class HostedPaymentGateway extends AbstractGateway
1414
*
1515
* @return mixed
1616
*/
17-
public function completePurchase(array $parameters = array())
17+
public function completePurchase(array $parameters = [])
1818
{
1919
return $this->createRequest('\Omnipay\NABTransact\Message\HostedPaymentCompletePurchaseRequest', $parameters);
2020
}
@@ -37,7 +37,7 @@ public function getName()
3737
*
3838
* @return mixed
3939
*/
40-
public function purchase(array $parameters = array())
40+
public function purchase(array $parameters = [])
4141
{
4242
return $this->createRequest('\Omnipay\NABTransact\Message\HostedPaymentPurchaseRequest', $parameters);
4343
}

src/Message/HostedPaymentPurchaseRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getData()
3030
'paymentAlertEmail'
3131
);
3232

33-
$data = array();
33+
$data = [];
3434

3535
$data['vendor_name'] = $this->getMerchantId();
3636
$data['payment_alert'] = $this->getPaymentAlertEmail();

src/SecureXMLGateway.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public function getName()
1717
public function getDefaultParameters()
1818
{
1919
return [
20-
'merchantId' => '',
20+
'merchantId' => '',
2121
'transactionPassword' => '',
22-
'testMode' => false,
22+
'testMode' => false,
2323
];
2424
}
2525

@@ -64,7 +64,7 @@ public function setTransactionPassword($value)
6464
*
6565
* @return mixed
6666
*/
67-
public function authorize(array $parameters = array())
67+
public function authorize(array $parameters = [])
6868
{
6969
return $this->createRequest('\Omnipay\NABTransact\Message\SecureXMLAuthorizeRequest', $parameters);
7070
}
@@ -74,7 +74,7 @@ public function authorize(array $parameters = array())
7474
*
7575
* @return mixed
7676
*/
77-
public function capture(array $parameters = array())
77+
public function capture(array $parameters = [])
7878
{
7979
return $this->createRequest('\Omnipay\NABTransact\Message\SecureXMLCaptureRequest', $parameters);
8080
}
@@ -84,7 +84,7 @@ public function capture(array $parameters = array())
8484
*
8585
* @return mixed
8686
*/
87-
public function purchase(array $parameters = array())
87+
public function purchase(array $parameters = [])
8888
{
8989
return $this->createRequest('\Omnipay\NABTransact\Message\SecureXMLPurchaseRequest', $parameters);
9090
}
@@ -94,7 +94,7 @@ public function purchase(array $parameters = array())
9494
*
9595
* @return mixed
9696
*/
97-
public function refund(array $parameters = array())
97+
public function refund(array $parameters = [])
9898
{
9999
return $this->createRequest('\Omnipay\NABTransact\Message\SecureXMLRefundRequest', $parameters);
100100
}
@@ -104,7 +104,7 @@ public function refund(array $parameters = array())
104104
*
105105
* @return mixed
106106
*/
107-
public function echoTest(array $parameters = array())
107+
public function echoTest(array $parameters = [])
108108
{
109109
return $this->createRequest('\Omnipay\NABTransact\Message\SecureXMLEchoTestRequest', $parameters);
110110
}

src/UnionPayGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function getName()
1717
*
1818
* @return mixed
1919
*/
20-
public function purchase(array $parameters = array())
20+
public function purchase(array $parameters = [])
2121
{
2222
return $this->createRequest('\Omnipay\NABTransact\Message\UnionPayPurchaseRequest', $parameters);
2323
}
@@ -27,7 +27,7 @@ public function purchase(array $parameters = array())
2727
*
2828
* @return mixed
2929
*/
30-
public function completePurchase(array $parameters = array())
30+
public function completePurchase(array $parameters = [])
3131
{
3232
return $this->createRequest('\Omnipay\NABTransact\Message\UnionPayCompletePurchaseRequest', $parameters);
3333
}

tests/Message/DirectPostAuthorizeRequestTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ public function setUp()
1111
$this->request = new DirectPostAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest());
1212

1313
$this->request->initialize([
14-
'merchantId' => 'XYZ0010',
14+
'merchantId' => 'XYZ0010',
1515
'transactionPassword' => 'abcd1234',
16-
'amount' => '12.00',
17-
'returnUrl' => 'https://www.abc.com/return',
18-
'card' => [
19-
'number' => '4444333322221111',
16+
'amount' => '12.00',
17+
'returnUrl' => 'https://www.abc.com/return',
18+
'card' => [
19+
'number' => '4444333322221111',
2020
'expiryMonth' => '6',
21-
'expiryYear' => '2030',
22-
'cvv' => '123',
21+
'expiryYear' => '2030',
22+
'cvv' => '123',
2323
],
2424
]);
2525
}

tests/Message/DirectPostCompletePurchaseRequestTest.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public function setUp()
1414
public function testGenerateResponseFingerprint()
1515
{
1616
$this->request->initialize([
17-
'amount' => '465.18',
17+
'amount' => '465.18',
1818
'transactionPassword' => 'abcd1234',
1919
]);
2020

2121
$data = [
22-
'timestamp' => '20161125123332',
23-
'merchant' => 'XYZ0010',
24-
'refid' => '222',
22+
'timestamp' => '20161125123332',
23+
'merchant' => 'XYZ0010',
24+
'refid' => '222',
2525
'summarycode' => '2',
2626
];
2727

@@ -34,24 +34,24 @@ public function testGenerateResponseFingerprint()
3434
public function testSuccess()
3535
{
3636
$this->request->initialize([
37-
'amount' => '12.00',
37+
'amount' => '12.00',
3838
'transactionPassword' => 'abcd1234',
39-
'transactionId' => 'ORDER-ZYX8',
39+
'transactionId' => 'ORDER-ZYX8',
4040
]);
4141

4242
$this->getHttpRequest()->query->replace([
43-
'timestamp' => '20161125130241',
43+
'timestamp' => '20161125130241',
4444
'callback_status_code' => '-1',
45-
'fingerprint' => 'e30eb8381bc41201fbdf54a021d8228a3fbb6a6f',
46-
'txnid' => '271337',
47-
'merchant' => 'XYZ0010',
48-
'restext' => 'Approved',
49-
'rescode' => '00',
50-
'expirydate' => '20161126',
51-
'settdate' => '20161126',
52-
'refid' => 'ORDER-ZYX8',
53-
'pan' => '444433...111',
54-
'summarycode' => '1',
45+
'fingerprint' => 'e30eb8381bc41201fbdf54a021d8228a3fbb6a6f',
46+
'txnid' => '271337',
47+
'merchant' => 'XYZ0010',
48+
'restext' => 'Approved',
49+
'rescode' => '00',
50+
'expirydate' => '20161126',
51+
'settdate' => '20161126',
52+
'refid' => 'ORDER-ZYX8',
53+
'pan' => '444433...111',
54+
'summarycode' => '1',
5555
]);
5656

5757
$response = $this->request->send();
@@ -68,23 +68,23 @@ public function testSuccess()
6868
public function testFailure()
6969
{
7070
$this->request->initialize([
71-
'amount' => '465.18',
71+
'amount' => '465.18',
7272
'transactionPassword' => 'abcd1234',
7373
]);
7474

7575
$this->getHttpRequest()->query->replace([
76-
'timestamp' => '20161126051715',
76+
'timestamp' => '20161126051715',
7777
'callback_status_code' => '404',
78-
'fingerprint' => 'cd75e2ef38cf63a2fa390024539acc7691eebc1d',
79-
'txnid' => '274279',
80-
'merchant' => 'XYZ0010',
81-
'restext' => 'Customer Dispute',
82-
'rescode' => '18',
83-
'expirydate' => '102030',
84-
'settdate' => '20161126',
85-
'refid' => 'ORDER-ZYX8',
86-
'pan' => '444433...111',
87-
'summarycode' => '2',
78+
'fingerprint' => 'cd75e2ef38cf63a2fa390024539acc7691eebc1d',
79+
'txnid' => '274279',
80+
'merchant' => 'XYZ0010',
81+
'restext' => 'Customer Dispute',
82+
'rescode' => '18',
83+
'expirydate' => '102030',
84+
'settdate' => '20161126',
85+
'refid' => 'ORDER-ZYX8',
86+
'pan' => '444433...111',
87+
'summarycode' => '2',
8888
]);
8989

9090
$response = $this->request->send();

tests/Message/DirectPostPurchaseRequestTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ public function setUp()
1111
$this->request = new DirectPostPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
1212

1313
$this->request->initialize([
14-
'merchantId' => 'XYZ0010',
14+
'merchantId' => 'XYZ0010',
1515
'transactionPassword' => 'abcd1234',
16-
'amount' => '12.00',
17-
'returnUrl' => 'https://www.example.com/return',
18-
'card' => [
19-
'number' => '4444333322221111',
16+
'amount' => '12.00',
17+
'returnUrl' => 'https://www.example.com/return',
18+
'card' => [
19+
'number' => '4444333322221111',
2020
'expiryMonth' => '06',
21-
'expiryYear' => '2020',
22-
'cvv' => '123',
21+
'expiryYear' => '2020',
22+
'cvv' => '123',
2323
],
2424
]);
2525
}

tests/Message/SecureXMLAuthorizeRequestTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ public function setUp()
1111
$this->request = new SecureXMLAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest());
1212

1313
$this->request->initialize([
14-
'merchantId' => 'XYZ0010',
14+
'merchantId' => 'XYZ0010',
1515
'transactionPassword' => 'abcd1234',
16-
'testMode' => true,
17-
'amount' => '12.00',
18-
'transactionId' => '1234',
19-
'card' => [
20-
'number' => '4444333322221111',
21-
'expiryMonth' => '10',
22-
'expiryYear' => '2030',
23-
'cvv' => '123',
16+
'testMode' => true,
17+
'amount' => '12.00',
18+
'transactionId' => '1234',
19+
'card' => [
20+
'number' => '4444333322221111',
21+
'expiryMonth' => '10',
22+
'expiryYear' => '2030',
23+
'cvv' => '123',
2424
'cardHolderName' => 'Sujip Thapa',
2525
],
2626
]);

0 commit comments

Comments
 (0)