From b0b410cef24c7bf6c2776753b4a59e3b3326e601 Mon Sep 17 00:00:00 2001 From: Inal Arsanukaev Date: Tue, 24 May 2022 12:22:40 +0300 Subject: [PATCH] Fill 'details' with 'product' if 'description' is null (#35) Co-authored-by: Inal Arsanukaev --- pom.xml | 2 +- .../lib/converter/entry/CtxToEntryModelConverter.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 32a42d6..6a42042 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ adapter-flow-lib - 0.1.6 + 0.1.7 jar adapter-flow-lib diff --git a/src/main/java/dev/vality/adapter/flow/lib/converter/entry/CtxToEntryModelConverter.java b/src/main/java/dev/vality/adapter/flow/lib/converter/entry/CtxToEntryModelConverter.java index 53187ea..ef8d902 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/converter/entry/CtxToEntryModelConverter.java +++ b/src/main/java/dev/vality/adapter/flow/lib/converter/entry/CtxToEntryModelConverter.java @@ -19,6 +19,7 @@ import dev.vality.cds.storage.Auth3DS; import dev.vality.cds.storage.CardData; import dev.vality.cds.storage.SessionData; import dev.vality.damsel.domain.BankCard; +import dev.vality.damsel.domain.InvoiceDetails; import dev.vality.damsel.domain.TransactionInfo; import dev.vality.damsel.proxy_provider.*; import lombok.RequiredArgsConstructor; @@ -26,6 +27,7 @@ import org.springframework.core.convert.converter.Converter; import java.util.HashMap; import java.util.Map; +import java.util.Objects; @RequiredArgsConstructor public class CtxToEntryModelConverter implements Converter { @@ -59,19 +61,21 @@ public class CtxToEntryModelConverter implements Converter adapterConfigurations = context.getOptions(); + Invoice invoice = paymentInfo.getInvoice(); + InvoiceDetails details = invoice.getDetails(); return EntryStateModel.builder() .baseRequestModel(BaseRequestModel.builder().recurrentPaymentData(recurrentPaymentData) .mobilePaymentData(mobilePaymentData) .cardData(cardData) .refundData(initRefundData(paymentInfo)) - .paymentId(idGenerator.get(paymentInfo.getInvoice().getId())) + .paymentId(idGenerator.get(invoice.getId())) .createdAt(paymentInfo.getPayment().getCreatedAt()) .currency(Currency.builder() .symbolicCode(payment.getCost().getCurrency().getSymbolicCode()) .numericCode(payment.getCost().getCurrency().getNumericCode()) .build() ).amount(payment.getCost().getAmount()) - .details(paymentInfo.getInvoice().getDetails().getDescription()) + .details(Objects.requireNonNullElse(details.getDescription(), details.getProduct())) .payerInfo(PayerInfo.builder() .ip(ProxyProviderPackageCreators.extractIpAddress(context)) .build())