Fill 'details' with 'product' if 'description' is null (#35)

Co-authored-by: Inal Arsanukaev <inalarsanukaev@192.168.1.5>
This commit is contained in:
Inal Arsanukaev 2022-05-24 12:22:40 +03:00 committed by GitHub
parent ba825592ca
commit b0b410cef2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -12,7 +12,7 @@
</parent> </parent>
<artifactId>adapter-flow-lib</artifactId> <artifactId>adapter-flow-lib</artifactId>
<version>0.1.6</version> <version>0.1.7</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>adapter-flow-lib</name> <name>adapter-flow-lib</name>

View File

@ -19,6 +19,7 @@ import dev.vality.cds.storage.Auth3DS;
import dev.vality.cds.storage.CardData; import dev.vality.cds.storage.CardData;
import dev.vality.cds.storage.SessionData; import dev.vality.cds.storage.SessionData;
import dev.vality.damsel.domain.BankCard; import dev.vality.damsel.domain.BankCard;
import dev.vality.damsel.domain.InvoiceDetails;
import dev.vality.damsel.domain.TransactionInfo; import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.*; import dev.vality.damsel.proxy_provider.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -26,6 +27,7 @@ import org.springframework.core.convert.converter.Converter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
@RequiredArgsConstructor @RequiredArgsConstructor
public class CtxToEntryModelConverter implements Converter<PaymentContext, EntryStateModel> { public class CtxToEntryModelConverter implements Converter<PaymentContext, EntryStateModel> {
@ -59,19 +61,21 @@ public class CtxToEntryModelConverter implements Converter<PaymentContext, Entry
TransactionInfo trx = payment.getTrx(); TransactionInfo trx = payment.getTrx();
RecurrentPaymentData recurrentPaymentData = initRecurrentPaymentData(payment, paymentResource, trx); RecurrentPaymentData recurrentPaymentData = initRecurrentPaymentData(payment, paymentResource, trx);
Map<String, String> adapterConfigurations = context.getOptions(); Map<String, String> adapterConfigurations = context.getOptions();
Invoice invoice = paymentInfo.getInvoice();
InvoiceDetails details = invoice.getDetails();
return EntryStateModel.builder() return EntryStateModel.builder()
.baseRequestModel(BaseRequestModel.builder().recurrentPaymentData(recurrentPaymentData) .baseRequestModel(BaseRequestModel.builder().recurrentPaymentData(recurrentPaymentData)
.mobilePaymentData(mobilePaymentData) .mobilePaymentData(mobilePaymentData)
.cardData(cardData) .cardData(cardData)
.refundData(initRefundData(paymentInfo)) .refundData(initRefundData(paymentInfo))
.paymentId(idGenerator.get(paymentInfo.getInvoice().getId())) .paymentId(idGenerator.get(invoice.getId()))
.createdAt(paymentInfo.getPayment().getCreatedAt()) .createdAt(paymentInfo.getPayment().getCreatedAt())
.currency(Currency.builder() .currency(Currency.builder()
.symbolicCode(payment.getCost().getCurrency().getSymbolicCode()) .symbolicCode(payment.getCost().getCurrency().getSymbolicCode())
.numericCode(payment.getCost().getCurrency().getNumericCode()) .numericCode(payment.getCost().getCurrency().getNumericCode())
.build() .build()
).amount(payment.getCost().getAmount()) ).amount(payment.getCost().getAmount())
.details(paymentInfo.getInvoice().getDetails().getDescription()) .details(Objects.requireNonNullElse(details.getDescription(), details.getProduct()))
.payerInfo(PayerInfo.builder() .payerInfo(PayerInfo.builder()
.ip(ProxyProviderPackageCreators.extractIpAddress(context)) .ip(ProxyProviderPackageCreators.extractIpAddress(context))
.build()) .build())