Skip to content

Commit 0a5f683

Browse files
committed
Fixed some tests
1 parent 48bb575 commit 0a5f683

File tree

3 files changed

+70
-58
lines changed

3 files changed

+70
-58
lines changed

tests/Message/DirectPostAuthorizeRequestTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ public function setUp()
1212

1313
$this->request->initialize(
1414
array(
15-
'merchantId' => 'foo',
15+
'merchantId' => 'foo',
1616
'transactionPassword' => 'bar',
17-
'amount' => '12.00',
18-
'returnUrl' => 'https://www.abc.com/return',
19-
'card' => array(
20-
'number' => '4444333322221111',
17+
'amount' => '12.00',
18+
'returnUrl' => 'https://www.abc.com/return',
19+
'card' => array(
20+
'number' => '4444333322221111',
2121
'expiryMonth' => '6',
22-
'expiryYear' => '2030',
23-
'cvv' => '123',
22+
'expiryYear' => '2030',
23+
'cvv' => '123',
2424
),
2525
)
2626
);

tests/Message/DirectPostCompletePurchaseRequestTest.php

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,74 +13,85 @@ public function setUp()
1313

1414
public function testGenerateResponseFingerprint()
1515
{
16-
$this->request->initialize(array(
17-
'amount' => '465.18',
18-
'transactionPassword' => 'abc123',
19-
));
16+
$this->request->initialize(
17+
array(
18+
'amount' => '465.18',
19+
'transactionPassword' => 'abcd1234',
20+
)
21+
);
2022

2123
$data = array(
22-
'timestamp' => '20130602102927',
23-
'merchant' => 'ABC0030',
24-
'refid' => '222',
24+
'timestamp' => '20161125123332',
25+
'merchant' => 'XYZ0010',
26+
'refid' => '222',
2527
'summarycode' => '2',
2628
);
2729

28-
$this->assertSame('0516a31bf96ad89c354266afb9bd4be43aaf853f', $this->request->generateResponseFingerprint($data));
30+
$this->assertSame('79200d1df5dc3f914a90ce476fdef317d224629f',
31+
$this->request->generateResponseFingerprint($data));
2932
}
3033

3134
public function testSuccess()
3235
{
33-
$this->request->initialize(array(
34-
'amount' => '355.00',
35-
'transactionPassword' => 'abc123',
36-
));
36+
$this->request->initialize(
37+
array(
38+
'amount' => '12.00',
39+
'transactionPassword' => 'abcd1234',
40+
'transactionId' => 'ORDER-ZYX8',
41+
)
42+
);
3743

38-
$this->getHttpRequest()->query->replace(array(
39-
'timestamp' => '20130602112954',
40-
'callback_status_code' => '',
41-
'fingerprint' => 'd9b40fc6f841f41ef3475220fe6316406a5256ce',
42-
'txnid' => '205861',
43-
'merchant' => 'ABC0030',
44-
'restext' => 'Approved',
45-
'rescode' => '00',
46-
'expirydate' => '032016',
47-
'settdate' => '20130602',
48-
'refid' => '226',
49-
'pan' => '444433...111',
50-
'summarycode' => '1',
51-
));
44+
$this->getHttpRequest()->query->replace(
45+
array(
46+
'timestamp' => '20161125130241',
47+
'callback_status_code' => '-1',
48+
'fingerprint' => 'e30eb8381bc41201fbdf54a021d8228a3fbb6a6f',
49+
'txnid' => '271337',
50+
'merchant' => 'XYZ0010',
51+
'restext' => 'Approved',
52+
'rescode' => '00',
53+
'expirydate' => '20161126',
54+
'settdate' => '20161126',
55+
'refid' => 'ORDER-ZYX8',
56+
'pan' => '444433...111',
57+
'summarycode' => '1',
58+
)
59+
);
5260

5361
$response = $this->request->send();
5462

55-
$this->assertInstanceOf('Omnipay\NABTransact\Message\DirectPostCompletePurchaseResponse', $response);
63+
$this->assertInstanceOf(
64+
'Omnipay\NABTransact\Message\DirectPostCompletePurchaseResponse',
65+
$response
66+
);
5667

5768
$this->assertTrue($response->isSuccessful());
5869
$this->assertFalse($response->isRedirect());
59-
$this->assertSame('205861', $response->getTransactionReference());
70+
$this->assertSame('271337', $response->getTransactionReference());
6071
$this->assertSame('Approved', $response->getMessage());
6172
$this->assertSame('00', $response->getCode());
6273
}
6374

6475
public function testFailure()
6576
{
6677
$this->request->initialize(array(
67-
'amount' => '465.18',
78+
'amount' => '465.18',
6879
'transactionPassword' => 'abc123',
6980
));
7081

7182
$this->getHttpRequest()->query->replace(array(
72-
'timestamp' => '20130602102927',
83+
'timestamp' => '20130602102927',
7384
'callback_status_code' => '',
74-
'fingerprint' => '0516a31bf96ad89c354266afb9bd4be43aaf853f',
75-
'txnid' => '205833',
76-
'merchant' => 'ABC0030',
77-
'restext' => 'Customer Dispute',
78-
'rescode' => '18',
79-
'expirydate' => '052016',
80-
'settdate' => '20130602',
81-
'refid' => '222',
82-
'pan' => '444433...111',
83-
'summarycode' => '2',
85+
'fingerprint' => '0516a31bf96ad89c354266afb9bd4be43aaf853f',
86+
'txnid' => '205833',
87+
'merchant' => 'ABC0030',
88+
'restext' => 'Customer Dispute',
89+
'rescode' => '18',
90+
'expirydate' => '052016',
91+
'settdate' => '20130602',
92+
'refid' => '222',
93+
'pan' => '444433...111',
94+
'summarycode' => '2',
8495
));
8596

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

tests/Message/DirectPostPurchaseRequestTest.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ public function setUp()
1212

1313
$this->request->initialize(
1414
array(
15-
'merchantId' => 'foo',
16-
'transactionPassword' => 'bar',
17-
'amount' => '12.00',
18-
'returnUrl' => 'https://www.example.com/return',
19-
'card' => array(
20-
'number' => '4444333322221111',
21-
'expiryMonth' => '6',
22-
'expiryYear' => '2020',
23-
'cvv' => '123',
15+
'merchantId' => 'XYZ0010',
16+
'transactionPassword' => 'abcd1234',
17+
'amount' => '12.00',
18+
'returnUrl' => 'https://www.example.com/return',
19+
'card' => array(
20+
'number' => '4444333322221111',
21+
'expiryMonth' => '06',
22+
'expiryYear' => '2020',
23+
'cvv' => '123',
2424
),
2525
)
2626
);
@@ -29,9 +29,10 @@ public function setUp()
2929
public function testFingerprint()
3030
{
3131
$data = $this->request->getData();
32-
$data['EPS_TIMESTAMP'] = '20130416123332';
32+
$data['EPS_TIMESTAMP'] = '20161125123332';
3333

34-
$this->assertSame('652856e75b04c5916a41082e04c9390961497f65', $this->request->generateFingerprint($data));
34+
$this->assertSame('cbb64e71e360dba6337f22a00bdf0d0b89a7a568',
35+
$this->request->generateFingerprint($data));
3536
}
3637

3738
public function testSend()

0 commit comments

Comments
 (0)