@Test public void shouldConvert() throws Exception { RequestMap expectedMap = new RequestMap(); expectedMap.putMap(new HashMap<String, String>(){{ put("creditCardToken", "token"); put("creditCardHolderName", "name"); put("creditCardHolderCPF", "cpf"); put("creditCardHolderCNPJ", "cnpj"); put("creditCardHolderBirthDate", "09/11/2016"); put("creditCardHolderAreaCode", "16"); put("creditCardHolderPhone", "123456789"); put("billingAddressCountry", "BRA"); put("billingAddressState", "PA"); put("billingAddressCity", "city"); put("billingAddressPostalCode", "99999999"); put("billingAddressDistrict", "district"); put("billingAddressStreet", "street"); put("billingAddressNumber", "999"); put("billingAddressComplement", "complement"); }}); RequestMap map = mapConverter.convert(creditCard); assertEquals(expectedMap, map); }
@Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCardToken", creditCard.getToken()); requestMap.putMap(CREDIT_CARD_HOLDER_MC.convert(creditCard.getHolder())); requestMap.putMap(INSTALLMENT_MC.convert(creditCard.getInstallment())); requestMap.putMap(CREDIT_CARD_BILLING_ADDRESS_MC.convert(creditCard.getBillingAddress())); }
CreditCardV2MapConverter extends AbstractMapConverter<CreditCard> { @Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCardToken", creditCard.getToken()); requestMap.putMap(CREDIT_CARD_HOLDER_MC.convert(creditCard.getHolder())); requestMap.putMap(INSTALLMENT_MC.convert(creditCard.getInstallment())); requestMap.putMap(CREDIT_CARD_BILLING_ADDRESS_MC.convert(creditCard.getBillingAddress())); } }
CreditCardV2MapConverter extends AbstractMapConverter<CreditCard> { @Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCardToken", creditCard.getToken()); requestMap.putMap(CREDIT_CARD_HOLDER_MC.convert(creditCard.getHolder())); requestMap.putMap(INSTALLMENT_MC.convert(creditCard.getInstallment())); requestMap.putMap(CREDIT_CARD_BILLING_ADDRESS_MC.convert(creditCard.getBillingAddress())); }  }
CreditCardV2MapConverter extends AbstractMapConverter<CreditCard> { @Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCardToken", creditCard.getToken()); requestMap.putMap(CREDIT_CARD_HOLDER_MC.convert(creditCard.getHolder())); requestMap.putMap(INSTALLMENT_MC.convert(creditCard.getInstallment())); requestMap.putMap(CREDIT_CARD_BILLING_ADDRESS_MC.convert(creditCard.getBillingAddress())); }   }
CreditCardV2MapConverter extends AbstractMapConverter<CreditCard> { @Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCardToken", creditCard.getToken()); requestMap.putMap(CREDIT_CARD_HOLDER_MC.convert(creditCard.getHolder())); requestMap.putMap(INSTALLMENT_MC.convert(creditCard.getInstallment())); requestMap.putMap(CREDIT_CARD_BILLING_ADDRESS_MC.convert(creditCard.getBillingAddress())); }    }