Skip to content

Commit dfdb26c

Browse files
committed
Unit test for tracing data in transfer webhooks
1 parent 172f869 commit dfdb26c

2 files changed

Lines changed: 172 additions & 0 deletions

File tree

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.adyen.model.transferwebhooks.TransferEvent;
2727
import com.adyen.model.transferwebhooks.TransferNotificationRequest;
2828
import com.adyen.model.transferwebhooks.TransferWebhooksHandler;
29+
import com.adyen.model.transferwebhooks.UKFpsTracingData;
2930
import com.adyen.util.HMACValidator;
3031
import java.security.SignatureException;
3132
import java.time.OffsetDateTime;
@@ -468,6 +469,31 @@ public void testTransferNotificationRequest() {
468469
.getActualInstance());
469470
}
470471

472+
@Test
473+
public void testTransferNotificationRequestWithUkFpsTracingData() {
474+
String json =
475+
getFileContents("mocks/balancePlatform-webhooks/transfer-updated-with-uk-fps-tracing.json");
476+
477+
TransferNotificationRequest notificationRequest =
478+
new TransferWebhooksHandler(json).getTransferNotificationRequest().orElseThrow();
479+
TransferData transferData = notificationRequest.getData();
480+
481+
assertNotNull(transferData.getTracing());
482+
UKFpsTracingData transferTracingData = transferData.getTracing().getUKFpsTracingData();
483+
assertEquals("FPID-TEST-1234567890", transferTracingData.getFpid());
484+
assertEquals(UKFpsTracingData.TypeEnum.UKFPS, transferTracingData.getType());
485+
486+
TransferEvent tracingEvent =
487+
transferData.getEvents().stream()
488+
.filter(event -> event.getType() == TransferEvent.TypeEnum.TRACING)
489+
.findFirst()
490+
.orElseThrow();
491+
assertNotNull(tracingEvent.getTracingData());
492+
UKFpsTracingData eventTracingData = tracingEvent.getTracingData().getUKFpsTracingData();
493+
assertEquals("FPID-TEST-1234567890", eventTracingData.getFpid());
494+
assertEquals(UKFpsTracingData.TypeEnum.UKFPS, eventTracingData.getType());
495+
}
496+
471497
@Test
472498
public void testTransferCreatedNotificationRequest() {
473499
String json = getFileContents("mocks/balancePlatform-webhooks/transfer-created.json");
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
"data": {
3+
"id": "MOCK_TRANSFER_0001",
4+
"type": "bankTransfer",
5+
"creationDate": "2026-08-17T15:19:44+02:00",
6+
"createdAt": "2026-08-17T15:19:34+02:00",
7+
"amount": {
8+
"value": 7954,
9+
"currency": "GBP"
10+
},
11+
"events": [
12+
{
13+
"id": "MOCK_EVENT_RECEIVED",
14+
"status": "received",
15+
"bookingDate": "2026-08-17T15:19:34+02:00",
16+
"type": "accounting",
17+
"mutations": [
18+
{
19+
"currency": "GBP",
20+
"received": -7954
21+
}
22+
]
23+
},
24+
{
25+
"id": "MOCK_EVENT_AUTHORISED",
26+
"status": "authorised",
27+
"bookingDate": "2026-08-17T15:19:34+02:00",
28+
"type": "accounting",
29+
"mutations": [
30+
{
31+
"reserved": -7954,
32+
"currency": "GBP",
33+
"received": 7954
34+
}
35+
]
36+
},
37+
{
38+
"id": "MOCK_EVENT_BOOKED",
39+
"status": "booked",
40+
"transactionId": "MOCK_TRANSACTION_0001",
41+
"bookingDate": "2026-08-17T15:19:34+02:00",
42+
"valueDate": "2026-08-17T15:19:33+02:00",
43+
"type": "accounting",
44+
"mutations": [
45+
{
46+
"reserved": 7954,
47+
"balance": -7954,
48+
"currency": "GBP",
49+
"received": 0
50+
}
51+
]
52+
},
53+
{
54+
"id": "MOCK_EVENT_TRACKING",
55+
"type": "tracking",
56+
"updateDate": "2026-08-17T15:19:36+02:00",
57+
"estimatedArrivalTime": "2026-08-17T16:20:34+02:00",
58+
"trackingData": {
59+
"type": "estimation",
60+
"estimatedArrivalTime": "2026-08-17T16:20:34+02:00"
61+
}
62+
},
63+
{
64+
"id": "MOCK_EVENT_TRACING",
65+
"type": "tracing",
66+
"updateDate": "2026-08-17T15:19:44+02:00",
67+
"tracingData": {
68+
"fpid": "FPID-TEST-1234567890",
69+
"type": "ukFps"
70+
}
71+
}
72+
],
73+
"reason": "approved",
74+
"status": "booked",
75+
"tracing": {
76+
"fpid": "FPID-TEST-1234567890",
77+
"type": "ukFps"
78+
},
79+
"tracking": {
80+
"type": "estimation",
81+
"estimatedArrivalTime": "2026-08-17T16:20:34+02:00"
82+
},
83+
"direction": "outgoing",
84+
"balancePlatform": "MOCK_BALANCE_PLATFORM",
85+
"balanceAccountId": "MOCK_BALANCE_ACCOUNT",
86+
"paymentInstrumentId": "MOCK_PAYMENT_INSTRUMENT",
87+
"balanceAccount": {
88+
"id": "MOCK_BALANCE_ACCOUNT",
89+
"reference": "mock-balance-account",
90+
"description": "Mock balance account"
91+
},
92+
"accountHolder": {
93+
"id": "MOCK_ACCOUNT_HOLDER",
94+
"description": "Mock account holder"
95+
},
96+
"paymentInstrument": {
97+
"id": "MOCK_PAYMENT_INSTRUMENT"
98+
},
99+
"category": "bank",
100+
"categoryData": {
101+
"type": "bank",
102+
"priority": "fast"
103+
},
104+
"reference": "mock-transfer-reference",
105+
"referenceForBeneficiary": "mock-beneficiary-reference",
106+
"description": "Mock GBP bank transfer",
107+
"updatedAt": "2026-08-17T15:19:44+02:00",
108+
"sequenceNumber": 5,
109+
"balances": [
110+
{
111+
"reserved": 0,
112+
"balance": -7954,
113+
"currency": "GBP",
114+
"received": 0
115+
}
116+
],
117+
"transactionId": "MOCK_TRANSACTION_0001",
118+
"transactionRulesResult": {
119+
"allRulesPassed": true,
120+
"score": 0
121+
},
122+
"counterparty": {
123+
"bankAccount": {
124+
"accountIdentification": {
125+
"type": "ukLocal",
126+
"accountNumber": "00000000",
127+
"sortCode": "000000"
128+
},
129+
"accountHolder": {
130+
"type": "individual",
131+
"fullName": "Mock Recipient",
132+
"address": {
133+
"line1": "1 Mock Street",
134+
"city": "Test City",
135+
"postalCode": "TE1 1ST",
136+
"country": "GB"
137+
},
138+
"reference": "mock-recipient-reference"
139+
}
140+
}
141+
}
142+
},
143+
"type": "balancePlatform.transfer.updated",
144+
"timestamp": "2026-08-17T13:19:45.707Z",
145+
"environment": "test"
146+
}

0 commit comments

Comments
 (0)