This commit is contained in:
AKurakin 2023-02-09 16:50:40 +03:00
parent a984876d84
commit 0a1857ead8
3 changed files with 23 additions and 2 deletions

View file

@ -10,8 +10,10 @@ import ru.spcex.platform.utils.time.TimeUtil;
import java.time.Instant;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class Sdf03Builder {
protected static final DateTimeFormatter PROPERTY_DATE_FORMATTER_YY = DateTimeFormatter.ofPattern("dd.MM.yy");
private final Imdg<Company> companyImdg;
public Sdf03Builder(Imdg<Company> companyImdg) {
@ -70,7 +72,7 @@ public class Sdf03Builder {
}
LocalDate paymtDt = TimeUtil.toLocalDate(paymentInstruction.getPaymentDate());
if (paymtDt != null) {
sDf03.setPay_date(paymtDt.format(TimeUtil.PROPERTY_DATE_FORMATTER));
sDf03.setPay_date(paymtDt.format(PROPERTY_DATE_FORMATTER_YY));
}
sDf03.setPay_val("RUR");
sDf03.setSum_deb(paymentInstruction.getDebitLegAmount() != null ? paymentInstruction.getDebitLegAmount().toString() : null);

View file

@ -11,6 +11,8 @@ import ru.spcex.platform.utils.time.TimeUtil;
import java.time.Instant;
import java.time.LocalDate;
import static ru.spcex.clearing.service.builder.Sdf03Builder.PROPERTY_DATE_FORMATTER_YY;
public class Sdf11Builder {
private final Imdg<Company> companyImdg;
@ -67,7 +69,7 @@ public class Sdf11Builder {
}
LocalDate paymtDt = TimeUtil.toLocalDate(paymentInstruction.getPaymentDate());
if (paymtDt != null) {
sDf11.setPay_date(paymtDt.format(TimeUtil.PROPERTY_DATE_FORMATTER));
sDf11.setPay_date(paymtDt.format(PROPERTY_DATE_FORMATTER_YY));
}
sDf11.setPay_val("RUR");
sDf11.setSum_deb(paymentInstruction.getDebitLegAmount() != null ? paymentInstruction.getDebitLegAmount().toString() : null);

View file

@ -0,0 +1,17 @@
package ru.spcex.clearing.service.builder;
import org.junit.jupiter.api.Test;
import ru.spcex.platform.utils.time.TimeUtil;
import java.time.LocalDate;
import static org.junit.jupiter.api.Assertions.*;
class Sdf03BuilderTest {
@Test
void buildSdf03() {
LocalDate paymtDt = LocalDate.of(2023, 1, 20);
assertEquals("20.01.23", paymtDt.format(Sdf03Builder.PROPERTY_DATE_FORMATTER_YY));
}
}