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();
}
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();
}
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;
}
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;
}
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;
}
Aggregations