Skip to content

Commit 0fb8322

Browse files
committed
Add getReleasedBlockedBalanceNotificationRequest
1 parent 566178d commit 0fb8322

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

src/Adyen/Service/BankingWebhookParser.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Adyen\Model\AcsWebhooks\AuthenticationNotificationRequest;
66
use Adyen\Model\AcsWebhooks\RelayedAuthenticationRequest;
77
use Adyen\Model\BalanceWebhooks\BalanceAccountBalanceNotificationRequest;
8+
use Adyen\Model\BalanceWebhooks\ReleasedBlockedBalanceNotificationRequest;
89
use Adyen\Model\ConfigurationWebhooks\AccountHolderNotificationRequest;
910
use Adyen\Model\ConfigurationWebhooks\BalanceAccountNotificationRequest;
1011
use Adyen\Model\ConfigurationWebhooks\NetworkTokenNotificationRequest;
@@ -15,6 +16,7 @@
1516
use Adyen\Model\ReportWebhooks\ReportNotificationRequest;
1617
use Adyen\Model\TransactionWebhooks\TransactionNotificationRequestV4;
1718
use Adyen\Model\TransferWebhooks\TransferNotificationRequest;
19+
use Adyen\Service\WebhookParseException;
1820
use JsonException;
1921

2022
class BankingWebhookParser
@@ -25,6 +27,7 @@ class BankingWebhookParser
2527
AuthenticationNotificationRequest::class,
2628
RelayedAuthenticationRequest::class,
2729
BalanceAccountBalanceNotificationRequest::class,
30+
ReleasedBlockedBalanceNotificationRequest::class,
2831
AccountHolderNotificationRequest::class,
2932
BalanceAccountNotificationRequest::class,
3033
PaymentNotificationRequest::class,
@@ -89,6 +92,11 @@ public function getBalanceAccountBalanceNotificationRequest(): BalanceAccountBal
8992
return $this->getWebhookByClass(BalanceAccountBalanceNotificationRequest::class);
9093
}
9194

95+
public function getReleasedBlockedBalanceNotificationRequest(): ReleasedBlockedBalanceNotificationRequest
96+
{
97+
return $this->getWebhookByClass(ReleasedBlockedBalanceNotificationRequest::class);
98+
}
99+
92100
public function getAccountHolderNotificationRequest(): AccountHolderNotificationRequest
93101
{
94102
return $this->getWebhookByClass(AccountHolderNotificationRequest::class);

tests/Unit/NotificationTest.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use Adyen\Model\TokenizationWebhooks\TokenizationUpdatedDetailsNotificationRequest;
3434
use Adyen\Model\TransactionWebhooks\TransactionNotificationRequestV4;
3535
use Adyen\Model\BalanceWebhooks\BalanceAccountBalanceNotificationRequest;
36+
use Adyen\Model\BalanceWebhooks\ReleasedBlockedBalanceNotificationRequest;
3637
use Adyen\Service\BankingWebhookParser;
3738
use Adyen\Service\ManagementWebhookParser;
3839
use Adyen\Service\TokenizationWebhookParser;
@@ -513,4 +514,49 @@ public function testTokenizationWebhookRecurringTokenAlreadyExisting()
513514
self::assertEquals("recurring.token.alreadyExisting", $result->getType());
514515
self::assertEquals("test", $result->getEnvironment());
515516
}
517+
518+
public function testBankingWebhookParserReleasedBlockedBalanceNotificationRequest()
519+
{
520+
$jsonString = '{
521+
"data": {
522+
"accountHolder": {
523+
"description": "Account holder for retail operations",
524+
"id": "AH00000000000000000001",
525+
"reference": "Store_001"
526+
},
527+
"amount": {
528+
"currency": "EUR",
529+
"value": 25000
530+
},
531+
"balanceAccount": {
532+
"description": "Main operating account",
533+
"id": "BA00000000000000000001",
534+
"reference": "OP_ACCT_MAIN"
535+
},
536+
"balancePlatform": "YOUR_BALANCE_PLATFORM",
537+
"batchReference": "BATCH_REF_20250925",
538+
"blockedBalanceAfter": {
539+
"currency": "EUR",
540+
"value": -75000
541+
},
542+
"blockedBalanceBefore": {
543+
"currency": "EUR",
544+
"value": -100000
545+
},
546+
"creationDate": "2025-09-25T14:30:00Z",
547+
"valueDate": "2025-09-25T14:35:00Z"
548+
},
549+
"environment": "test",
550+
"timestamp": "2025-09-25T14:35:00Z",
551+
"type": "balancePlatform.balanceAccount.balance.block.released"
552+
}';
553+
554+
$webhookParser = new BankingWebhookParser($jsonString);
555+
$result = $webhookParser->getReleasedBlockedBalanceNotificationRequest();
556+
self::assertEquals(ReleasedBlockedBalanceNotificationRequest::class, get_class($result));
557+
self::assertEquals("balancePlatform.balanceAccount.balance.block.released", $result->getType());
558+
self::assertEquals("test", $result->getEnvironment());
559+
self::assertEquals("AH00000000000000000001", $result->getData()->getAccountHolder()->getId());
560+
self::assertEquals(25000, $result->getData()->getAmount()->getValue());
561+
}
516562
}

0 commit comments

Comments
 (0)