Skip to content

Commit

Permalink
Update HmacSignatureTest.php
Browse files Browse the repository at this point in the history
Included tests for deprecated and corrected  HMAC validation methods
  • Loading branch information
DjoykeAbyah authored Jul 30, 2024
1 parent d5b29f8 commit e198415
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 @@ -153,9 +153,30 @@ public function testIsHmacSupportedEventCode()
}

/**
* @deprecated
* @throws AdyenException
*/
public function testBankingWebhookHmacValidation()
{
$params = "{\"data\":{\"balancePlatform\":\"Integration_tools_test\","
. "\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\","
. "\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\""
. ",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":"
. "{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":"
. "\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}";
$hmac = new HmacSignature();
$result = $hmac->validateHMAC(
"9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA=",
"D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F",
$params
);
self::assertTrue($result);
}

/**
* @throws AdyenException
*/
public function testBankingWebhookHmacSignatureValidation()
{
$params = "{\"data\":{\"balancePlatform\":\"Integration_tools_test\","
. "\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\","
Expand Down

0 comments on commit e198415

Please sign in to comment.