This commit is contained in:
k.struzhkin 2021-03-09 17:01:56 +03:00
parent 4597c98b38
commit 69d7268c60

View File

@ -14,6 +14,8 @@ import org.springframework.stereotype.Component;
@Component
public class FistfulResourceToDomainResourceConverter implements Converter<com.rbkmoney.fistful.base.Resource, Resource> {
public static final BankCardPaymentSystem DEAFAULT_PAYMENT_SYSTEM = BankCardPaymentSystem.visa;
@Override
public Resource convert(com.rbkmoney.fistful.base.Resource fistfulResource) {
log.debug("Start convert fistfulResource : {}", fistfulResource);
@ -40,9 +42,9 @@ public class FistfulResourceToDomainResourceConverter implements Converter<com.r
bankCard.setIssuerCountry(bankCardFrom.isSetIssuerCountry() ?
Residence.valueOf(bankCardFrom.getIssuerCountry().name()) : null);
bankCard.setPaymentSystem(bankCardFrom.isSetPaymentSystem() ?
BankCardPaymentSystem.valueOf(bankCardFrom.getPaymentSystem().name()) : null);
bankCard.setLastDigits(bankCardFrom.getMaskedPan());
bankCard.setBin(bankCardFrom.getBin());
BankCardPaymentSystem.valueOf(bankCardFrom.getPaymentSystem().name()) : DEAFAULT_PAYMENT_SYSTEM);
bankCard.setLastDigits(bankCardFrom.getMaskedPan() != null ? bankCardFrom.getMaskedPan() : "UNKNOWN");
bankCard.setBin(bankCardFrom.getBin() != null ? bankCardFrom.getBin() : "UNKNOWN");
bankCard.setCategory(bankCardFrom.getCategory());
bankCard.setBankName(bankCardFrom.getBankName());
return bankCard;