Skip to content

Commit 773a01c

Browse files
authored
Rename Balance webhooks package (#1476)
* Rename package * Add tests
1 parent 2834461 commit 773a01c

9 files changed

+49
-15
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212

13-
package com.adyen.model.balanceplatformbalancewebhooks;
13+
package com.adyen.model.balancewebhooks;
1414

1515
import java.util.Objects;
1616
import java.util.Map;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
*/
1111

1212

13-
package com.adyen.model.balanceplatformbalancewebhooks;
13+
package com.adyen.model.balancewebhooks;
1414

1515
import java.util.Objects;
1616
import java.util.Map;
1717
import java.util.HashMap;
18-
import com.adyen.model.balanceplatformbalancewebhooks.BalanceNotificationData;
18+
import com.adyen.model.balancewebhooks.BalanceNotificationData;
1919
import com.fasterxml.jackson.annotation.JsonInclude;
2020
import com.fasterxml.jackson.annotation.JsonProperty;
2121
import com.fasterxml.jackson.annotation.JsonCreator;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
*/
1111

1212

13-
package com.adyen.model.balanceplatformbalancewebhooks;
13+
package com.adyen.model.balancewebhooks;
1414

1515
import java.util.Objects;
1616
import java.util.Map;
1717
import java.util.HashMap;
18-
import com.adyen.model.balanceplatformbalancewebhooks.Balances;
18+
import com.adyen.model.balancewebhooks.Balances;
1919
import com.fasterxml.jackson.annotation.JsonInclude;
2020
import com.fasterxml.jackson.annotation.JsonProperty;
2121
import com.fasterxml.jackson.annotation.JsonCreator;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212

13-
package com.adyen.model.balanceplatformbalancewebhooks;
13+
package com.adyen.model.balancewebhooks;
1414

1515
import java.util.Objects;
1616
import java.util.Map;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
* Do not edit the class manually.
1010
*/
1111

12-
package com.adyen.model.balanceplatformbalancewebhooks;
12+
package com.adyen.model.balancewebhooks;
1313

1414
import java.util.Optional;
1515
import java.util.logging.Logger;
1616

1717
/**
18-
* Handler for processing BalancePlatformBalanceWebhooks.
18+
* Handler for processing BalanceWebhooks.
1919
* <p>
20-
* This class provides functionality to deserialize the payload of BalancePlatformBalanceWebhooks events.
20+
* This class provides functionality to deserialize the payload of BalanceWebhooks events.
2121
*/
22-
public class BalancePlatformBalanceWebhooksHandler {
22+
public class BalanceWebhooksHandler {
2323

24-
private static final Logger LOG = Logger.getLogger(BalancePlatformBalanceWebhooksHandler.class.getName());
24+
private static final Logger LOG = Logger.getLogger(BalanceWebhooksHandler.class.getName());
2525

2626
private final String payload;
2727

@@ -30,7 +30,7 @@ public class BalancePlatformBalanceWebhooksHandler {
3030
*
3131
* @param payload the raw JSON payload from the webhook
3232
*/
33-
public BalancePlatformBalanceWebhooksHandler(String payload) {
33+
public BalanceWebhooksHandler(String payload) {
3434
this.payload = payload;
3535
}
3636

src/main/java/com/adyen/model/balanceplatformbalancewebhooks/Balances.java renamed to src/main/java/com/adyen/model/balancewebhooks/Balances.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212

13-
package com.adyen.model.balanceplatformbalancewebhooks;
13+
package com.adyen.model.balancewebhooks;
1414

1515
import java.util.Objects;
1616
import java.util.Map;

src/main/java/com/adyen/model/balanceplatformbalancewebhooks/JSON.java renamed to src/main/java/com/adyen/model/balancewebhooks/JSON.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.adyen.model.balanceplatformbalancewebhooks;
1+
package com.adyen.model.balancewebhooks;
22

33
import com.adyen.serializer.ByteArraySerializer;
44
import com.adyen.serializer.ByteArrayDeserializer;
@@ -7,7 +7,7 @@
77
import com.fasterxml.jackson.databind.json.JsonMapper;
88
import com.fasterxml.jackson.databind.module.SimpleModule;
99
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
10-
import com.adyen.model.balanceplatformbalancewebhooks.*;
10+
import com.adyen.model.balancewebhooks.*;
1111

1212
import java.text.DateFormat;
1313
import java.util.HashMap;

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.adyen.model.acswebhooks.AcsWebhooksHandler;
44
import com.adyen.model.acswebhooks.AuthenticationNotificationRequest;
55
import com.adyen.model.acswebhooks.RelayedAuthenticationRequest;
6+
import com.adyen.model.balancewebhooks.BalanceAccountBalanceNotificationRequest;
7+
import com.adyen.model.balancewebhooks.BalanceWebhooksHandler;
68
import com.adyen.model.configurationwebhooks.*;
79
import com.adyen.model.negativebalancewarningwebhooks.NegativeBalanceCompensationWarningNotificationRequest;
810
import com.adyen.model.negativebalancewarningwebhooks.NegativeBalanceWarningWebhooksHandler;
@@ -201,4 +203,19 @@ public void testRelayedAuthenticationRequest() throws Exception {
201203

202204
}
203205

206+
@Test
207+
public void tesBalanceAccountBalanceNotificationRequest() throws Exception {
208+
String json = getFileContents("mocks/balancePlatform-webhooks/balanceplatform-balanceAccount-balance-updated.json");
209+
210+
Optional<BalanceAccountBalanceNotificationRequest> balanceAccountBalanceNotificationRequestOptional = new BalanceWebhooksHandler(json).getBalanceAccountBalanceNotificationRequest();
211+
assertTrue(balanceAccountBalanceNotificationRequestOptional.isPresent());
212+
213+
BalanceAccountBalanceNotificationRequest balanceAccountBalanceNotificationRequest = balanceAccountBalanceNotificationRequestOptional.get();
214+
assertNotNull(balanceAccountBalanceNotificationRequest.getData());
215+
216+
assertEquals("BWHS00000000000000000000000001", balanceAccountBalanceNotificationRequest.getData().getBalanceAccountId());
217+
assertNotNull(balanceAccountBalanceNotificationRequest.getData().getBalances());
218+
assertFalse(balanceAccountBalanceNotificationRequest.getData().getSettingIds().isEmpty());
219+
220+
}
204221
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"data": {
3+
"balanceAccountId": "BWHS00000000000000000000000001",
4+
"balancePlatform": "YOUR_BALANCE_PLATFORM",
5+
"balances": {
6+
"available": 499900,
7+
"pending": 350000,
8+
"reserved": 120000,
9+
"balance": 470000
10+
},
11+
"creationDate": "2025-01-19T13:37:38+02:00",
12+
"currency": "USD",
13+
"settingIds": ["WK1", "WK2"]
14+
},
15+
"environment": "test",
16+
"type": "balancePlatform.balanceAccount.balance.updated"
17+
}

0 commit comments

Comments
 (0)