@Test public void shouldCreatePendingAuthorizationPaymentTransactionEntry() { when(paymentTransactionModelMock.getCode()).thenReturn(TRANSACTION_ENTRY_CODE); final PaymentTransactionEntryModel result = testObj.createPendingAuthorisePaymentTransactionEntry(paymentTransactionModelMock, REQUEST_TOKEN, cartModelMock, bigDecimalMock); verify(result).setType(AUTHORIZATION); verify(result).setRequestId(WORLDPAY_ORDER_CODE); verify(result).setRequestToken(REQUEST_TOKEN); verify(result).setTransactionStatus(ACCEPTED.name()); verify(result).setTransactionStatusDetails(SUCCESFULL.name()); verify(result).setCode(TRANSACTION_ENTRY_CODE); verify(result, never()).setPending(anyBoolean()); verify(modelServiceMock).save(result); verify(modelServiceMock).refresh(paymentTransactionModelMock); }
@Override public PaymentTransactionEntryModel createPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction, final String merchantCode, final CartModel cartModel, final BigDecimal authorisedAmount) { final PaymentTransactionEntryModel transactionEntryModel = createAuthorizationPaymentTransactionEntryModel(paymentTransaction, merchantCode, cartModel, authorisedAmount); modelService.save(transactionEntryModel); modelService.refresh(paymentTransaction); return transactionEntryModel; }
DefaultWorldpayPaymentTransactionService implements WorldpayPaymentTransactionService { @Override public PaymentTransactionEntryModel createPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction, final String merchantCode, final CartModel cartModel, final BigDecimal authorisedAmount) { final PaymentTransactionEntryModel transactionEntryModel = createAuthorizationPaymentTransactionEntryModel(paymentTransaction, merchantCode, cartModel, authorisedAmount); modelService.save(transactionEntryModel); modelService.refresh(paymentTransaction); return transactionEntryModel; } }
DefaultWorldpayPaymentTransactionService implements WorldpayPaymentTransactionService { @Override public PaymentTransactionEntryModel createPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction, final String merchantCode, final CartModel cartModel, final BigDecimal authorisedAmount) { final PaymentTransactionEntryModel transactionEntryModel = createAuthorizationPaymentTransactionEntryModel(paymentTransaction, merchantCode, cartModel, authorisedAmount); modelService.save(transactionEntryModel); modelService.refresh(paymentTransaction); return transactionEntryModel; }  }
DefaultWorldpayPaymentTransactionService implements WorldpayPaymentTransactionService { @Override public PaymentTransactionEntryModel createPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction, final String merchantCode, final CartModel cartModel, final BigDecimal authorisedAmount) { final PaymentTransactionEntryModel transactionEntryModel = createAuthorizationPaymentTransactionEntryModel(paymentTransaction, merchantCode, cartModel, authorisedAmount); modelService.save(transactionEntryModel); modelService.refresh(paymentTransaction); return transactionEntryModel; }  @Override boolean areAllPaymentTransactionsAcceptedForType(final OrderModel order, final PaymentTransactionType paymentTransactionType); @Override boolean isAnyPaymentTransactionApmOpenForOrder(final OrderModel order); @Override boolean isPaymentTransactionPending(final PaymentTransactionModel paymentTransaction, final PaymentTransactionType paymentTransactionType); @Override List<PaymentTransactionEntryModel> filterPaymentTransactionEntriesOfType(final PaymentTransactionModel paymentTransaction,
                                                                                    final PaymentTransactionType paymentTransactionType); @Override List<PaymentTransactionEntryModel> getPendingPaymentTransactionEntriesForType(final PaymentTransactionModel paymentTransactionModel,
                                                                                         final PaymentTransactionType paymentTransactionType); @Override List<PaymentTransactionEntryModel> getNotPendingPaymentTransactionEntriesForType(final PaymentTransactionModel paymentTransactionModel,
                                                                                            final PaymentTransactionType paymentTransactionType); @Override boolean isPreviousTransactionCompleted(final String worldpayOrderCode, final PaymentTransactionType paymentTransactionType, final OrderModel orderModel); @Override PaymentTransactionEntryModel createCapturedPaymentTransactionEntry(final PaymentTransactionModel paymentTransaction, final OrderNotificationMessage orderNotificationMessage); @Override PaymentTransactionEntryModel createPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction,
                                                                                      final String merchantCode,
                                                                                      final CartModel cartModel,
                                                                                      final BigDecimal authorisedAmount); @Override PaymentTransactionEntryModel createNonPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction,
                                                                                         final String merchantCode,
                                                                                         final AbstractOrderModel abstractOrderModel,
                                                                                         final BigDecimal authorisedAmount); @Override PaymentTransactionModel createPaymentTransaction(final boolean apmOpen, final String merchantCode, final CommerceCheckoutParameter commerceCheckoutParameter); @Override PaymentTransactionModel getPaymentTransactionFromCode(final String transactionCode); @Override void updateEntriesStatus(final List<PaymentTransactionEntryModel> paymentTransactionEntries, final String transactionStatus); @Override void addRiskScore(final PaymentTransactionModel paymentTransactionModel, final PaymentReply paymentReply); @Override void addAavFields(final PaymentTransactionEntryModel paymentTransactionEntryModel, final PaymentReply paymentReply); @Override void updateEntriesAmount(final List<PaymentTransactionEntryModel> transactionEntries, final Amount amount); @Override boolean isAuthorisedAmountCorrect(final OrderModel order); @Override PaymentTransactionEntryModel createNotPendingCancelOrderTransactionEntry(final PaymentTransactionModel paymentTransactionModel); @Override PaymentTransactionEntryModel createNotPendingSettledPaymentTransactionEntry(final PaymentTransactionModel paymentTransactionModel, final OrderNotificationMessage orderNotificationMessage); @Required void setPaymentTransactionDependency(final Map<PaymentTransactionType, PaymentTransactionType> paymentTransactionDependency); @Required void setCommonI18NService(final CommonI18NService commonI18NService); @Required void setModelService(final ModelService modelService); @Required void setEntryCodeStrategy(final EntryCodeStrategy entryCodeStrategy); @Required void setWorldpayPaymentTransactionDao(final WorldpayPaymentTransactionDao worldpayPaymentTransactionDao); @Required void setWorldpayRiskScoreConverter(final Converter<RiskScore, WorldpayRiskScoreModel> worldpayRiskScoreConverter); @Required void setWorldpayAavResponsePopulator(final Populator<PaymentReply, WorldpayAavResponseModel> worldpayAavResponsePopulator); @Required void setConfigurationService(final ConfigurationService configurationService); @Required void setWorldpayOrderService(final WorldpayOrderService worldpayOrderService); @Required void setWorldpayBankConfigurationService(final WorldpayBankConfigurationLookupService worldpayBankConfigurationService); }
DefaultWorldpayPaymentTransactionService implements WorldpayPaymentTransactionService { @Override public PaymentTransactionEntryModel createPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction, final String merchantCode, final CartModel cartModel, final BigDecimal authorisedAmount) { final PaymentTransactionEntryModel transactionEntryModel = createAuthorizationPaymentTransactionEntryModel(paymentTransaction, merchantCode, cartModel, authorisedAmount); modelService.save(transactionEntryModel); modelService.refresh(paymentTransaction); return transactionEntryModel; }  @Override boolean areAllPaymentTransactionsAcceptedForType(final OrderModel order, final PaymentTransactionType paymentTransactionType); @Override boolean isAnyPaymentTransactionApmOpenForOrder(final OrderModel order); @Override boolean isPaymentTransactionPending(final PaymentTransactionModel paymentTransaction, final PaymentTransactionType paymentTransactionType); @Override List<PaymentTransactionEntryModel> filterPaymentTransactionEntriesOfType(final PaymentTransactionModel paymentTransaction,
                                                                                    final PaymentTransactionType paymentTransactionType); @Override List<PaymentTransactionEntryModel> getPendingPaymentTransactionEntriesForType(final PaymentTransactionModel paymentTransactionModel,
                                                                                         final PaymentTransactionType paymentTransactionType); @Override List<PaymentTransactionEntryModel> getNotPendingPaymentTransactionEntriesForType(final PaymentTransactionModel paymentTransactionModel,
                                                                                            final PaymentTransactionType paymentTransactionType); @Override boolean isPreviousTransactionCompleted(final String worldpayOrderCode, final PaymentTransactionType paymentTransactionType, final OrderModel orderModel); @Override PaymentTransactionEntryModel createCapturedPaymentTransactionEntry(final PaymentTransactionModel paymentTransaction, final OrderNotificationMessage orderNotificationMessage); @Override PaymentTransactionEntryModel createPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction,
                                                                                      final String merchantCode,
                                                                                      final CartModel cartModel,
                                                                                      final BigDecimal authorisedAmount); @Override PaymentTransactionEntryModel createNonPendingAuthorisePaymentTransactionEntry(final PaymentTransactionModel paymentTransaction,
                                                                                         final String merchantCode,
                                                                                         final AbstractOrderModel abstractOrderModel,
                                                                                         final BigDecimal authorisedAmount); @Override PaymentTransactionModel createPaymentTransaction(final boolean apmOpen, final String merchantCode, final CommerceCheckoutParameter commerceCheckoutParameter); @Override PaymentTransactionModel getPaymentTransactionFromCode(final String transactionCode); @Override void updateEntriesStatus(final List<PaymentTransactionEntryModel> paymentTransactionEntries, final String transactionStatus); @Override void addRiskScore(final PaymentTransactionModel paymentTransactionModel, final PaymentReply paymentReply); @Override void addAavFields(final PaymentTransactionEntryModel paymentTransactionEntryModel, final PaymentReply paymentReply); @Override void updateEntriesAmount(final List<PaymentTransactionEntryModel> transactionEntries, final Amount amount); @Override boolean isAuthorisedAmountCorrect(final OrderModel order); @Override PaymentTransactionEntryModel createNotPendingCancelOrderTransactionEntry(final PaymentTransactionModel paymentTransactionModel); @Override PaymentTransactionEntryModel createNotPendingSettledPaymentTransactionEntry(final PaymentTransactionModel paymentTransactionModel, final OrderNotificationMessage orderNotificationMessage); @Required void setPaymentTransactionDependency(final Map<PaymentTransactionType, PaymentTransactionType> paymentTransactionDependency); @Required void setCommonI18NService(final CommonI18NService commonI18NService); @Required void setModelService(final ModelService modelService); @Required void setEntryCodeStrategy(final EntryCodeStrategy entryCodeStrategy); @Required void setWorldpayPaymentTransactionDao(final WorldpayPaymentTransactionDao worldpayPaymentTransactionDao); @Required void setWorldpayRiskScoreConverter(final Converter<RiskScore, WorldpayRiskScoreModel> worldpayRiskScoreConverter); @Required void setWorldpayAavResponsePopulator(final Populator<PaymentReply, WorldpayAavResponseModel> worldpayAavResponsePopulator); @Required void setConfigurationService(final ConfigurationService configurationService); @Required void setWorldpayOrderService(final WorldpayOrderService worldpayOrderService); @Required void setWorldpayBankConfigurationService(final WorldpayBankConfigurationLookupService worldpayBankConfigurationService);  }