diff --git a/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java b/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java index 515ba637e..9d130568d 100644 --- a/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java +++ b/src/main/java/com/adyen/model/checkout/CheckoutPaymentMethod.java @@ -80,7 +80,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(AchDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(AchDetails.class); @@ -103,7 +103,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(AffirmDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(AffirmDetails.class); @@ -126,7 +126,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(AfterpayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(AfterpayDetails.class); @@ -149,7 +149,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(AmazonPayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(AmazonPayDetails.class); @@ -172,7 +172,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(AncvDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(AncvDetails.class); @@ -195,7 +195,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(AndroidPayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(AndroidPayDetails.class); @@ -218,7 +218,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(ApplePayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(ApplePayDetails.class); @@ -241,7 +241,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(BacsDirectDebitDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(BacsDirectDebitDetails.class); @@ -264,7 +264,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(BillDeskDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(BillDeskDetails.class); @@ -287,7 +287,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(BlikDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(BlikDetails.class); @@ -310,7 +310,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(CardDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(CardDetails.class); @@ -333,7 +333,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(CashAppDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(CashAppDetails.class); @@ -356,7 +356,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(CellulantDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(CellulantDetails.class); @@ -379,7 +379,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(DokuDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(DokuDetails.class); @@ -402,7 +402,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(DragonpayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(DragonpayDetails.class); @@ -425,7 +425,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(EBankingFinlandDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(EBankingFinlandDetails.class); @@ -448,7 +448,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(EcontextVoucherDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(EcontextVoucherDetails.class); @@ -471,7 +471,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(EftDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(EftDetails.class); @@ -494,7 +494,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(FastlaneDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(FastlaneDetails.class); @@ -517,7 +517,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(GenericIssuerPaymentMethodDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = @@ -542,7 +542,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(GooglePayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(GooglePayDetails.class); @@ -565,7 +565,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(IdealDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(IdealDetails.class); @@ -588,7 +588,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(KlarnaDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(KlarnaDetails.class); @@ -611,7 +611,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(MasterpassDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(MasterpassDetails.class); @@ -634,7 +634,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(MbwayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(MbwayDetails.class); @@ -657,7 +657,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(MobilePayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(MobilePayDetails.class); @@ -680,7 +680,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(MolPayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(MolPayDetails.class); @@ -703,7 +703,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(OpenInvoiceDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(OpenInvoiceDetails.class); @@ -726,7 +726,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PayByBankAISDirectDebitDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = @@ -751,7 +751,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PayByBankDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PayByBankDetails.class); @@ -774,7 +774,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PayPalDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PayPalDetails.class); @@ -797,7 +797,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PayPayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PayPayDetails.class); @@ -820,7 +820,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PayToDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PayToDetails.class); @@ -843,7 +843,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PayUUpiDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PayUUpiDetails.class); @@ -866,7 +866,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PayWithGoogleDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PayWithGoogleDetails.class); @@ -889,7 +889,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PaymentDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PaymentDetails.class); @@ -912,7 +912,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PixDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PixDetails.class); @@ -935,7 +935,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(PseDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(PseDetails.class); @@ -958,7 +958,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(RakutenPayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(RakutenPayDetails.class); @@ -981,7 +981,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(RatepayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(RatepayDetails.class); @@ -1004,7 +1004,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(RivertyDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(RivertyDetails.class); @@ -1027,7 +1027,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(SamsungPayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(SamsungPayDetails.class); @@ -1050,7 +1050,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(SepaDirectDebitDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(SepaDirectDebitDetails.class); @@ -1073,7 +1073,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(StoredPaymentMethodDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = @@ -1097,7 +1097,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(TwintDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(TwintDetails.class); @@ -1120,7 +1120,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(UpiCollectDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(UpiCollectDetails.class); @@ -1143,7 +1143,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(UpiIntentDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(UpiIntentDetails.class); @@ -1166,7 +1166,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(VippsDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(VippsDetails.class); @@ -1189,7 +1189,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(VisaCheckoutDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(VisaCheckoutDetails.class); @@ -1212,7 +1212,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(WeChatPayDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(WeChatPayDetails.class); @@ -1235,7 +1235,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(WeChatPayMiniProgramDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = @@ -1259,7 +1259,7 @@ public CheckoutPaymentMethod deserialize(JsonParser jp, DeserializationContext c // Checks if the unique type of the oneOf json matches any of the object TypeEnum values boolean typeMatch = Arrays.stream(ZipDetails.TypeEnum.values()) - .anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText())); + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); if (typeMatch) { deserialized = tree.traverse(jp.getCodec()).readValueAs(ZipDetails.class); diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index 38beea516..a02dc9b1c 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -666,6 +666,46 @@ public void TestSessionsCheckDefaultValues() throws Exception { assertEquals(expected, actual); } + @Test + public void TestBccm() throws Exception { + Client client = createMockClientFromFile("mocks/checkout/paymentResponseBcmc.json"); + PaymentRequest paymentRequest = new PaymentRequest(); + paymentRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); + paymentRequest.setReference("YOUR_ORDER_NUMBER"); + paymentRequest.setAmount(new Amount().currency("EUR").value(1000L)); + paymentRequest.setPaymentMethod( + new CheckoutPaymentMethod( + new CardDetails() + .type(CardDetails.TypeEnum.BCMC) + .holderName("Ms Smith") + .encryptedCardNumber("...") + .encryptedExpiryMonth("...") + .encryptedExpiryYear("...") + .brand("bcmc") + .checkoutAttemptId("..."))); + PaymentsApi checkout = new PaymentsApi(client); + PaymentResponse paymentResponse = checkout.payments(paymentRequest); + assertEquals(PaymentResponse.ResultCodeEnum.REDIRECTSHOPPER, paymentResponse.getResultCode()); + assertNotNull(paymentResponse.getAction()); + } + + @Test + public void TestBccmMobile() throws Exception { + Client client = createMockClientFromFile("mocks/checkout/paymentResponseBcmcMobile.json"); + PaymentRequest paymentRequest = new PaymentRequest(); + paymentRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); + paymentRequest.setReference("YOUR_ORDER_NUMBER"); + paymentRequest.setAmount(new Amount().currency("EUR").value(1000L)); + paymentRequest.setPaymentMethod( + new CheckoutPaymentMethod( + new StoredPaymentMethodDetails() + .type(StoredPaymentMethodDetails.TypeEnum.BCMC_MOBILE))); + PaymentsApi checkout = new PaymentsApi(client); + PaymentResponse paymentResponse = checkout.payments(paymentRequest); + assertEquals(PaymentResponse.ResultCodeEnum.PENDING, paymentResponse.getResultCode()); + assertNotNull(paymentResponse.getAction()); + } + @Test public void testPixActionQrCode() throws Exception { Client client = createMockClientFromFile("mocks/checkout/pixQrCodeResponse.json"); diff --git a/src/test/java/com/adyen/serializer/ModelTest.java b/src/test/java/com/adyen/serializer/ModelTest.java index 4214082bb..d6b342fda 100644 --- a/src/test/java/com/adyen/serializer/ModelTest.java +++ b/src/test/java/com/adyen/serializer/ModelTest.java @@ -5,7 +5,10 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import com.adyen.model.checkout.CardDetails; +import com.adyen.model.checkout.CheckoutPaymentMethod; import com.adyen.model.checkout.CreateCheckoutSessionResponse; +import com.adyen.model.checkout.StoredPaymentMethodDetails; import com.adyen.model.legalentitymanagement.*; import com.fasterxml.jackson.core.JsonProcessingException; import java.time.Month; @@ -147,4 +150,49 @@ public void testFromJsonCreateCheckoutSessionResponse() throws JsonProcessingExc assertEquals(Month.JANUARY, response.getExpiresAt().getMonth()); assertEquals(ZoneId.of("+01:00"), response.getExpiresAt().toZonedDateTime().getZone()); } + + @Test + public void testFromJsonCheckoutPaymentMethodBcmc() throws Exception { + String json = + "{\n" + + " \"type\": \"bcmc\",\n" + + " \"holderName\": \"Ms Smith\",\n" + + " \"encryptedCardNumber\": \"...\",\n" + + " \"encryptedExpiryMonth\": \"...\",\n" + + " \"encryptedExpiryYear\": \"...\",\n" + + " \"brand\": \"bcmc\",\n" + + " \"checkoutAttemptId\": \"...\"\n" + + "}"; + + CheckoutPaymentMethod paymentMethod = CheckoutPaymentMethod.fromJson(json); + + assertNotNull(paymentMethod); + + CardDetails cardDetails = paymentMethod.getCardDetails(); + assertNotNull(cardDetails); + + assertEquals(CardDetails.TypeEnum.BCMC, cardDetails.getType()); + assertEquals("bcmc", cardDetails.getBrand()); + assertEquals("Ms Smith", cardDetails.getHolderName()); + } + + @Test + public void testFromJsonCheckoutPaymentMethodBcmcMobile() throws Exception { + String json = + "{\n" + + " \"type\":\"bcmc_mobile\",\n" + + " \"storedPaymentMethodId\":\"7219687191761347\"\n" + + "}"; + + CheckoutPaymentMethod paymentMethod = CheckoutPaymentMethod.fromJson(json); + assertNotNull(paymentMethod); + + StoredPaymentMethodDetails storedPaymentMethodDetails = + paymentMethod.getStoredPaymentMethodDetails(); + assertNotNull(storedPaymentMethodDetails); + + assertEquals( + StoredPaymentMethodDetails.TypeEnum.BCMC_MOBILE, storedPaymentMethodDetails.getType()); + assertEquals("7219687191761347", storedPaymentMethodDetails.getStoredPaymentMethodId()); + } } diff --git a/src/test/resources/mocks/checkout/paymentResponseBcmc.json b/src/test/resources/mocks/checkout/paymentResponseBcmc.json new file mode 100644 index 000000000..3b14a2cd2 --- /dev/null +++ b/src/test/resources/mocks/checkout/paymentResponseBcmc.json @@ -0,0 +1,14 @@ +{ + "resultCode": "RedirectShopper", + "action": { + "paymentMethodType": "bccm", + "url": "https://your-company.example.com/checkout?shopperOrder=12xy..", + "data": { + "MD": "OEVudmZVMUlkWjd0MDNwUWs2bmhSdz09...", + "PaReq": "eNpVUttygjAQ/RXbDyAXBYRZ00HpTH3wUosPfe...", + "TermUrl": "https://example.com/checkout?shopperOrder=12xy..." + }, + "method": "POST", + "type": "redirect" + } +} \ No newline at end of file diff --git a/src/test/resources/mocks/checkout/paymentResponseBcmcMobile.json b/src/test/resources/mocks/checkout/paymentResponseBcmcMobile.json new file mode 100644 index 000000000..cb92d1364 --- /dev/null +++ b/src/test/resources/mocks/checkout/paymentResponseBcmcMobile.json @@ -0,0 +1,10 @@ +{ + "resultCode": "Pending", + "action": { + "paymentData": "Ab02b4c0!BQABAgCpM2q6...==", + "paymentMethodType": "bcmc_mobile", + "url": "BEPGenApp://DoTx?TransId=1bcmc-test.adyen.com/pal/bep$P5FOT6N55HYZNXVPFDGIHEJC", + "qrCodeData": "BEP://1bcmc-test.adyen.com/pal/test", + "type": "qrCode" + } +} \ No newline at end of file