Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko committed Dec 5, 2023
1 parent a370fc9 commit 6c27957
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/checkout/CardSourceHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/com/checkout/TestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static CustomerRequest createCustomer() {

public static Phone createPhone() {
return Phone.builder()
.countryCode("1")
.countryCode("+1")
.number("4155552671")
.build();
}
Expand Down Expand Up @@ -193,6 +193,7 @@ public static AccountHolder getAccountHolder(){
return AccountHolder.builder()
.firstName("John")
.lastName("Doe")
.email(generateRandomEmail())
.phone(createPhone())
.billingAddress(createAddress())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
12 changes: 10 additions & 2 deletions src/test/java/com/checkout/payments/RequestApmPaymentsIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -460,6 +467,7 @@ void shouldMakeAlmaPayment() {
}

@Test
@Disabled("not available")
void shouldMakeKlarnaPayment() {
final PaymentRequest paymentRequest = PaymentRequest.builder()
.source(RequestKlarnaSource.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> GATEWAY_EVENT_TYPES = Arrays.asList(PAYMENT_APPROVED, "payment_declined",
PAYMENT_CAPTURED, "payment_capture_declined", "payment_refunded", "payment_refund_declined", "payment_voided",
Expand Down

0 comments on commit 6c27957

Please sign in to comment.