diff --git a/sdk-generation-log/transactionwebhooks.json b/sdk-generation-log/transactionwebhooks.json index 016e4a238..6b708fbc1 100644 --- a/sdk-generation-log/transactionwebhooks.json +++ b/sdk-generation-log/transactionwebhooks.json @@ -1,8 +1,8 @@ { "service": "transactionwebhooks", "project": "java", - "generatedAt": "2026-05-14T14:23:20Z", - "openapiCommitSha": "cbc5406a2df1f24d50e40742f18342f7ca7f21fc", - "automationCommitSha": "6f06b47d0661f0891defe6b85461d2c367fbd284", - "libraryCommitSha": "5790580db2f8a931a68baba2bff9760b8aed2067" + "generatedAt": "2026-07-16T07:19:06Z", + "openapiCommitSha": "8ca5e35a2df8646fbed1793daeba735ebfcb821b", + "automationCommitSha": "a7fa5d57782b5065affe714e9d9caaf5009a1e24", + "libraryCommitSha": "503dcc66e435ded29884875f6a5bda4590cecb95" } diff --git a/src/main/java/com/adyen/model/transactionwebhooks/TransferViewCategoryData.java b/src/main/java/com/adyen/model/transactionwebhooks/TransferViewCategoryData.java index 5773a5ecb..bdadc17da 100644 --- a/src/main/java/com/adyen/model/transactionwebhooks/TransferViewCategoryData.java +++ b/src/main/java/com/adyen/model/transactionwebhooks/TransferViewCategoryData.java @@ -230,6 +230,18 @@ public TransferViewCategoryData(PlatformPayment o) { schemas.put("IssuedCard", new GenericType() {}); schemas.put("PlatformPayment", new GenericType() {}); JSON.registerDescendants(TransferViewCategoryData.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap<>(); + mappings.put("bank", BankCategoryData.class); + mappings.put("internal", InternalCategoryData.class); + mappings.put("issuedCard", IssuedCard.class); + mappings.put("platformPayment", PlatformPayment.class); + mappings.put("BankCategoryData", BankCategoryData.class); + mappings.put("InternalCategoryData", InternalCategoryData.class); + mappings.put("IssuedCard", IssuedCard.class); + mappings.put("PlatformPayment", PlatformPayment.class); + mappings.put("TransferView_categoryData", TransferViewCategoryData.class); + JSON.registerDiscriminator(TransferViewCategoryData.class, "type", mappings); } @Override diff --git a/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java b/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java index 294bedd74..044700a0a 100644 --- a/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java +++ b/src/test/java/com/adyen/webhooks/BalancePlatformWebhooksTest.java @@ -16,6 +16,7 @@ import com.adyen.model.negativebalancewarningwebhooks.NegativeBalanceWarningWebhooksHandler; import com.adyen.model.reportwebhooks.ReportNotificationRequest; import com.adyen.model.reportwebhooks.ReportWebhooksHandler; +import com.adyen.model.transactionwebhooks.BankCategoryData; import com.adyen.model.transactionwebhooks.TransactionNotificationRequestV4; import com.adyen.model.transactionwebhooks.TransactionWebhooksHandler; import com.adyen.model.transferwebhooks.InterchangeData; @@ -256,6 +257,24 @@ public void testTransactionWebhookParsing() { Assertions.assertEquals("EVJN42272224222B5JB8BRC84N686ZEUR", request.getData().getId()); } + @Test + public void testTransactionWebhookBankCategoryDataParsing() { + String json = + getFileContents( + "mocks/notification/balancePlatform-transaction-created-bank-category.json"); + TransactionWebhooksHandler webhookHandler = new TransactionWebhooksHandler(json); + Assertions.assertTrue(webhookHandler.getTransactionNotificationRequestV4().isPresent()); + TransactionNotificationRequestV4 request = + webhookHandler.getTransactionNotificationRequestV4().get(); + Assertions.assertEquals("EVJN00000000000000000000000003EUR", request.getData().getId()); + + BankCategoryData bankCategoryData = + request.getData().getTransfer().getCategoryData().getBankCategoryData(); + Assertions.assertNotNull(bankCategoryData); + Assertions.assertEquals(BankCategoryData.TypeEnum.BANK, bankCategoryData.getType()); + Assertions.assertEquals(BankCategoryData.PriorityEnum.REGULAR, bankCategoryData.getPriority()); + } + @Test public void testNegativeBalanceCompensationWarning() { String json = diff --git a/src/test/resources/mocks/notification/balancePlatform-transaction-created-bank-category.json b/src/test/resources/mocks/notification/balancePlatform-transaction-created-bank-category.json new file mode 100644 index 000000000..9879f32fd --- /dev/null +++ b/src/test/resources/mocks/notification/balancePlatform-transaction-created-bank-category.json @@ -0,0 +1,40 @@ +{ + "data": { + "id": "EVJN00000000000000000000000003EUR", + "amount": { + "value": -10000, + "currency": "EUR" + }, + "status": "booked", + "transfer": { + "categoryData": { + "priority": "regular", + "type": "bank" + }, + "id": "3JNC3O5ZVFLLGV4B", + "reference": " Your internal reference for the transfer" + }, + "valueDate": "2023-08-11T16:19:35+02:00", + "bookingDate": "2023-08-11T16:31:02+02:00", + "creationDate": "2023-08-11T16:19:35+02:00", + "description": "Your description of the transfer", + "referenceForBeneficiary": "Your reference sent to the beneficiary of the transfer", + "accountHolder": { + "id": "AH00000000000000000000001", + "reference": "Your reference for the account holder", + "description": "Your description of the account holder" + }, + "balanceAccount": { + "id": "BA00000000000000000000001", + "description": "Your description of the balance account from where the amount is debited." + }, + "paymentInstrument": { + "id": "PI00000000000000000000001", + "description": "Your description of the payment instrument" + }, + "balancePlatform": "YOUR_BALANCE_PLATFORM" + }, + "environment": "test", + "timestamp": "2023-08-11T16:16:35+02:00", + "type": "balancePlatform.transaction.created" +}