Skip to content

Commit

Permalink
Merge pull request #33 from sudiptpa/fix/invalid-finger-print
Browse files Browse the repository at this point in the history
Added Fix for Invalid fingerprint issue seen lately in Package.
  • Loading branch information
sudiptpa authored Mar 17, 2020
2 parents 1e8f781 + 6e3d748 commit 00fb774
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Message/DirectPostAbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function generateFingerprint(array $data)
$data['EPS_TIMESTAMP'],
]);

return hash_hmac('sha256', $hash, true);
return hash_hmac('sha256', $hash, $this->getTransactionPassword());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Message/DirectPostCompletePurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function generateResponseFingerprint($data)
$data['summarycode'],
]);

return hash_hmac('sha256', $hash, true);
return hash_hmac('sha256', $hash, $this->getTransactionPassword());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/DirectPostAuthorizeRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testFingerprint()
$data = $this->request->getData();
$data['EPS_TIMESTAMP'] = '20190215173250';

$this->assertSame('61d48022818196fb1bbe4e029c4280b163496751bc9a479b6e1dfaf6d134a490', $this->request->generateFingerprint($data));
$this->assertSame('3a263ec515c7272ea1ab656b454923b801fa14ad13ac0b3ad616693b1d137431', $this->request->generateFingerprint($data));
}

public function testSend()
Expand Down
6 changes: 3 additions & 3 deletions tests/Message/DirectPostCompletePurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testGenerateResponseFingerprint()
];

$this->assertSame(
'3cdf9934588f2fa4b00df5adb36aec486befdaecdbb3de4c2515d00e05391101',
'c424541f1cc72055386c81b5b6b021312424024cd6b7d0c4feb949126e642e87',
$this->request->generateResponseFingerprint($data)
);
}
Expand All @@ -42,7 +42,7 @@ public function testSuccess()
$this->getHttpRequest()->query->replace([
'timestamp' => '20190215173250',
'callback_status_code' => '-1',
'fingerprint' => 'd319e8852e94972f8ef3f330884a0f5db85c6341fd367d6823a99e9b93d917c0',
'fingerprint' => 'f4c6c0a4a3dd3a3dc1202b12d20b471d9595f587474a84c51e8916f86a9fc7a5',
'txnid' => '271337',
'merchant' => 'XYZ0010',
'restext' => 'Approved',
Expand Down Expand Up @@ -75,7 +75,7 @@ public function testFailure()
$this->getHttpRequest()->query->replace([
'timestamp' => '20190215173250',
'callback_status_code' => '404',
'fingerprint' => 'af490d2635a7ebe8e97313fbea61924a51f4b4d095e2cf7a2a81f8fc3f5ca919',
'fingerprint' => 'f8a4ecc7a81a3f682b79a7995a2c15ee3bea10a55dedf7a1cf4b99298b0716e4',
'txnid' => '274279',
'merchant' => 'XYZ0010',
'restext' => 'Customer Dispute',
Expand Down
2 changes: 1 addition & 1 deletion tests/Message/DirectPostPurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testFingerprint()
$data = $this->request->getData();
$data['EPS_TIMESTAMP'] = '20190215173250';

$this->assertSame('607a5371820b6c07a1233b7ab140f7a1990e1a9a446840fb11586ccf50d7482d', $this->request->generateFingerprint($data));
$this->assertSame('ca7a91c3ec55b360e4f185790eb49daf41a20c629ffe6eb04bf4eb04bebe68f5', $this->request->generateFingerprint($data));
}

public function testSend()
Expand Down
8 changes: 5 additions & 3 deletions tests/Message/UnionPayPurchaseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testFingerprint()
$data = $this->request->getData();
$data['EPS_TIMESTAMP'] = '20190215173250';

$this->assertSame('9c0c1edb9036239fc61a9a277af5b69f608a1b99808c9173c34463c362a16076', $this->request->generateFingerprint($data));
$this->assertSame('1b72d460b36e6633bf57b119d6bd3635da6fc57324a622c1d41b5b26f08fce8d', $this->request->generateFingerprint($data));
}

public function testPurchase()
Expand All @@ -39,8 +39,10 @@ public function testPurchase()
$this->assertNull($response->getMessage());
$this->assertNull($response->getCode());

$this->assertStringStartsWith('https://transact.nab.com.au/live/directpostv2/authorise',
$response->getRedirectUrl());
$this->assertStringStartsWith(
'https://transact.nab.com.au/live/directpostv2/authorise',
$response->getRedirectUrl()
);
$this->assertSame('GET', $response->getRedirectMethod());
$this->assertArrayHasKey('EPS_FINGERPRINT', $response->getData());
}
Expand Down

0 comments on commit 00fb774

Please sign in to comment.