Skip to content

Commit 9efd554

Browse files
authored
added test for merchantReference with space (#701)
* added test for merchantReference with space * removed extra space after test * removed extra whitespace * removed extra whitespace
1 parent 5bc9d69 commit 9efd554

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/Unit/Util/HmacSignatureTest.php

+21
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,27 @@ public function testNotificationRequestItemHmac()
5757
$this->fail('Unexpected exception');
5858
}
5959
}
60+
61+
public function testMerchantReferenceWithSpace()
62+
{
63+
$params = json_decode('{
64+
"pspReference": "7914073381342284",
65+
"merchantAccountCode": "TestMerchant",
66+
"merchantReference": " TestPayment-1407325143704",
67+
"amount": {
68+
"value": 1130,
69+
"currency": "EUR"
70+
},
71+
"eventCode": "AUTHORISATION",
72+
"success": "true"
73+
}', true);
74+
$hmacKey = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00";
75+
$hmac = new HmacSignature();
76+
$hmacCalculation = $hmac->calculateNotificationHMAC($hmacKey, $params);
77+
$expectedHmac = "kLZtgnXU86m/yjnpBD4aqESFgnoDcy1fGOP1Db/L3+4=";
78+
$this->assertEquals($expectedHmac, $hmacCalculation, "The recalculated HMAC does not match the expected value.");
79+
}
80+
6081
public function testHmacSignatureForRefundWithZeroValue()
6182
{
6283
$params = json_decode('{

0 commit comments

Comments
 (0)