Add currency and refactor

This commit is contained in:
Kostya Struga 2022-03-15 16:30:34 +03:00
parent 269ad48785
commit 0d907650a3
5 changed files with 40 additions and 7 deletions

View File

@ -1 +1,2 @@
### Конфигурация Spring Boot?

View File

@ -66,8 +66,11 @@ public class CtxToEntryModelConverter implements Converter<PaymentContext, Entry
.refundData(initRefundData(paymentInfo))
.paymentId(idGenerator.get(paymentInfo.getInvoice().getId()))
.createdAt(paymentInfo.getPayment().getCreatedAt())
.currency(payment.getCost().getCurrency().getSymbolicCode())
.amount(payment.getCost().getAmount())
.currency(Currency.builder()
.symbolicCode(payment.getCost().getCurrency().getSymbolicCode())
.numericCode(payment.getCost().getCurrency().getNumericCode())
.build()
).amount(payment.getCost().getAmount())
.details(paymentInfo.getInvoice().getDetails().getDescription())
.payerInfo(PayerInfo.builder()
.ip(ProxyProviderPackageCreators.extractIpAddress(context))

View File

@ -65,7 +65,13 @@ public class RecCtxToEntryModelConverter implements Converter<RecurrentTokenCont
.cardData(cardData)
.refundData(initRefundData(recurrentPaymentTool, orderId))
.paymentId(orderId)
.currency(recurrentPaymentTool.getMinimalPaymentCost().getCurrency().getSymbolicCode())
.currency(Currency.builder()
.symbolicCode(
recurrentPaymentTool.getMinimalPaymentCost().getCurrency().getSymbolicCode())
.numericCode(
recurrentPaymentTool.getMinimalPaymentCost().getCurrency().getNumericCode())
.build()
)
.amount(recurrentPaymentTool.getMinimalPaymentCost().getAmount())
.details(recurrentPaymentTool.getId())
.payerInfo(PayerInfo.builder()

View File

@ -17,7 +17,7 @@ import java.util.Map;
public class BaseRequestModel {
/**
* Uniq Long identifier for payment.
* Uniq Long identifier for payment.
*/
private Long paymentId;
/**
@ -29,12 +29,12 @@ public class BaseRequestModel {
*/
private Long amount;
/**
* Currency in symbolic formats (example: "USD").
* Code and symbolic code of currency.
*/
private String currency;
private Currency currency;
/**
* Timestamp RFC 3339.
*
* <p>
* The string must contain the date and time in UTC in the following format:
* `2016-03-22T06:12:27Z`
*/

View File

@ -0,0 +1,23 @@
package dev.vality.adapter.flow.lib.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class Currency {
/**
* Currency in symbolic formats (example: "USD").
*/
private String symbolicCode;
/**
* Currency in symbolic formats (example: "USD").
*/
private Short numericCode;
}