Search in sources :

Example 6 with PaymentId

use of de.metas.payment.PaymentId 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)

Example 7 with PaymentId

use of de.metas.payment.PaymentId 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)

Example 8 with PaymentId

use of de.metas.payment.PaymentId in project metasfresh-webui-api by metasfresh.

the class PaymentView_Launcher_FromPayment method doIt.

@Override
protected String doIt() {
    final ImmutableSet<PaymentId> paymentIds = getSelectedPaymentIds();
    if (paymentIds.isEmpty()) {
        throw new AdempiereException("@NoSelection@");
    }
    final ViewId viewId = viewsFactory.createView(CreateViewRequest.builder(PaymentsViewFactory.WINDOW_ID).setFilterOnlyIds(PaymentId.toIntSet(paymentIds)).build()).getViewId();
    getResult().setWebuiViewToOpen(WebuiViewToOpen.builder().viewId(viewId.getViewId()).target(ViewOpenTarget.ModalOverlay).build());
    return MSG_OK;
}
Also used : AdempiereException(org.adempiere.exceptions.AdempiereException) PaymentId(de.metas.payment.PaymentId) ViewId(de.metas.ui.web.view.ViewId)

Example 9 with PaymentId

use of de.metas.payment.PaymentId in project metasfresh-webui-api by metasfresh.

the class PaymentView_Launcher_From_BPartnerView method doIt.

@Override
protected String doIt() {
    final ImmutableSet<PaymentId> paymentIds = retrievePaymentIds();
    if (paymentIds.isEmpty()) {
        throw new AdempiereException("@NoOpenPayments@").markAsUserValidationError();
    }
    final ViewId viewId = viewsFactory.createView(CreateViewRequest.builder(PaymentsViewFactory.WINDOW_ID).setFilterOnlyIds(PaymentId.toIntSet(paymentIds)).build()).getViewId();
    getResult().setWebuiViewToOpen(WebuiViewToOpen.builder().viewId(viewId.getViewId()).target(ViewOpenTarget.ModalOverlay).build());
    return MSG_OK;
}
Also used : AdempiereException(org.adempiere.exceptions.AdempiereException) PaymentId(de.metas.payment.PaymentId) ViewId(de.metas.ui.web.view.ViewId)

Example 10 with PaymentId

use of de.metas.payment.PaymentId in project metasfresh-webui-api by metasfresh.

the class C_BankStatement_AllocatePayment method doIt.

@Override
protected String doIt() {
    final ImmutableSet<PaymentId> paymentIds = retrievePaymentIds();
    if (paymentIds.isEmpty()) {
        throw new AdempiereException("@NoOpenPayments@").markAsUserValidationError();
    }
    final ViewId viewId = viewsFactory.createView(CreateViewRequest.builder(PaymentsViewFactory.WINDOW_ID).setFilterOnlyIds(PaymentId.toIntSet(paymentIds)).build()).getViewId();
    getResult().setWebuiViewToOpen(ProcessExecutionResult.WebuiViewToOpen.builder().viewId(viewId.getViewId()).target(ProcessExecutionResult.ViewOpenTarget.ModalOverlay).build());
    return MSG_OK;
}
Also used : AdempiereException(org.adempiere.exceptions.AdempiereException) PaymentId(de.metas.payment.PaymentId) ViewId(de.metas.ui.web.view.ViewId)

Aggregations

PaymentId (de.metas.payment.PaymentId)12 ViewId (de.metas.ui.web.view.ViewId)5 AdempiereException (org.adempiere.exceptions.AdempiereException)5 BankStatementLineRow (de.metas.ui.web.bankstatement_reconciliation.BankStatementLineRow)2 PaymentToReconcileRow (de.metas.ui.web.bankstatement_reconciliation.PaymentToReconcileRow)2 Builder (lombok.Builder)2 I_C_BankStatementLine (org.compiere.model.I_C_BankStatementLine)2 I_C_Payment (org.compiere.model.I_C_Payment)2 Test (org.junit.jupiter.api.Test)2 PaySelectionId (de.metas.banking.PaySelectionId)1 Amount (de.metas.currency.Amount)1 CurrencyCode (de.metas.currency.CurrencyCode)1 CurrencyId (de.metas.money.CurrencyId)1 DefaultPaymentBuilder (de.metas.payment.api.DefaultPaymentBuilder)1 I_ESR_ImportLine (de.metas.payment.esr.model.I_ESR_ImportLine)1 ProcessParamLookupValuesProvider (de.metas.ui.web.process.descriptor.ProcessParamLookupValuesProvider)1 FillMandatoryException (org.adempiere.exceptions.FillMandatoryException)1 I_C_BankStatement (org.compiere.model.I_C_BankStatement)1 I_C_PaySelectionLine (org.compiere.model.I_C_PaySelectionLine)1