Search in sources :

Example 1 with DefaultPaymentBuilder

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);
}
Also used : I_C_Payment(org.compiere.model.I_C_Payment) DefaultPaymentBuilder(de.metas.payment.api.DefaultPaymentBuilder) PaymentId(de.metas.payment.PaymentId) Builder(lombok.Builder) DefaultPaymentBuilder(de.metas.payment.api.DefaultPaymentBuilder)

Aggregations

PaymentId (de.metas.payment.PaymentId)1 DefaultPaymentBuilder (de.metas.payment.api.DefaultPaymentBuilder)1 Builder (lombok.Builder)1 I_C_Payment (org.compiere.model.I_C_Payment)1