use of uk.gov.pay.connector.common.model.domain.Address in project pay-connector by alphagov.
the class SmartpayPaymentProviderTest method shouldSendSuccessfullyAnOrderForMerchantWithUsAddressInRequest.
@Test
public void shouldSendSuccessfullyAnOrderForMerchantWithUsAddressInRequest() throws Exception {
PaymentProvider paymentProvider = getSmartpayPaymentProvider();
Address usAddress = new Address();
usAddress.setLine1("125 Kingsway");
usAddress.setLine2("Aviation House");
usAddress.setPostcode("90210");
usAddress.setCity("Washington D.C.");
usAddress.setCountry("US");
AuthCardDetails authCardDetails = AuthCardDetailsFixture.anAuthCardDetails().withCardNo(VALID_SMARTPAY_CARD_NUMBER).withAddress(usAddress).build();
CardAuthorisationGatewayRequest request = new CardAuthorisationGatewayRequest(chargeEntity, authCardDetails);
GatewayResponse response = paymentProvider.authorise(request);
assertTrue(response.isSuccessful());
}
use of uk.gov.pay.connector.common.model.domain.Address in project pay-connector by alphagov.
the class ChargeDaoCardDetailsIT method persist_shouldStoreNullCardTypeDetails.
@Test
public void persist_shouldStoreNullCardTypeDetails() {
GatewayAccountEntity testAccount = new GatewayAccountEntity(GatewayAccountType.TEST);
testAccount.setExternalId(randomUuid());
gatewayAccountDao.persist(testAccount);
GatewayAccountCredentialsEntity credentialsEntity = aGatewayAccountCredentialsEntity().withCredentials(Map.of("username", "theUsername", "password", "thePassword", "merchant_id", "theMerchantCode")).withGatewayAccountEntity(testAccount).withPaymentProvider(SANDBOX.getName()).withState(ACTIVE).withExternalId(randomUuid()).build();
gatewayAccountCredentialsDao.persist(credentialsEntity);
Address billingAddress = AddressFixture.anAddress().build();
ChargeEntity chargeEntity = ChargeEntityFixture.aValidChargeEntity().withGatewayAccountCredentialsEntity(credentialsEntity).build();
CardDetailsEntity cardDetailsEntity = new CardDetailsEntity(FirstDigitsCardNumber.of("123456"), LastDigitsCardNumber.of("1258"), "Mr. Pay Mc Payment", CardExpiryDate.valueOf("03/09"), "VISA", null, new AddressEntity(billingAddress));
chargeEntity.setCardDetails(cardDetailsEntity);
chargeDao.persist(chargeEntity);
Map<String, Object> cardDetailsSaved = databaseTestHelper.getChargeCardDetails(chargeEntity.getId());
assertThat(cardDetailsSaved, hasEntry("card_type", null));
}
use of uk.gov.pay.connector.common.model.domain.Address in project pay-connector by alphagov.
the class ChargeDaoCardDetailsIT method persist_shouldStoreCardDetails.
@Test
public void persist_shouldStoreCardDetails() {
GatewayAccountEntity testAccount = new GatewayAccountEntity(GatewayAccountType.TEST);
testAccount.setExternalId(randomUuid());
gatewayAccountDao.persist(testAccount);
GatewayAccountCredentialsEntity credentialsEntity = aGatewayAccountCredentialsEntity().withCredentials(Map.of()).withGatewayAccountEntity(testAccount).withPaymentProvider(SANDBOX.getName()).withState(ACTIVE).build();
credentialsEntity.setExternalId(randomUuid());
gatewayAccountCredentialsDao.persist(credentialsEntity);
Address billingAddress = AddressFixture.anAddress().build();
ChargeEntity chargeEntity = ChargeEntityFixture.aValidChargeEntity().withGatewayAccountCredentialsEntity(credentialsEntity).build();
CardDetailsEntity cardDetailsEntity = new CardDetailsEntity(FirstDigitsCardNumber.of("123456"), LastDigitsCardNumber.of("1258"), "Mr. Pay Mc Payment", CardExpiryDate.valueOf("03/09"), "VISA", CardType.DEBIT, new AddressEntity(billingAddress));
chargeEntity.setCardDetails(cardDetailsEntity);
chargeDao.persist(chargeEntity);
Map<String, Object> cardDetailsSaved = databaseTestHelper.getChargeCardDetails(chargeEntity.getId());
assertThat(cardDetailsSaved, hasEntry("card_type", "DEBIT"));
}
use of uk.gov.pay.connector.common.model.domain.Address in project pay-connector by alphagov.
the class WorldpayPaymentProviderTest method shouldBeAbleToSendAuthorisationRequestForMerchantWithUsAddress.
@Test
public void shouldBeAbleToSendAuthorisationRequestForMerchantWithUsAddress() {
WorldpayPaymentProvider paymentProvider = getValidWorldpayPaymentProvider();
Address usAddress = new Address();
usAddress.setLine1("125 Kingsway");
usAddress.setLine2("Aviation House");
usAddress.setPostcode("90210");
usAddress.setCity("Washington D.C.");
usAddress.setCountry("US");
AuthCardDetails authCardDetails = anAuthCardDetails().withAddress(usAddress).build();
CardAuthorisationGatewayRequest request = getCardAuthorisationRequest(authCardDetails);
GatewayResponse<WorldpayOrderStatusResponse> response = paymentProvider.authorise(request);
assertTrue(response.getBaseResponse().isPresent());
}
use of uk.gov.pay.connector.common.model.domain.Address in project pay-connector by alphagov.
the class WorldpayPaymentProviderTest method shouldBeAbleToSendAuthorisationRequestForMerchantWithCanadaAddress.
@Test
public void shouldBeAbleToSendAuthorisationRequestForMerchantWithCanadaAddress() {
WorldpayPaymentProvider paymentProvider = getValidWorldpayPaymentProvider();
Address canadaAddress = new Address();
canadaAddress.setLine1("125 Kingsway");
canadaAddress.setLine2("Aviation House");
canadaAddress.setPostcode("X0A0A0");
canadaAddress.setCity("Arctic Bay");
canadaAddress.setCountry("CA");
AuthCardDetails authCardDetails = anAuthCardDetails().withAddress(canadaAddress).build();
CardAuthorisationGatewayRequest request = getCardAuthorisationRequest(authCardDetails);
GatewayResponse<WorldpayOrderStatusResponse> response = paymentProvider.authorise(request);
assertTrue(response.getBaseResponse().isPresent());
}
Aggregations