@Test public void shouldConvert() throws Exception { RequestMap expectedMap = new RequestMap(); expectedMap.putMap(new HashMap<String, String>(){{ put("creditCard.token", "token"); put("creditCard.holder.name", "name"); put("creditCard.holder.CPF", "cpf"); put("creditCard.holder.CNPJ", "cnpj"); put("creditCard.holder.birthDate", "09/11/2016"); put("creditCard.holder.areaCode", "16"); put("creditCard.holder.phone", "123456789"); put("billingAddress.country", "BRA"); put("billingAddress.state", "PA"); put("billingAddress.city", "city"); put("billingAddress.postalCode", "99999999"); put("billingAddress.district", "district"); put("billingAddress.street", "street"); put("billingAddress.number", "999"); put("billingAddress.complement", "complement"); }}); RequestMap map = mapConverter.convert(creditCard); assertEquals(expectedMap, map); }
@Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCard.token", 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())); }
CreditCardV3MapConverter extends AbstractMapConverter<CreditCard> { @Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCard.token", 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())); } }
CreditCardV3MapConverter extends AbstractMapConverter<CreditCard> { @Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCard.token", 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())); }  }
CreditCardV3MapConverter extends AbstractMapConverter<CreditCard> { @Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCard.token", 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())); }   }
CreditCardV3MapConverter extends AbstractMapConverter<CreditCard> { @Override protected void convert(RequestMap requestMap, CreditCard creditCard) { requestMap.putString("creditCard.token", 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())); }    }