diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/builder/PaymentInstructionBuilder.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/builder/PaymentInstructionBuilder.java index 80479f8c9..e259cef2a 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/builder/PaymentInstructionBuilder.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/builder/PaymentInstructionBuilder.java @@ -11,12 +11,15 @@ import ru.spcex.platform.enumeration.InOutDirection; import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.api.ImdgProvider; +import java.time.Instant; +import java.time.LocalDate; import java.util.Map; public class PaymentInstructionBuilder { private Registry registry; private ImdgProvider imdgProvider; + private Long sessionId; public static PaymentInstructionBuilder builder(ImdgProvider imdgProvider, Registry registry) { return new PaymentInstructionBuilder(imdgProvider, registry); @@ -27,6 +30,11 @@ public class PaymentInstructionBuilder { this.registry = registry; } + public PaymentInstructionBuilder sessionId(Long sessionId) { + this.sessionId = sessionId; + return this; + } + public PaymentInstruction build() { PaymentInstruction paymentInstruction = new PaymentInstruction(); paymentInstruction.setSenderId(registry.getCompanyId()); @@ -67,9 +75,21 @@ public class PaymentInstructionBuilder { } paymentInstruction.setDebitLeg_accountId(registry.getAccountId()); + +// Imdg depoAccountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class); + account = accountImdg.getSingleObjectByID(paymentInstruction.getDebitLeg_accountId()); + if (account != null) { + paymentInstruction.setDebitLeg_account(account.getAccount()); + } + + paymentInstruction.setCreditLeg_direction(InOutDirection.out.getKey()); paymentInstruction.setDebitLeg_direction(InOutDirection.in.getKey()); -// Account account = accountImdg.getSingleObjectByID(registry.get()); -// paymentInstruction.setDebitLeg_account(); + + + paymentInstruction.setTransactionStatus("STLD"); + paymentInstruction.setCreated(Instant.now()); + paymentInstruction.setClearingDate(LocalDate.now()); + return paymentInstruction; } }