Search in sources :

Example 1 with PaySelectionId

use of de.metas.banking.PaySelectionId in project metasfresh-webui-api by metasfresh.

the class ReconcilePaymentsCommandTest method bankStatementLineIsLinkedToPaySelection.

@Test
public void bankStatementLineIsLinkedToPaySelection() {
    final BankStatementLineRow bankStatementLineRow = bankStatementLineRow().docStatus(DocStatus.Drafted).statementAmt(euro("1000")).build();
    final PaymentToReconcileRow paymentRow = paymentRow().inboundPayment(true).customerId(customerId).paymentAmt(euro("1000")).build();
    final PaymentId paymentId = paymentRow.getPaymentId();
    final PaySelectionId paySelectionId = createPaySelection();
    final I_C_PaySelectionLine paySelectionLine = createPaySelectionLine(paySelectionId, paymentId);
    assertThat(paySelectionLine.getC_Payment_ID()).isEqualTo(paymentId.getRepoId());
    assertThat(paySelectionLine.getC_BankStatement_ID()).isLessThanOrEqualTo(0);
    assertThat(paySelectionLine.getC_BankStatementLine_ID()).isLessThanOrEqualTo(0);
    assertThat(paySelectionLine.getC_BankStatementLine_Ref_ID()).isLessThanOrEqualTo(0);
    assertReconciled(paySelectionId).isFalse();
    executeReconcilePaymentsCommand(ReconcilePaymentsRequest.builder().selectedBankStatementLine(bankStatementLineRow).selectedPaymentToReconcile(paymentRow).build());
    InterfaceWrapperHelper.refresh(paySelectionLine);
    assertThat(paySelectionLine.getC_BankStatement_ID()).isGreaterThan(0);
    assertThat(paySelectionLine.getC_BankStatementLine_ID()).isEqualTo(bankStatementLineRow.getBankStatementLineId().getRepoId());
    assertThat(paySelectionLine.getC_BankStatementLine_Ref_ID()).isGreaterThan(0);
    assertReconciled(paySelectionId).isTrue();
}
Also used : PaymentId(de.metas.payment.PaymentId) PaySelectionId(de.metas.banking.PaySelectionId) BankStatementLineRow(de.metas.ui.web.bankstatement_reconciliation.BankStatementLineRow) PaymentToReconcileRow(de.metas.ui.web.bankstatement_reconciliation.PaymentToReconcileRow) I_C_PaySelectionLine(org.compiere.model.I_C_PaySelectionLine) Test(org.junit.jupiter.api.Test)

Aggregations

PaySelectionId (de.metas.banking.PaySelectionId)1 PaymentId (de.metas.payment.PaymentId)1 BankStatementLineRow (de.metas.ui.web.bankstatement_reconciliation.BankStatementLineRow)1 PaymentToReconcileRow (de.metas.ui.web.bankstatement_reconciliation.PaymentToReconcileRow)1 I_C_PaySelectionLine (org.compiere.model.I_C_PaySelectionLine)1 Test (org.junit.jupiter.api.Test)1