Skip to content

Commit

Permalink
added test for merchantReference with space (#701)
Browse files Browse the repository at this point in the history
* added test for merchantReference with space

* removed extra space after test

* removed extra whitespace

* removed extra whitespace
  • Loading branch information
DjoykeAbyah authored Oct 8, 2024
1 parent 5bc9d69 commit 9efd554
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/Unit/Util/HmacSignatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ public function testNotificationRequestItemHmac()
$this->fail('Unexpected exception');
}
}

public function testMerchantReferenceWithSpace()
{
$params = json_decode('{
"pspReference": "7914073381342284",
"merchantAccountCode": "TestMerchant",
"merchantReference": " TestPayment-1407325143704",
"amount": {
"value": 1130,
"currency": "EUR"
},
"eventCode": "AUTHORISATION",
"success": "true"
}', true);
$hmacKey = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00";
$hmac = new HmacSignature();
$hmacCalculation = $hmac->calculateNotificationHMAC($hmacKey, $params);
$expectedHmac = "kLZtgnXU86m/yjnpBD4aqESFgnoDcy1fGOP1Db/L3+4=";
$this->assertEquals($expectedHmac, $hmacCalculation, "The recalculated HMAC does not match the expected value.");
}

public function testHmacSignatureForRefundWithZeroValue()
{
$params = json_decode('{
Expand Down

0 comments on commit 9efd554

Please sign in to comment.