Skip to content

Commit ff7a75d

Browse files
committed
Add test
1 parent 87606c3 commit ff7a75d

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,4 +513,52 @@ public void testScoreNotificationRequest() {
513513
assertEquals("ChargebackCardholderDispute", data.getScoreSignalsTriggered().get(0));
514514
assertEquals("ChargebackNonReceipt", data.getScoreSignalsTriggered().get(1));
515515
}
516+
517+
@Test
518+
public void testMandateCreatedNotificationRequest() {
519+
String json =
520+
getFileContents("mocks/balancePlatform-webhooks/configuration-mandate-created.json");
521+
522+
ConfigurationWebhooksHandler handler = new ConfigurationWebhooksHandler(json);
523+
Optional<MandateNotificationRequest> optionalRequest = handler.getMandateNotificationRequest();
524+
525+
assertTrue(optionalRequest.isPresent());
526+
527+
MandateNotificationRequest request = optionalRequest.get();
528+
assertEquals(
529+
MandateNotificationRequest.TypeEnum.BALANCEPLATFORM_MANDATE_CREATED, request.getType());
530+
assertEquals("test", request.getEnvironment());
531+
assertNotNull(request.getTimestamp());
532+
533+
assertNotNull(request.getData());
534+
assertEquals("YOUR_BALANCE_PLATFORM", request.getData().getBalancePlatform());
535+
536+
assertNotNull(request.getData().getMandate());
537+
assertEquals("MNDT000000000000000000000001", request.getData().getMandate().getId());
538+
assertEquals(
539+
"BA000000000000000000000001", request.getData().getMandate().getBalanceAccountId());
540+
assertEquals(
541+
"PI000000000000000000000001", request.getData().getMandate().getPaymentInstrumentId());
542+
assertEquals(Mandate.StatusEnum.APPROVED, request.getData().getMandate().getStatus());
543+
assertEquals(Mandate.TypeEnum.BACS, request.getData().getMandate().getType());
544+
545+
assertNotNull(request.getData().getMandate().getCounterparty());
546+
assertNotNull(request.getData().getMandate().getCounterparty().getAccountHolder());
547+
assertEquals(
548+
"Albert Klassens",
549+
request.getData().getMandate().getCounterparty().getAccountHolder().getFullName());
550+
551+
assertNotNull(request.getData().getMandate().getCounterparty().getAccountIdentification());
552+
UKLocalMandateAccountIdentification ukLocalAccountId =
553+
request
554+
.getData()
555+
.getMandate()
556+
.getCounterparty()
557+
.getAccountIdentification()
558+
.getUKLocalMandateAccountIdentification();
559+
assertNotNull(ukLocalAccountId);
560+
assertEquals("10809699", ukLocalAccountId.getAccountNumber());
561+
assertEquals("405081", ukLocalAccountId.getSortCode());
562+
assertEquals(UKLocalMandateAccountIdentification.TypeEnum.UKLOCAL, ukLocalAccountId.getType());
563+
}
516564
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"data": {
3+
"balancePlatform": "YOUR_BALANCE_PLATFORM",
4+
"mandate": {
5+
"balanceAccountId": "BA000000000000000000000001",
6+
"counterparty": {
7+
"accountHolder": {
8+
"fullName": "Albert Klassens"
9+
},
10+
"accountIdentification": {
11+
"accountNumber": "10809699",
12+
"sortCode": "405081",
13+
"type": "ukLocal"
14+
}
15+
},
16+
"createdAt": "2025-09-04T13:40:41.581Z",
17+
"id": "MNDT000000000000000000000001",
18+
"paymentInstrumentId": "PI000000000000000000000001",
19+
"status": "approved",
20+
"type": "bacs",
21+
"updatedAt": "2025-09-04T13:40:41.581Z"
22+
}
23+
},
24+
"environment": "test",
25+
"type": "balancePlatform.mandate.created",
26+
"timestamp": "2025-09-04T13:40:41+02:00"
27+
}

0 commit comments

Comments
 (0)