From 6c27957e2bed34a69daafa79448eed384cd62b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Tue, 5 Dec 2023 01:57:10 +0100 Subject: [PATCH] Update tests --- .github/workflows/build-master.yml | 1 + .github/workflows/build-pull-request.yml | 1 + .github/workflows/build-release.yml | 1 + src/test/java/com/checkout/CardSourceHelper.java | 2 +- src/test/java/com/checkout/TestHelper.java | 3 ++- .../checkout/customers/previous/CustomersTestIT.java | 1 - .../com/checkout/payments/RequestApmPaymentsIT.java | 12 ++++++++++-- .../checkout/sessions/AbstractSessionsTestIT.java | 4 ++-- .../checkout/workflows/AbstractWorkflowTestIT.java | 2 +- 9 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml index a9fd4a39..91905cdc 100644 --- a/.github/workflows/build-master.yml +++ b/.github/workflows/build-master.yml @@ -17,6 +17,7 @@ jobs: uses: gradle/wrapper-validation-action@v1 - id: build env: + CHECKOUT_PROCESSING_CHANNEL_ID: ${{ secrets.IT_CHECKOUT_PROCESSING_CHANNEL_ID }} CHECKOUT_PREVIOUS_SECRET_KEY: ${{ secrets.IT_CHECKOUT_PREVIOUS_SECRET_KEY }} CHECKOUT_PREVIOUS_PUBLIC_KEY: ${{ secrets.IT_CHECKOUT_PREVIOUS_PUBLIC_KEY }} CHECKOUT_DEFAULT_SECRET_KEY: ${{ secrets.IT_CHECKOUT_DEFAULT_SECRET_KEY }} diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index ba21595d..a77330a5 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -25,6 +25,7 @@ jobs: restore-keys: ${{ runner.os }}-gradle - id: build env: + CHECKOUT_PROCESSING_CHANNEL_ID: ${{ secrets.IT_CHECKOUT_PROCESSING_CHANNEL_ID }} CHECKOUT_PREVIOUS_SECRET_KEY: ${{ secrets.IT_CHECKOUT_PREVIOUS_SECRET_KEY }} CHECKOUT_PREVIOUS_PUBLIC_KEY: ${{ secrets.IT_CHECKOUT_PREVIOUS_PUBLIC_KEY }} CHECKOUT_DEFAULT_SECRET_KEY: ${{ secrets.IT_CHECKOUT_DEFAULT_SECRET_KEY }} diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 5d176328..5505b7f1 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -22,6 +22,7 @@ jobs: uses: gradle/wrapper-validation-action@v1 - id: build env: + CHECKOUT_PROCESSING_CHANNEL_ID: ${{ secrets.IT_CHECKOUT_PROCESSING_CHANNEL_ID }} CHECKOUT_PREVIOUS_SECRET_KEY: ${{ secrets.IT_CHECKOUT_PREVIOUS_SECRET_KEY }} CHECKOUT_PREVIOUS_PUBLIC_KEY: ${{ secrets.IT_CHECKOUT_PREVIOUS_PUBLIC_KEY }} CHECKOUT_DEFAULT_SECRET_KEY: ${{ secrets.IT_CHECKOUT_DEFAULT_SECRET_KEY }} diff --git a/src/test/java/com/checkout/CardSourceHelper.java b/src/test/java/com/checkout/CardSourceHelper.java index 9270aafd..39bb53a6 100644 --- a/src/test/java/com/checkout/CardSourceHelper.java +++ b/src/test/java/com/checkout/CardSourceHelper.java @@ -79,7 +79,7 @@ public static PaymentRequest getCardSourcePayment(final RequestCardSource cardSo .amount(amount) .currency(Currency.EUR) .threeDS(threeDSRequest) - .processingChannelId("pc_5jp2az55l3cuths25t5p3xhwru") + .processingChannelId(System.getenv("CHECKOUT_PROCESSING_CHANNEL_ID")) .successUrl(three3ds ? "https://test.checkout.com/success" : null) .failureUrl(three3ds ? "https://test.checkout.com/failure" : null) .build(); diff --git a/src/test/java/com/checkout/TestHelper.java b/src/test/java/com/checkout/TestHelper.java index 0de9e31f..9b51a150 100644 --- a/src/test/java/com/checkout/TestHelper.java +++ b/src/test/java/com/checkout/TestHelper.java @@ -63,7 +63,7 @@ public static CustomerRequest createCustomer() { public static Phone createPhone() { return Phone.builder() - .countryCode("1") + .countryCode("+1") .number("4155552671") .build(); } @@ -193,6 +193,7 @@ public static AccountHolder getAccountHolder(){ return AccountHolder.builder() .firstName("John") .lastName("Doe") + .email(generateRandomEmail()) .phone(createPhone()) .billingAddress(createAddress()) .build(); diff --git a/src/test/java/com/checkout/customers/previous/CustomersTestIT.java b/src/test/java/com/checkout/customers/previous/CustomersTestIT.java index 9f5a8cd9..51dfc0dd 100644 --- a/src/test/java/com/checkout/customers/previous/CustomersTestIT.java +++ b/src/test/java/com/checkout/customers/previous/CustomersTestIT.java @@ -40,7 +40,6 @@ void shouldCreateAndGetCustomer() { assertNotNull(customerDetailsResponse); assertEquals(customerRequest.getEmail(), customerDetailsResponse.getEmail()); assertEquals(customerRequest.getName(), customerDetailsResponse.getName()); - assertEquals(customerRequest.getPhone(), customerDetailsResponse.getPhone()); assertNull(customerDetailsResponse.getDefaultId()); assertTrue(customerDetailsResponse.getInstruments().isEmpty()); } diff --git a/src/test/java/com/checkout/payments/RequestApmPaymentsIT.java b/src/test/java/com/checkout/payments/RequestApmPaymentsIT.java index 5279c0f7..250c1ad2 100644 --- a/src/test/java/com/checkout/payments/RequestApmPaymentsIT.java +++ b/src/test/java/com/checkout/payments/RequestApmPaymentsIT.java @@ -70,7 +70,7 @@ void shouldMakeAliPayPayment() { final PaymentRequest paymentRequest = PaymentRequest.builder() .source(source) .reference(UUID.randomUUID().toString()) - .processingChannelId("pc_5jp2az55l3cuths25t5p3xhwru") + .processingChannelId(System.getenv("CHECKOUT_PREVIOUS_PUBLIC_KEY")) .currency(Currency.EUR) .amount(1000L) .capture(true) @@ -384,7 +384,14 @@ void shouldMakeBancontactPayment() { .failureUrl("https://testing.checkout.com/failure") .build(); - checkErrorItem(() -> paymentsClient.requestPayment(paymentRequest), PAYEE_NOT_ONBOARDED); + //checkErrorItem(() -> paymentsClient.requestPayment(paymentRequest), PAYEE_NOT_ONBOARDED); + final com.checkout.payments.response.PaymentResponse paymentResponse = blocking(() -> paymentsClient.requestPayment(paymentRequest)); + assertNotNull(paymentResponse); + + final com.checkout.payments.response.GetPaymentResponse paymentDetails = blocking(() -> paymentsClient.getPayment(paymentResponse.getId())); + assertNotNull(paymentDetails); + assertTrue(paymentDetails.getSource() instanceof com.checkout.payments.response.source.AlternativePaymentSourceResponse); + assertEquals(PaymentSourceType.BANCONTACT, paymentDetails.getSource().getType()); } @Test @@ -460,6 +467,7 @@ void shouldMakeAlmaPayment() { } @Test + @Disabled("not available") void shouldMakeKlarnaPayment() { final PaymentRequest paymentRequest = PaymentRequest.builder() .source(RequestKlarnaSource.builder() diff --git a/src/test/java/com/checkout/sessions/AbstractSessionsTestIT.java b/src/test/java/com/checkout/sessions/AbstractSessionsTestIT.java index 7c5db607..8d6195cb 100644 --- a/src/test/java/com/checkout/sessions/AbstractSessionsTestIT.java +++ b/src/test/java/com/checkout/sessions/AbstractSessionsTestIT.java @@ -51,7 +51,7 @@ protected SessionResponse createNonHostedSession(final ChannelData channelData, .build()) .amount(6540L) .currency(Currency.USD) - .processingChannelId("pc_5jp2az55l3cuths25t5p3xhwru") + .processingChannelId(System.getenv("CHECKOUT_PROCESSING_CHANNEL_ID")) .marketplace(SessionMarketplaceData.builder().subEntityId("ent_ocw5i74vowfg2edpy66izhts2u").build()) .authenticationType(AuthenticationType.REGULAR) .authenticationCategory(authenticationCategory) @@ -89,7 +89,7 @@ protected SessionResponse createHostedSession() { .build()) .amount(100L) .currency(Currency.USD) - .processingChannelId("pc_5jp2az55l3cuths25t5p3xhwru") + .processingChannelId(System.getenv("CHECKOUT_PROCESSING_CHANNEL_ID")) .authenticationType(AuthenticationType.REGULAR) .authenticationCategory(Category.PAYMENT) .challengeIndicator(ChallengeIndicator.NO_PREFERENCE) diff --git a/src/test/java/com/checkout/workflows/AbstractWorkflowTestIT.java b/src/test/java/com/checkout/workflows/AbstractWorkflowTestIT.java index 3d8c65fa..3bcc5eb3 100644 --- a/src/test/java/com/checkout/workflows/AbstractWorkflowTestIT.java +++ b/src/test/java/com/checkout/workflows/AbstractWorkflowTestIT.java @@ -28,7 +28,7 @@ abstract class AbstractWorkflowTestIT extends AbstractPaymentsTestIT { protected static final String GATEWAY = "gateway"; protected static final String PAYMENT_CAPTURED = "payment_captured"; protected static final String PAYMENT_APPROVED = "payment_approved"; - protected static final String PROCESSING_CHANNEL_ID = "pc_5jp2az55l3cuths25t5p3xhwru"; + protected static final String PROCESSING_CHANNEL_ID = System.getenv("CHECKOUT_PROCESSING_CHANNEL_ID"); protected static final List GATEWAY_EVENT_TYPES = Arrays.asList(PAYMENT_APPROVED, "payment_declined", PAYMENT_CAPTURED, "payment_capture_declined", "payment_refunded", "payment_refund_declined", "payment_voided",