Skip to content

Commit eb1f23a

Browse files
committed
Added some fixes to resolve conflict
2 parents 9900c59 + 7fc4f58 commit eb1f23a

22 files changed

+93
-198
lines changed

index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212

1313
$gateway->setTestMode(true);
1414

15-
$card = new CreditCard(array(
15+
$card = new CreditCard([
1616
'firstName' => 'Sujip',
1717
'lastName' => 'Thapa',
1818
'number' => '4444333322221111',
1919
'expiryMonth' => '10',
2020
'expiryYear' => '2030',
2121
'cvv' => '123',
22-
));
22+
]);
2323

24-
$response = $gateway->purchase(array(
24+
$response = $gateway->purchase([
2525
'amount' => '12.00',
2626
'transactionId' => 'ORDER-ZYX8',
2727
'currency' => 'AUD',
2828
'card' => $card,
29-
))
29+
])
3030
->send();
3131

3232
$message = sprintf(

src/HostedPaymentGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
class HostedPaymentGateway extends AbstractGateway
1111
{
12-
public function completePurchase(array $parameters = array())
12+
public function completePurchase(array $parameters = [])
1313
{
1414
return $this->createRequest('\Omnipay\NABTransact\Message\HostedPaymentCompletePurchaseRequest', $parameters);
1515
}
@@ -24,7 +24,7 @@ public function getName()
2424
return 'NAB Hosted Payment';
2525
}
2626

27-
public function purchase(array $parameters = array())
27+
public function purchase(array $parameters = [])
2828
{
2929
return $this->createRequest('\Omnipay\NABTransact\Message\HostedPaymentPurchaseRequest', $parameters);
3030
}

src/Message/HostedPaymentPurchaseRequest.php

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,10 @@
77
*/
88
class HostedPaymentPurchaseRequest extends AbstractRequest
99
{
10-
/**
11-
* @var string
12-
*/
1310
public $liveEndpoint = 'https://transact.nab.com.au/test/hpp/payment';
1411

15-
/**
16-
* @var string
17-
*/
1812
public $testEndpoint = 'https://transact.nab.com.au/live/hpp/payment';
1913

20-
/**
21-
* @return mixed
22-
*/
2314
public function getData()
2415
{
2516
$this->validate(
@@ -30,7 +21,7 @@ public function getData()
3021
'paymentAlertEmail'
3122
);
3223

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

3526
$data['vendor_name'] = $this->getMerchantId();
3627
$data['payment_alert'] = $this->getPaymentAlertEmail();
@@ -44,55 +35,31 @@ public function getData()
4435
return $data;
4536
}
4637

47-
/**
48-
* @return mixed
49-
*/
5038
public function getMerchantId()
5139
{
5240
return $this->getParameter('merchantId');
5341
}
5442

55-
/**
56-
* @return mixed
57-
*/
5843
public function getPaymentAlertEmail()
5944
{
6045
return $this->getParameter('paymentAlertEmail');
6146
}
6247

63-
/**
64-
* @return mixed
65-
*/
6648
public function getReturnUrlText()
6749
{
6850
return $this->getParameter('returnUrlText');
6951
}
7052

71-
/**
72-
* @param $data
73-
*
74-
* @return mixed
75-
*/
7653
public function sendData($data)
7754
{
7855
return $this->response = new HostedPaymentPurchaseResponse($this, $data, $this->getEndpoint());
7956
}
8057

81-
/**
82-
* @param $value
83-
*
84-
* @return mixed
85-
*/
8658
public function setPaymentAlertEmail($value)
8759
{
8860
return $this->setParameter('paymentAlertEmail', $value);
8961
}
9062

91-
/**
92-
* @param $value
93-
*
94-
* @return mixed
95-
*/
9663
public function setReturnUrlText($value)
9764
{
9865
return $this->setParameter('returnUrlText', $value);

src/Message/SecureXMLAbstractRequest.php

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,28 @@
77
*/
88
abstract class SecureXMLAbstractRequest extends AbstractRequest
99
{
10-
/**
11-
* @var string
12-
*/
1310
public $testEndpoint = 'https://demo.transact.nab.com.au/xmlapi/payment';
1411

15-
/**
16-
* @var string
17-
*/
1812
public $liveEndpoint = 'https://transact.nab.com.au/live/xmlapi/payment';
1913

20-
/**
21-
* @var string
22-
*/
2314
protected $requestType = 'Payment';
2415

25-
/**
26-
* @var mixed
27-
*/
2816
protected $txnType;
2917

30-
/**
31-
* @var array
32-
*/
33-
protected $requiredFields = array();
18+
protected $requiredFields = [];
3419

35-
/**
36-
* Set the messageID on the request.
37-
*
38-
* This is returned intact on any response so you could add a local
39-
* database ID here to ease in matching data later.
40-
*/
4120
public function setMessageId($value)
4221
{
4322
return $this->setParameter('messageId', $value);
4423
}
4524

46-
/**
47-
* Generates a SecureXML messageId.
48-
*
49-
* @return string
50-
*/
5125
public function generateMessageId()
5226
{
5327
$hash = hash('sha256', microtime());
5428

5529
return substr($hash, 0, 30);
5630
}
5731

58-
/**
59-
* Get the messageID or generated one based on timestamp.
60-
*
61-
* @return string
62-
*/
6332
public function getMessageId()
6433
{
6534
$messageId = $this->getParameter('messageId');
@@ -71,11 +40,6 @@ public function getMessageId()
7140
return $this->getParameter('messageId');
7241
}
7342

74-
/**
75-
* @param $data
76-
*
77-
* @return mixed
78-
*/
7943
public function sendData($data)
8044
{
8145
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data->asXML())->send();

src/Message/SecureXMLAuthorizeRequest.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,10 @@
1212
*/
1313
class SecureXMLAuthorizeRequest extends SecureXMLAbstractRequest
1414
{
15-
/**
16-
* @var int
17-
*/
1815
protected $txnType = 10;
1916

20-
/**
21-
* @var array
22-
*/
23-
protected $requiredFields = array('amount', 'card', 'transactionId');
17+
protected $requiredFields = ['amount', 'card', 'transactionId'];
2418

25-
/**
26-
* @return mixed
27-
*/
2819
public function getData()
2920
{
3021
return $this->getBasePaymentXMLWithCard();

src/Message/SecureXMLCaptureRequest.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,10 @@
1313
*/
1414
class SecureXMLCaptureRequest extends SecureXMLAbstractRequest
1515
{
16-
/**
17-
* @var int
18-
*/
1916
protected $txnType = 11;
2017

21-
/**
22-
* @var array
23-
*/
24-
protected $requiredFields = array('amount', 'transactionId', 'preauthId');
18+
protected $requiredFields = ['amount', 'transactionId', 'preauthId'];
2519

26-
/**
27-
* @return mixed
28-
*/
2920
public function getData()
3021
{
3122
$xml = $this->getBasePaymentXML();
@@ -37,8 +28,6 @@ public function getData()
3728

3829
/**
3930
* Set the preauthId that was returned as part of the original authorize request.
40-
*
41-
* @return mixed
4231
*/
4332
public function setPreauthId($value)
4433
{

src/Message/SecureXMLEchoTestRequest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@
1212
*/
1313
class SecureXMLEchoTestRequest extends SecureXMLAbstractRequest
1414
{
15-
/**
16-
* @var string
17-
*/
1815
protected $requestType = 'Echo';
1916

20-
/**
21-
* @return mixed
22-
*/
2317
public function getData()
2418
{
2519
return $this->getBaseXML();

src/Message/SecureXMLPurchaseRequest.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,10 @@
77
*/
88
class SecureXMLPurchaseRequest extends SecureXMLAbstractRequest
99
{
10-
/**
11-
* @var int
12-
*/
1310
protected $txnType = 0;
1411

15-
/**
16-
* @var array
17-
*/
18-
protected $requiredFields = array('amount', 'card', 'transactionId');
12+
protected $requiredFields = ['amount', 'card', 'transactionId'];
1913

20-
/**
21-
* @return mixed
22-
*/
2314
public function getData()
2415
{
2516
return $this->getBasePaymentXMLWithCard();

src/Message/SecureXMLRefundRequest.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,10 @@
1212
*/
1313
class SecureXMLRefundRequest extends SecureXMLAbstractRequest
1414
{
15-
/**
16-
* @var int
17-
*/
1815
protected $txnType = 4;
1916

20-
/**
21-
* @var array
22-
*/
23-
protected $requiredFields = array('amount', 'transactionId', 'transactionReference');
17+
protected $requiredFields = ['amount', 'transactionId', 'transactionReference'];
2418

25-
/**
26-
* @return mixed
27-
*/
2819
public function getData()
2920
{
3021
$xml = $this->getBasePaymentXML();

src/Message/SecureXMLResponse.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public function getResponseText()
8080
public function getCode()
8181
{
8282
return $this->hasTransaction()
83-
? (string) $this->data->Payment->TxnList->Txn->responseCode
84-
: (string) $this->data->Status->statusCode;
83+
? (string) $this->data->Payment->TxnList->Txn->responseCode
84+
: (string) $this->data->Status->statusCode;
8585
}
8686

8787
/**
@@ -92,8 +92,8 @@ public function getCode()
9292
public function getMessage()
9393
{
9494
return $this->hasTransaction()
95-
? (string) $this->data->Payment->TxnList->Txn->responseText
96-
: (string) $this->data->Status->statusDescription;
95+
? (string) $this->data->Payment->TxnList->Txn->responseText
96+
: (string) $this->data->Status->statusDescription;
9797
}
9898

9999
/**
@@ -112,8 +112,8 @@ public function getMessageTimestamp()
112112
public function getTransactionReference()
113113
{
114114
return $this->hasTransaction()
115-
? (string) $this->data->Payment->TxnList->Txn->purchaseOrderNo
116-
: null;
115+
? (string) $this->data->Payment->TxnList->Txn->purchaseOrderNo
116+
: null;
117117
}
118118

119119
/**
@@ -122,8 +122,8 @@ public function getTransactionReference()
122122
public function getTransactionId()
123123
{
124124
return $this->hasTransaction()
125-
? (string) $this->data->Payment->TxnList->Txn->txnID
126-
: null;
125+
? (string) $this->data->Payment->TxnList->Txn->txnID
126+
: null;
127127
}
128128

129129
/**
@@ -134,8 +134,8 @@ public function getTransactionId()
134134
public function getTransactionAmount()
135135
{
136136
return $this->hasTransaction()
137-
? (string) $this->data->Payment->TxnList->Txn->amount
138-
: null;
137+
? (string) $this->data->Payment->TxnList->Txn->amount
138+
: null;
139139
}
140140

141141
/**
@@ -146,8 +146,8 @@ public function getTransactionAmount()
146146
public function getTransactionCurrency()
147147
{
148148
return $this->hasTransaction()
149-
? (string) $this->data->Payment->TxnList->Txn->currency
150-
: null;
149+
? (string) $this->data->Payment->TxnList->Txn->currency
150+
: null;
151151
}
152152

153153
/**
@@ -158,8 +158,8 @@ public function getTransactionCurrency()
158158
public function getTransactionSource()
159159
{
160160
return $this->hasTransaction()
161-
? (string) $this->data->Payment->TxnList->Txn->txnSource
162-
: null;
161+
? (string) $this->data->Payment->TxnList->Txn->txnSource
162+
: null;
163163
}
164164

165165
/**
@@ -170,7 +170,7 @@ public function getTransactionSource()
170170
public function getSettlementDate()
171171
{
172172
return $this->hasTransaction()
173-
? (string) $this->data->Payment->TxnList->Txn->settlementDate
174-
: null;
173+
? (string) $this->data->Payment->TxnList->Txn->settlementDate
174+
: null;
175175
}
176176
}

0 commit comments

Comments
 (0)