Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Feb 6, 2024
1 parent 5cc5b64 commit ad67b21
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
19 changes: 3 additions & 16 deletions src/test/java/com/mangopay/core/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ protected Map<String, String> getJohnsWalletWithMoney3DSecure(int amount) throws
cardRegistration.setCurrency(CurrencyIso.EUR);
cardRegistration = this.api.getCardRegistrationApi().create(cardRegistration);

cardRegistration.setRegistrationData(this.getPaylineCorrectRegistartionData3DSecure(cardRegistration));
cardRegistration.setRegistrationData(this.getPaylineCorrectRegistartionData(cardRegistration));
cardRegistration = this.api.getCardRegistrationApi().update(cardRegistration);

Card card = this.api.getCardApi().get(cardRegistration.getCardId());
Expand Down Expand Up @@ -1133,7 +1133,7 @@ protected CardRegistration getDepositCardRegistration() throws Exception {
cardRegistration.setCurrency(CurrencyIso.EUR);
CardRegistration newCardRegistration = this.api.getCardRegistrationApi().create(cardRegistration);

String registrationData = this.getPaylineCorrectRegistartionDataForDeposit(newCardRegistration);
String registrationData = this.getPaylineCorrectRegistartionData(newCardRegistration);
newCardRegistration.setRegistrationData(registrationData);
return this.api.getCardRegistrationApi().update(newCardRegistration);
}
Expand Down Expand Up @@ -1242,19 +1242,6 @@ protected KycDocument getNewKycDocument() throws Exception {
return getJohnsKycDocument();
}

/**
* Gets registration data from Payline service 3DSecure.
*
* @param cardRegistration
* @return Registration data.
*/
protected String getPaylineCorrectRegistartionData3DSecure(CardRegistration cardRegistration) throws MalformedURLException, IOException, Exception {
return getPaylineCorrectRegistartionData3DSecureForCardNumber(cardRegistration, "4970105191923460");
}

protected String getPaylineCorrectRegistartionDataForDeposit(CardRegistration cardRegistration) throws MalformedURLException, IOException, Exception {
return getPaylineCorrectRegistartionData3DSecureForCardNumber(cardRegistration, "4970105181818183");
}

protected String getPaylineCorrectRegistartionData3DSecureForCardNumber(CardRegistration cardRegistration, String cardNumber) throws MalformedURLException, IOException, Exception {

Expand Down Expand Up @@ -1308,7 +1295,7 @@ protected String getPaylineCorrectRegistartionData3DSecureForCardNumber(CardRegi
* @return Registration data.
*/
protected String getPaylineCorrectRegistartionData(CardRegistration cardRegistration) throws MalformedURLException, IOException, Exception {
return getPaylineCorrectRegistartionData3DSecureForCardNumber(cardRegistration, "4970105191923460");
return getPaylineCorrectRegistartionData3DSecureForCardNumber(cardRegistration, "4970107111111119");
}

protected Hook getJohnsHook() throws Exception {
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/com/mangopay/core/PayInApiImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ public void createPreAuthorizedDirect() {

PayIn createPayIn = this.api.getPayInApi().create(payIn);

// wait 2 seconds for the transactions to be created in the API
Thread.sleep(2000);

List<Transaction> preAuthTransactions = this.api.getCardPreAuthorizationApi().getTransactions(cardPreAuthorization.getId(), new Pagination(1, 1));

assertTrue(!"".equals(createPayIn.getId()));
Expand Down Expand Up @@ -462,7 +465,6 @@ public void createDirectDebitWeb() {
assertTrue(createPayIn.getFees().getCurrency() == CurrencyIso.EUR);
assertNotNull(((PayInExecutionDetailsWeb) createPayIn.getExecutionDetails()).getReturnUrl());
assertNotNull(((PayInExecutionDetailsWeb) createPayIn.getExecutionDetails()).getRedirectUrl());
assertNotNull(((PayInExecutionDetailsWeb) createPayIn.getExecutionDetails()).getTemplateUrl());

} catch (Exception ex) {
fail(ex.getMessage());
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/mangopay/core/WalletApiImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public void getWalletTransactions() throws Exception {
Pagination pagination = new Pagination(1, 1);
FilterTransactions filter = new FilterTransactions();
filter.setType(TransactionType.PAYIN);

// wait 2 seconds for the transactions to be created in the API
Thread.sleep(2);

List<Transaction> transactions = this.api.getWalletApi().getTransactions(wallet.getId(), pagination, filter);

assertTrue(transactions.size() == 1);
Expand Down

0 comments on commit ad67b21

Please sign in to comment.