Search in sources :

Example 1 with I_C_Payment

use of org.compiere.model.I_C_Payment 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)

Example 2 with I_C_Payment

use of org.compiere.model.I_C_Payment in project metasfresh-webui-api by metasfresh.

the class PaymentsViewAllocateCommandTest method createPaymentRow.

@Builder(builderMethodName = "paymentRow", builderClassName = "PaymentRowBuilder")
private PaymentRow createPaymentRow(@NonNull final PaymentDirection direction, @NonNull final Amount payAmt) {
    final I_C_Payment paymentRecord = newInstance(I_C_Payment.class);
    saveRecord(paymentRecord);
    final PaymentId paymentId = PaymentId.ofRepoId(paymentRecord.getC_Payment_ID());
    return PaymentRow.builder().paymentId(paymentId).clientAndOrgId(ClientAndOrgId.ofClientAndOrg(ClientId.METASFRESH, orgId)).documentNo("paymentNo_" + paymentId.getRepoId()).dateTrx(LocalDate.of(2020, Month.APRIL, 25)).bpartner(IntegerLookupValue.of(bpartnerId.getRepoId(), "BPartner")).payAmt(payAmt).openAmt(payAmt).paymentDirection(direction).build();
}
Also used : I_C_Payment(org.compiere.model.I_C_Payment) PaymentId(de.metas.payment.PaymentId) Builder(lombok.Builder)

Aggregations

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