From ea8a5c0af2e54cd6f9a16dcdbcab8f2e755a6608 Mon Sep 17 00:00:00 2001 From: david ruiz Date: Mon, 27 Apr 2026 10:20:26 +0200 Subject: [PATCH 1/4] Added blik paymentMethodType per request --- src/main/java/com/checkout/common/PaymentMethodType.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/checkout/common/PaymentMethodType.java b/src/main/java/com/checkout/common/PaymentMethodType.java index 0d992191..7bf04d8e 100644 --- a/src/main/java/com/checkout/common/PaymentMethodType.java +++ b/src/main/java/com/checkout/common/PaymentMethodType.java @@ -134,7 +134,9 @@ public enum PaymentMethodType { VISA, @SerializedName("wechatpay") WECHATPAY, - + @SerializedName("blik") + BLIK, + // Payment method categories @SerializedName("card_scheme") CARD_SCHEME, From 47012c833971f1c684d5f015213694266bb79f3d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 27 Apr 2026 09:06:18 +0000 Subject: [PATCH 2/4] Fix BLIK enum ordering and add serialization test Agent-Logs-Url: https://github.com/checkout/checkout-sdk-java/sessions/b35e3eb7-e7bd-4eb4-8f6e-07a4749a64ec Co-authored-by: david-ruiz-cko <243553394+david-ruiz-cko@users.noreply.github.com> --- .../checkout/common/PaymentMethodType.java | 4 ++-- .../common/PaymentMethodTypeTest.java | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/test/java/com/checkout/common/PaymentMethodTypeTest.java diff --git a/src/main/java/com/checkout/common/PaymentMethodType.java b/src/main/java/com/checkout/common/PaymentMethodType.java index 7bf04d8e..13604cc8 100644 --- a/src/main/java/com/checkout/common/PaymentMethodType.java +++ b/src/main/java/com/checkout/common/PaymentMethodType.java @@ -30,6 +30,8 @@ public enum PaymentMethodType { BENEFIT, @SerializedName("bizum") BIZUM, + @SerializedName("blik") + BLIK, @SerializedName("boost") BOOST, @SerializedName("bpi") @@ -134,8 +136,6 @@ public enum PaymentMethodType { VISA, @SerializedName("wechatpay") WECHATPAY, - @SerializedName("blik") - BLIK, // Payment method categories @SerializedName("card_scheme") diff --git a/src/test/java/com/checkout/common/PaymentMethodTypeTest.java b/src/test/java/com/checkout/common/PaymentMethodTypeTest.java new file mode 100644 index 00000000..5bb6624f --- /dev/null +++ b/src/test/java/com/checkout/common/PaymentMethodTypeTest.java @@ -0,0 +1,23 @@ +package com.checkout.common; + +import com.checkout.GsonSerializer; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class PaymentMethodTypeTest { + + private final GsonSerializer serializer = new GsonSerializer(); + + @Test + void blik_shouldSerializeToExpectedJsonValue() { + final String json = serializer.toJson(PaymentMethodType.BLIK); + assertEquals("\"blik\"", json); + } + + @Test + void blik_shouldDeserializeFromExpectedJsonValue() { + final PaymentMethodType type = serializer.fromJson("\"blik\"", PaymentMethodType.class); + assertEquals(PaymentMethodType.BLIK, type); + } +} From 3bc543edaec1280a14553ac632fecdca3ceb6323 Mon Sep 17 00:00:00 2001 From: david ruiz Date: Mon, 27 Apr 2026 11:25:18 +0200 Subject: [PATCH 3/4] Blik tests --- .../java/com/checkout/GsonSerializerTest.java | 16 +++++ .../common/PaymentMethodTypeTest.java | 23 -------- .../flow/FlowTestIT.java | 55 ++++++++++++++++++ .../flow/PaymentSessionSerializationTest.java | 58 +++++++++++++++++++ 4 files changed, 129 insertions(+), 23 deletions(-) delete mode 100644 src/test/java/com/checkout/common/PaymentMethodTypeTest.java diff --git a/src/test/java/com/checkout/GsonSerializerTest.java b/src/test/java/com/checkout/GsonSerializerTest.java index b0400b95..940a2c67 100644 --- a/src/test/java/com/checkout/GsonSerializerTest.java +++ b/src/test/java/com/checkout/GsonSerializerTest.java @@ -1,5 +1,6 @@ package com.checkout; +import com.checkout.common.PaymentMethodType; import com.checkout.common.PaymentSourceType; import com.checkout.financial.FinancialActionsQueryResponse; import com.checkout.issuing.cardholders.CardholderCardsResponse; @@ -202,6 +203,21 @@ void shouldDeserializeProductWithUnknownEnumValue() { assertNull(productResponse.getTypeAsEnum()); } + @Test + void shouldSerializePaymentMethodTypeBlikCorrectly() { + // Test that BLIK payment method type serializes to "blik" + String json = serializer.toJson(PaymentMethodType.BLIK); + assertEquals("\"blik\"", json); + } + + @Test + void shouldDeserializePaymentMethodTypeBlikCorrectly() { + // Test that "blik" string deserializes to PaymentMethodType.BLIK + String json = "\"blik\""; + PaymentMethodType paymentMethodType = serializer.fromJson(json, PaymentMethodType.class); + assertEquals(PaymentMethodType.BLIK, paymentMethodType); + } + @Test void shouldDeserializeProductWithNullType() { String json = "{ \"Type\": null, \"name\": \"Product Name\" }"; diff --git a/src/test/java/com/checkout/common/PaymentMethodTypeTest.java b/src/test/java/com/checkout/common/PaymentMethodTypeTest.java deleted file mode 100644 index 5bb6624f..00000000 --- a/src/test/java/com/checkout/common/PaymentMethodTypeTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.checkout.common; - -import com.checkout.GsonSerializer; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -class PaymentMethodTypeTest { - - private final GsonSerializer serializer = new GsonSerializer(); - - @Test - void blik_shouldSerializeToExpectedJsonValue() { - final String json = serializer.toJson(PaymentMethodType.BLIK); - assertEquals("\"blik\"", json); - } - - @Test - void blik_shouldDeserializeFromExpectedJsonValue() { - final PaymentMethodType type = serializer.fromJson("\"blik\"", PaymentMethodType.class); - assertEquals(PaymentMethodType.BLIK, type); - } -} diff --git a/src/test/java/com/checkout/handlepaymentsandpayouts/flow/FlowTestIT.java b/src/test/java/com/checkout/handlepaymentsandpayouts/flow/FlowTestIT.java index eb7d299a..fa6271a0 100644 --- a/src/test/java/com/checkout/handlepaymentsandpayouts/flow/FlowTestIT.java +++ b/src/test/java/com/checkout/handlepaymentsandpayouts/flow/FlowTestIT.java @@ -174,6 +174,61 @@ private PaymentSessionCreateRequest createPaymentSessionCreateRequest() { .build(); } + private PaymentSessionCreateRequest createPaymentSessionCreateRequestWithBlik() { + return PaymentSessionCreateRequest.builder() + .amount(2000L) + .currency(Currency.PLN) + .reference("ORD-BLIK-789") + .description("BLIK payment for mobile transaction") + .displayName("Company BLIK Test") + .processingChannelId(System.getenv("CHECKOUT_PROCESSING_CHANNEL_ID")) + .successUrl("https://example.com/payments/success") + .failureUrl("https://example.com/payments/failure") + .billing(createBillingInformation()) + .billingDescriptor(createBillingDescriptor()) + .risk(createRiskRequest()) + .threeDS(createThreeDSRequest()) + .capture(true) + .locale(LocaleType.EN_GB) + .enabledPaymentMethods(Collections.singletonList(PaymentMethodType.BLIK)) + .paymentMethodConfiguration(createPaymentMethodConfiguration()) + .build(); + } + + @Test + void shouldCreatePaymentSessionWithBlikInDisabledMethods() { + // Test BLIK in disabled payment methods list + final PaymentSessionCreateRequest request = PaymentSessionCreateRequest.builder() + .amount(1000L) + .currency(Currency.EUR) + .paymentType(PaymentType.REGULAR) + .reference("ORD-NO-BLIK-456") + .description("Payment without BLIK") + .displayName("No BLIK Test") + .processingChannelId(System.getenv("CHECKOUT_PROCESSING_CHANNEL_ID")) + .successUrl("https://example.com/payments/success") + .failureUrl("https://example.com/payments/failure") + .billing(createBillingInformation()) + .billingDescriptor(createBillingDescriptor()) + .risk(createRiskRequest()) + .threeDS(createThreeDSRequest()) + .capture(true) + .locale(LocaleType.EN_GB) + .enabledPaymentMethods(Collections.singletonList(PaymentMethodType.CARD)) + .disabledPaymentMethods(Collections.singletonList(PaymentMethodType.BLIK)) + .paymentMethodConfiguration(createPaymentMethodConfiguration()) + .build(); + + final CompletableFuture future = + checkoutApi.flowClient().requestPaymentSession(request); + final PaymentSessionResponse response = future.join(); + + assertNotNull(response); + assertNotNull(response.getId()); + assertNotNull(response.getPaymentSessionToken()); + assertNotNull(response.getPaymentSessionSecret()); + } + private PaymentSessionSubmitRequest createPaymentSessionSubmitRequest() { return PaymentSessionSubmitRequest.builder() .sessionData("encrypted_session_data") diff --git a/src/test/java/com/checkout/handlepaymentsandpayouts/flow/PaymentSessionSerializationTest.java b/src/test/java/com/checkout/handlepaymentsandpayouts/flow/PaymentSessionSerializationTest.java index 1625b8eb..d85a20a8 100644 --- a/src/test/java/com/checkout/handlepaymentsandpayouts/flow/PaymentSessionSerializationTest.java +++ b/src/test/java/com/checkout/handlepaymentsandpayouts/flow/PaymentSessionSerializationTest.java @@ -109,6 +109,64 @@ void shouldDeserializePaymentSessionCreateRequestWithCustomerSummary() { }, "Should deserialize PaymentSessionCreateRequest with Customer.CustomerSummary without GSON reflection errors"); } + @Test + void shouldSerializePaymentSessionCreateRequestWithBlikPaymentMethod() { + Customer customer = Customer.builder() + .email("blik@example.com") + .name("BLIK Customer") + .id("cust_blik_123") + .build(); + + PaymentSessionCreateRequest request = PaymentSessionCreateRequest.builder() + .amount(2000L) + .currency(Currency.EUR) + .reference("blik-ref-456") + .paymentType(PaymentType.REGULAR) + .description("Test BLIK payment") + .customer(customer) + .locale(LocaleType.EN_GB) + .enabledPaymentMethods(Collections.singletonList(PaymentMethodType.BLIK)) + .capture(true) + .build(); + + assertDoesNotThrow(() -> { + String json = serializer.toJson(request); + assertNotNull(json); + assertTrue(json.contains("\"blik\""), "Should contain serialized BLIK payment method"); + assertTrue(json.contains("blik@example.com"), "Should contain customer email"); + assertTrue(json.contains("BLIK Customer"), "Should contain customer name"); + }, "Should serialize PaymentSessionCreateRequest with BLIK payment method without errors"); + } + + @Test + void shouldDeserializePaymentSessionCreateRequestWithBlikPaymentMethod() { + String json = "{" + + "\"amount\":2000," + + "\"currency\":\"EUR\"," + + "\"reference\":\"blik-ref-456\"," + + "\"payment_type\":\"Regular\"," + + "\"description\":\"Test BLIK payment\"," + + "\"customer\":{" + + " \"email\":\"blik@example.com\"," + + " \"name\":\"BLIK Customer\"," + + " \"id\":\"cust_blik_123\"" + + "}," + + "\"locale\":\"en-GB\"," + + "\"enabled_payment_methods\":[\"blik\"]," + + "\"capture\":true" + + "}"; + + assertDoesNotThrow(() -> { + PaymentSessionCreateRequest request = serializer.fromJson(json, PaymentSessionCreateRequest.class); + assertNotNull(request); + assertNotNull(request.getEnabledPaymentMethods()); + assertEquals(1, request.getEnabledPaymentMethods().size()); + assertEquals(PaymentMethodType.BLIK, request.getEnabledPaymentMethods().get(0)); + assertEquals("blik@example.com", request.getCustomer().getEmail()); + assertEquals("BLIK Customer", request.getCustomer().getName()); + }, "Should deserialize PaymentSessionCreateRequest with BLIK payment method without errors"); + } + @Test void shouldRoundTripSerializePaymentSessionCreateRequestWithCustomer() { Customer.CustomerSummary summary = Customer.CustomerSummary.builder() From d9419270cfc18bbde130e440bda9191898366f98 Mon Sep 17 00:00:00 2001 From: david ruiz Date: Mon, 27 Apr 2026 11:27:19 +0200 Subject: [PATCH 4/4] Removed unused method --- .../flow/FlowTestIT.java | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/test/java/com/checkout/handlepaymentsandpayouts/flow/FlowTestIT.java b/src/test/java/com/checkout/handlepaymentsandpayouts/flow/FlowTestIT.java index fa6271a0..54d74cc5 100644 --- a/src/test/java/com/checkout/handlepaymentsandpayouts/flow/FlowTestIT.java +++ b/src/test/java/com/checkout/handlepaymentsandpayouts/flow/FlowTestIT.java @@ -174,27 +174,6 @@ private PaymentSessionCreateRequest createPaymentSessionCreateRequest() { .build(); } - private PaymentSessionCreateRequest createPaymentSessionCreateRequestWithBlik() { - return PaymentSessionCreateRequest.builder() - .amount(2000L) - .currency(Currency.PLN) - .reference("ORD-BLIK-789") - .description("BLIK payment for mobile transaction") - .displayName("Company BLIK Test") - .processingChannelId(System.getenv("CHECKOUT_PROCESSING_CHANNEL_ID")) - .successUrl("https://example.com/payments/success") - .failureUrl("https://example.com/payments/failure") - .billing(createBillingInformation()) - .billingDescriptor(createBillingDescriptor()) - .risk(createRiskRequest()) - .threeDS(createThreeDSRequest()) - .capture(true) - .locale(LocaleType.EN_GB) - .enabledPaymentMethods(Collections.singletonList(PaymentMethodType.BLIK)) - .paymentMethodConfiguration(createPaymentMethodConfiguration()) - .build(); - } - @Test void shouldCreatePaymentSessionWithBlikInDisabledMethods() { // Test BLIK in disabled payment methods list