use of de.metas.payment.api.DefaultPaymentBuilder in project metasfresh-webui-api by metasfresh.
the class ReconcilePaymentsCommandTest method createPaymentRow.
@Builder(builderMethodName = "paymentRow", builderClassName = "PaymentRowBuilder")
private PaymentToReconcileRow createPaymentRow(@NonNull final Boolean inboundPayment, @NonNull final BPartnerId customerId, @NonNull final Money paymentAmt, final boolean reconciled) {
final DefaultPaymentBuilder builder = inboundPayment ? paymentBL.newInboundReceiptBuilder() : paymentBL.newOutboundPaymentBuilder();
final I_C_Payment payment = builder.adOrgId(OrgId.ANY).bpartnerId(customerId).orgBankAccountId(euroOrgBankAccountId).currencyId(paymentAmt.getCurrencyId()).payAmt(paymentAmt.toBigDecimal()).dateAcct(paymentDate).dateTrx(paymentDate).tenderType(TenderType.Check).createAndProcess();
payment.setDocumentNo("documentNo-" + payment.getC_Payment_ID());
paymentDAO.save(payment);
if (reconciled) {
paymentBL.markReconciledAndSave(payment);
}
final PaymentId paymentId = PaymentId.ofRepoId(payment.getC_Payment_ID());
return rowsRepo.getPaymentToReconcileRowsByIds(ImmutableSet.of(paymentId)).get(0);
}
Aggregations