@Test public void testValidCompatibleTransactionSearch() { when(order.getPaymentTransactions()).thenReturn(Collections.singletonList(transaction1)); PaymentTransactionModel compatibleTransaction = defaultWirecardTransactionService .lookForCompatibleTransactions(order, provider1); assertNotNull("Should have found a compatible transaction", compatibleTransaction); assertEquals("Compatible transaction does not match", transaction1, compatibleTransaction); }
@Override public PaymentTransactionModel lookForCompatibleTransactions(final AbstractOrderModel abstractOrder, final String checkoutPaymentType) { final List<PaymentTransactionModel> listTransactions = abstractOrder.getPaymentTransactions(); return listTransactions.stream() .filter(transaction -> checkoutPaymentType.equalsIgnoreCase(transaction.getPaymentProvider())) .findFirst() .orElse(null); }
DefaultWirecardTransactionService implements WirecardTransactionService { @Override public PaymentTransactionModel lookForCompatibleTransactions(final AbstractOrderModel abstractOrder, final String checkoutPaymentType) { final List<PaymentTransactionModel> listTransactions = abstractOrder.getPaymentTransactions(); return listTransactions.stream() .filter(transaction -> checkoutPaymentType.equalsIgnoreCase(transaction.getPaymentProvider())) .findFirst() .orElse(null); } }
DefaultWirecardTransactionService implements WirecardTransactionService { @Override public PaymentTransactionModel lookForCompatibleTransactions(final AbstractOrderModel abstractOrder, final String checkoutPaymentType) { final List<PaymentTransactionModel> listTransactions = abstractOrder.getPaymentTransactions(); return listTransactions.stream() .filter(transaction -> checkoutPaymentType.equalsIgnoreCase(transaction.getPaymentProvider())) .findFirst() .orElse(null); }  }
DefaultWirecardTransactionService implements WirecardTransactionService { @Override public PaymentTransactionModel lookForCompatibleTransactions(final AbstractOrderModel abstractOrder, final String checkoutPaymentType) { final List<PaymentTransactionModel> listTransactions = abstractOrder.getPaymentTransactions(); return listTransactions.stream() .filter(transaction -> checkoutPaymentType.equalsIgnoreCase(transaction.getPaymentProvider())) .findFirst() .orElse(null); }  @Override PaymentTransactionModel createTransaction(WirecardTransactionData wirecardTransactionData); void calculateCart(final AbstractOrderModel abstractOrderModel); @Override PaymentTransactionEntryModel logTransactionData(WirecardTransactionData wirecardTransactionData); @Override PaymentTransactionModel lookForCompatibleTransactions(final AbstractOrderModel abstractOrder,
                                                                 final String checkoutPaymentType); @Override boolean lookForAcceptedTransactions(AbstractOrderModel abstractOrderModel, PaymentTransactionType paymentTransactionType); @Override String getParentTransactionIdToOperate(AbstractOrderModel abstractOrderModel, PaymentTransactionType paymentTransactionType); @Override PaymentTransactionEntryModel getNewestAcceptedTransactionEntry(PaymentTransactionModel paymentTransactionModel,
                                                                          PaymentTransactionType paymentTransactionType); @Override PaymentTransactionModel getPaymentTransaction(AbstractOrderModel abstractOrder); @Override TransactionStatus getTransactionStatus(Payment response); @Required void setModelService(final ModelService modelService); @Required void setWirecardPaymentService(WirecardPaymentService wirecardPaymentService); @Required void setCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService); @Required void setPaymentConverter(PaymentConverter paymentConverter); @Required void setMediaService(DefaultMediaService mediaService); }
DefaultWirecardTransactionService implements WirecardTransactionService { @Override public PaymentTransactionModel lookForCompatibleTransactions(final AbstractOrderModel abstractOrder, final String checkoutPaymentType) { final List<PaymentTransactionModel> listTransactions = abstractOrder.getPaymentTransactions(); return listTransactions.stream() .filter(transaction -> checkoutPaymentType.equalsIgnoreCase(transaction.getPaymentProvider())) .findFirst() .orElse(null); }  @Override PaymentTransactionModel createTransaction(WirecardTransactionData wirecardTransactionData); void calculateCart(final AbstractOrderModel abstractOrderModel); @Override PaymentTransactionEntryModel logTransactionData(WirecardTransactionData wirecardTransactionData); @Override PaymentTransactionModel lookForCompatibleTransactions(final AbstractOrderModel abstractOrder,
                                                                 final String checkoutPaymentType); @Override boolean lookForAcceptedTransactions(AbstractOrderModel abstractOrderModel, PaymentTransactionType paymentTransactionType); @Override String getParentTransactionIdToOperate(AbstractOrderModel abstractOrderModel, PaymentTransactionType paymentTransactionType); @Override PaymentTransactionEntryModel getNewestAcceptedTransactionEntry(PaymentTransactionModel paymentTransactionModel,
                                                                          PaymentTransactionType paymentTransactionType); @Override PaymentTransactionModel getPaymentTransaction(AbstractOrderModel abstractOrder); @Override TransactionStatus getTransactionStatus(Payment response); @Required void setModelService(final ModelService modelService); @Required void setWirecardPaymentService(WirecardPaymentService wirecardPaymentService); @Required void setCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService); @Required void setPaymentConverter(PaymentConverter paymentConverter); @Required void setMediaService(DefaultMediaService mediaService);  }