File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff 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 ('{
You can’t perform that action at this time.
0 commit comments