@Test public void execute_WhenExistingPendingCaptureEntry_ShouldReturnWAIT(){ when(worldpayPaymentTransactionServiceMock.areAllPaymentTransactionsAcceptedForType(orderMock, CAPTURE)).thenReturn(true); when(worldpayPaymentTransactionServiceMock.isPaymentTransactionPending(paymentTransactionMock, CAPTURE)).thenReturn(true); final String result = testObj.execute(processMock); assertEquals(WAIT, result); }
@Override public String execute(final OrderProcessModel process) { final OrderModel order = process.getOrder(); for (final PaymentTransactionModel paymentTransaction : order.getPaymentTransactions()) { final List<PaymentTransactionEntryModel> entries = worldpayPaymentTransactionService.filterPaymentTransactionEntriesOfType(paymentTransaction, CAPTURE); if (entries.isEmpty()) { return handleEmptyTransactionEntries(paymentTransaction); } else if (entries.size() != 1) { return handleMultipleTransactionEntries(process, order, paymentTransaction, entries); } if (checkForNotAccepted(order, paymentTransaction)) { return NOK; } if (checkForPendingStatus(order, paymentTransaction)) { return WAIT; } } setOrderStatus(order, PAYMENT_CAPTURED); return OK; }
WorldpayTakePaymentAction extends AbstractAction<OrderProcessModel> { @Override public String execute(final OrderProcessModel process) { final OrderModel order = process.getOrder(); for (final PaymentTransactionModel paymentTransaction : order.getPaymentTransactions()) { final List<PaymentTransactionEntryModel> entries = worldpayPaymentTransactionService.filterPaymentTransactionEntriesOfType(paymentTransaction, CAPTURE); if (entries.isEmpty()) { return handleEmptyTransactionEntries(paymentTransaction); } else if (entries.size() != 1) { return handleMultipleTransactionEntries(process, order, paymentTransaction, entries); } if (checkForNotAccepted(order, paymentTransaction)) { return NOK; } if (checkForPendingStatus(order, paymentTransaction)) { return WAIT; } } setOrderStatus(order, PAYMENT_CAPTURED); return OK; } }
WorldpayTakePaymentAction extends AbstractAction<OrderProcessModel> { @Override public String execute(final OrderProcessModel process) { final OrderModel order = process.getOrder(); for (final PaymentTransactionModel paymentTransaction : order.getPaymentTransactions()) { final List<PaymentTransactionEntryModel> entries = worldpayPaymentTransactionService.filterPaymentTransactionEntriesOfType(paymentTransaction, CAPTURE); if (entries.isEmpty()) { return handleEmptyTransactionEntries(paymentTransaction); } else if (entries.size() != 1) { return handleMultipleTransactionEntries(process, order, paymentTransaction, entries); } if (checkForNotAccepted(order, paymentTransaction)) { return NOK; } if (checkForPendingStatus(order, paymentTransaction)) { return WAIT; } } setOrderStatus(order, PAYMENT_CAPTURED); return OK; }  }
WorldpayTakePaymentAction extends AbstractAction<OrderProcessModel> { @Override public String execute(final OrderProcessModel process) { final OrderModel order = process.getOrder(); for (final PaymentTransactionModel paymentTransaction : order.getPaymentTransactions()) { final List<PaymentTransactionEntryModel> entries = worldpayPaymentTransactionService.filterPaymentTransactionEntriesOfType(paymentTransaction, CAPTURE); if (entries.isEmpty()) { return handleEmptyTransactionEntries(paymentTransaction); } else if (entries.size() != 1) { return handleMultipleTransactionEntries(process, order, paymentTransaction, entries); } if (checkForNotAccepted(order, paymentTransaction)) { return NOK; } if (checkForPendingStatus(order, paymentTransaction)) { return WAIT; } } setOrderStatus(order, PAYMENT_CAPTURED); return OK; }  @Override Set<String> getTransitions(); @Override String execute(final OrderProcessModel process); @Required void setPaymentService(final PaymentService paymentService); @Required void setWorldpayPaymentTransactionService(final WorldpayPaymentTransactionService worldpayPaymentTransactionService); }
WorldpayTakePaymentAction extends AbstractAction<OrderProcessModel> { @Override public String execute(final OrderProcessModel process) { final OrderModel order = process.getOrder(); for (final PaymentTransactionModel paymentTransaction : order.getPaymentTransactions()) { final List<PaymentTransactionEntryModel> entries = worldpayPaymentTransactionService.filterPaymentTransactionEntriesOfType(paymentTransaction, CAPTURE); if (entries.isEmpty()) { return handleEmptyTransactionEntries(paymentTransaction); } else if (entries.size() != 1) { return handleMultipleTransactionEntries(process, order, paymentTransaction, entries); } if (checkForNotAccepted(order, paymentTransaction)) { return NOK; } if (checkForPendingStatus(order, paymentTransaction)) { return WAIT; } } setOrderStatus(order, PAYMENT_CAPTURED); return OK; }  @Override Set<String> getTransitions(); @Override String execute(final OrderProcessModel process); @Required void setPaymentService(final PaymentService paymentService); @Required void setWorldpayPaymentTransactionService(final WorldpayPaymentTransactionService worldpayPaymentTransactionService);  }