Search in sources :

Example 6 with Faker

use of com.github.javafaker.Faker in project bisq-api by mrosseel.

the class PaymentAccountIT method create_validFasterPayments_returnsCreatedAccount.

@InSequence(2)
@Test
public void create_validFasterPayments_returnsCreatedAccount() {
    final int alicePort = getAlicePort();
    final Faker faker = new Faker();
    final FasterPaymentsPaymentAccount accountToCreate = new FasterPaymentsPaymentAccount();
    ApiTestHelper.randomizeAccountPayload(accountToCreate);
    accountToCreate.accountNr = faker.finance().iban();
    accountToCreate.sortCode = faker.address().zipCode();
    final String expectedPaymentDetails = String.format("FasterPayments - UK Sort code: %s, Account number: %s", accountToCreate.sortCode, accountToCreate.accountNr);
    given().port(alicePort).contentType(ContentType.JSON).body(accountToCreate).when().post("/api/v1/payment-accounts").then().statusCode(200).and().body("id", isA(String.class)).and().body("paymentMethod", equalTo(accountToCreate.paymentMethod)).and().body("accountName", equalTo(accountToCreate.accountName)).and().body("paymentDetails", equalTo(expectedPaymentDetails)).and().body("selectedTradeCurrency", equalTo(accountToCreate.selectedTradeCurrency)).and().body("tradeCurrencies", equalTo(accountToCreate.tradeCurrencies)).and().body("accountNr", equalTo(accountToCreate.accountNr)).and().body("sortCode", equalTo(accountToCreate.sortCode)).and().body("size()", equalTo(8));
}
Also used : Faker(com.github.javafaker.Faker) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 7 with Faker

use of com.github.javafaker.Faker in project bisq-api by mrosseel.

the class PaymentAccountIT method create_validPopmoney_returnsCreatedAccount.

@InSequence(2)
@Test
public void create_validPopmoney_returnsCreatedAccount() {
    final int alicePort = getAlicePort();
    final Faker faker = new Faker();
    final PopmoneyPaymentAccount accountToCreate = new PopmoneyPaymentAccount();
    ApiTestHelper.randomizeAccountPayload(accountToCreate);
    accountToCreate.accountId = faker.idNumber().valid();
    accountToCreate.holderName = faker.name().fullName();
    final String expectedPaymentDetails = String.format("Popmoney - Holder name: %s, email or phone no.: %s", accountToCreate.holderName, accountToCreate.accountId);
    given().port(alicePort).contentType(ContentType.JSON).body(accountToCreate).when().post("/api/v1/payment-accounts").then().statusCode(200).and().body("id", isA(String.class)).and().body("paymentMethod", equalTo(accountToCreate.paymentMethod)).and().body("accountName", equalTo(accountToCreate.accountName)).and().body("paymentDetails", equalTo(expectedPaymentDetails)).and().body("selectedTradeCurrency", equalTo(accountToCreate.selectedTradeCurrency)).and().body("tradeCurrencies", equalTo(accountToCreate.tradeCurrencies)).and().body("accountId", equalTo(accountToCreate.accountId)).and().body("holderName", equalTo(accountToCreate.holderName)).and().body("size()", equalTo(8));
}
Also used : Faker(com.github.javafaker.Faker) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 8 with Faker

use of com.github.javafaker.Faker in project bisq-api by mrosseel.

the class PaymentAccountIT method create_validMoneyBeam_returnsCreatedAccount.

@InSequence(2)
@Test
public void create_validMoneyBeam_returnsCreatedAccount() {
    final int alicePort = getAlicePort();
    final Faker faker = new Faker();
    final MoneyBeamPaymentAccount accountToCreate = new MoneyBeamPaymentAccount();
    ApiTestHelper.randomizeAccountPayload(accountToCreate);
    accountToCreate.accountId = faker.idNumber().valid();
    final String expectedPaymentDetails = String.format("MoneyBeam - Account: %s", accountToCreate.accountId);
    given().port(alicePort).contentType(ContentType.JSON).body(accountToCreate).when().post("/api/v1/payment-accounts").then().statusCode(200).and().body("id", isA(String.class)).and().body("paymentMethod", equalTo(accountToCreate.paymentMethod)).and().body("accountName", equalTo(accountToCreate.accountName)).and().body("paymentDetails", equalTo(expectedPaymentDetails)).and().body("selectedTradeCurrency", equalTo(accountToCreate.selectedTradeCurrency)).and().body("tradeCurrencies", equalTo(accountToCreate.tradeCurrencies)).and().body("accountId", equalTo(accountToCreate.accountId)).and().body("size()", equalTo(7));
}
Also used : Faker(com.github.javafaker.Faker) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 9 with Faker

use of com.github.javafaker.Faker in project bisq-api by mrosseel.

the class PaymentAccountIT method create_validSameBankAccount_returnsCreatedAccount.

@InSequence(2)
@Test
public void create_validSameBankAccount_returnsCreatedAccount() {
    final int alicePort = getAlicePort();
    final Faker faker = new Faker();
    final SameBankAccountPaymentAccount accountToCreate = new SameBankAccountPaymentAccount();
    ApiTestHelper.randomizeAccountPayload(accountToCreate);
    accountToCreate.accountNr = faker.finance().iban();
    accountToCreate.accountType = faker.options().option("savings", "avista");
    accountToCreate.bankId = faker.finance().bic();
    accountToCreate.bankName = faker.company().name();
    accountToCreate.branchId = faker.company().buzzword();
    accountToCreate.countryCode = faker.address().countryCode();
    accountToCreate.holderName = faker.name().fullName();
    accountToCreate.holderTaxId = faker.finance().creditCard();
    final String expectedPaymentDetails = String.format("Transfer with same Bank - Holder name: %s, Bank name: %s, Bank ID (BIC/SWIFT): %s, Branch no.: %s, Account no. (IBAN): %s, Country of bank: %s", accountToCreate.holderName, accountToCreate.bankName, accountToCreate.bankId, accountToCreate.branchId, accountToCreate.accountNr, CountryUtil.getNameByCode(accountToCreate.countryCode));
    given().port(alicePort).contentType(ContentType.JSON).body(accountToCreate).when().post("/api/v1/payment-accounts").then().statusCode(200).and().body("id", isA(String.class)).and().body("paymentMethod", equalTo(accountToCreate.paymentMethod)).and().body("accountName", equalTo(accountToCreate.accountName)).and().body("paymentDetails", equalTo(expectedPaymentDetails)).and().body("selectedTradeCurrency", equalTo(accountToCreate.selectedTradeCurrency)).and().body("tradeCurrencies", equalTo(accountToCreate.tradeCurrencies)).and().body("accountNr", equalTo(accountToCreate.accountNr)).and().body("accountType", equalTo(accountToCreate.accountType)).and().body("bankId", equalTo(accountToCreate.bankId)).and().body("bankName", equalTo(accountToCreate.bankName)).and().body("branchId", equalTo(accountToCreate.branchId)).and().body("countryCode", equalTo(accountToCreate.countryCode)).and().body("holderName", equalTo(accountToCreate.holderName)).and().body("holderTaxId", equalTo(accountToCreate.holderTaxId)).and().body("size()", equalTo(14));
}
Also used : Faker(com.github.javafaker.Faker) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Example 10 with Faker

use of com.github.javafaker.Faker in project bisq-api by mrosseel.

the class PaymentAccountIT method create_validSwish_returnsCreatedAccount.

@InSequence(2)
@Test
public void create_validSwish_returnsCreatedAccount() {
    final int alicePort = getAlicePort();
    final Faker faker = new Faker();
    final SwishPaymentAccount accountToCreate = new SwishPaymentAccount();
    ApiTestHelper.randomizeAccountPayload(accountToCreate);
    accountToCreate.holderName = faker.name().fullName();
    accountToCreate.mobileNr = faker.phoneNumber().cellPhone();
    final String expectedPaymentDetails = String.format("Swish - Holder name: %s, mobile no.: %s", accountToCreate.holderName, accountToCreate.mobileNr);
    given().port(alicePort).contentType(ContentType.JSON).body(accountToCreate).when().post("/api/v1/payment-accounts").then().statusCode(200).and().body("id", isA(String.class)).and().body("paymentMethod", equalTo(accountToCreate.paymentMethod)).and().body("accountName", equalTo(accountToCreate.accountName)).and().body("paymentDetails", equalTo(expectedPaymentDetails)).and().body("selectedTradeCurrency", equalTo(accountToCreate.selectedTradeCurrency)).and().body("tradeCurrencies", equalTo(accountToCreate.tradeCurrencies)).and().body("holderName", equalTo(accountToCreate.holderName)).and().body("mobileNr", equalTo(accountToCreate.mobileNr)).and().body("size()", equalTo(8));
}
Also used : Faker(com.github.javafaker.Faker) InSequence(org.jboss.arquillian.junit.InSequence) Test(org.junit.Test)

Aggregations

Faker (com.github.javafaker.Faker)31 Test (org.junit.Test)26 InSequence (org.jboss.arquillian.junit.InSequence)21 Locale (java.util.Locale)4 Gson (com.google.gson.Gson)3 HashMap (java.util.HashMap)3 AccessToken (com.twilio.jwt.accesstoken.AccessToken)2 AbstractFakerTest (com.github.javafaker.AbstractFakerTest)1 IpMessagingGrant (com.twilio.jwt.accesstoken.IpMessagingGrant)1 AccessToken (com.twilio.sdk.auth.AccessToken)1 VideoGrant (com.twilio.sdk.auth.VideoGrant)1 io.bisq.api.model.payment (io.bisq.api.model.payment)1 SepaPaymentAccount (io.bisq.api.model.payment.SepaPaymentAccount)1 CountryUtil (io.bisq.common.locale.CountryUtil)1 RestAssured.given (io.restassured.RestAssured.given)1 ContentType (io.restassured.http.ContentType)1 Path (java.nio.file.Path)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1