@Test public void testNoTransactionsAuthorization() { when(orderModelMock.getPaymentTransactions()).thenReturn(new ArrayList<PaymentTransactionModel>()); String result = adyenCheckAuthorizationAction.execute(orderProcessModelMock); assertEquals(AdyenCheckAuthorizationAction.Transition.WAIT.toString(), result); }
@Override public String execute(final OrderProcessModel process) { LOG.debug("Process: " + process.getCode() + " in step " + getClass().getSimpleName()); final OrderModel order = process.getOrder(); if (order == null) { LOG.error("Order is null!"); return Transition.NOK.toString(); } final PaymentInfoModel paymentInfo = order.getPaymentInfo(); if (paymentInfo.getAdyenPaymentMethod() == null || paymentInfo.getAdyenPaymentMethod().isEmpty()) { LOG.debug("Not Adyen Payment"); return Transition.OK.toString(); } if (order.getPaymentTransactions().isEmpty()) { LOG.debug("Process: " + process.getCode() + " Order Waiting"); return Transition.WAIT.toString(); } boolean orderAuthorized = isOrderAuthorized(order); if (orderAuthorized) { LOG.debug("Process: " + process.getCode() + " Order Authorized"); order.setStatus(OrderStatus.PAYMENT_AUTHORIZED); modelService.save(order); return Transition.OK.toString(); } LOG.debug("Process: " + process.getCode() + " Order Not Authorized"); order.setStatus(OrderStatus.PAYMENT_NOT_AUTHORIZED); modelService.save(order); return Transition.NOK.toString(); }
AdyenCheckAuthorizationAction extends AbstractWaitableAction<OrderProcessModel> { @Override public String execute(final OrderProcessModel process) { LOG.debug("Process: " + process.getCode() + " in step " + getClass().getSimpleName()); final OrderModel order = process.getOrder(); if (order == null) { LOG.error("Order is null!"); return Transition.NOK.toString(); } final PaymentInfoModel paymentInfo = order.getPaymentInfo(); if (paymentInfo.getAdyenPaymentMethod() == null || paymentInfo.getAdyenPaymentMethod().isEmpty()) { LOG.debug("Not Adyen Payment"); return Transition.OK.toString(); } if (order.getPaymentTransactions().isEmpty()) { LOG.debug("Process: " + process.getCode() + " Order Waiting"); return Transition.WAIT.toString(); } boolean orderAuthorized = isOrderAuthorized(order); if (orderAuthorized) { LOG.debug("Process: " + process.getCode() + " Order Authorized"); order.setStatus(OrderStatus.PAYMENT_AUTHORIZED); modelService.save(order); return Transition.OK.toString(); } LOG.debug("Process: " + process.getCode() + " Order Not Authorized"); order.setStatus(OrderStatus.PAYMENT_NOT_AUTHORIZED); modelService.save(order); return Transition.NOK.toString(); } }
AdyenCheckAuthorizationAction extends AbstractWaitableAction<OrderProcessModel> { @Override public String execute(final OrderProcessModel process) { LOG.debug("Process: " + process.getCode() + " in step " + getClass().getSimpleName()); final OrderModel order = process.getOrder(); if (order == null) { LOG.error("Order is null!"); return Transition.NOK.toString(); } final PaymentInfoModel paymentInfo = order.getPaymentInfo(); if (paymentInfo.getAdyenPaymentMethod() == null || paymentInfo.getAdyenPaymentMethod().isEmpty()) { LOG.debug("Not Adyen Payment"); return Transition.OK.toString(); } if (order.getPaymentTransactions().isEmpty()) { LOG.debug("Process: " + process.getCode() + " Order Waiting"); return Transition.WAIT.toString(); } boolean orderAuthorized = isOrderAuthorized(order); if (orderAuthorized) { LOG.debug("Process: " + process.getCode() + " Order Authorized"); order.setStatus(OrderStatus.PAYMENT_AUTHORIZED); modelService.save(order); return Transition.OK.toString(); } LOG.debug("Process: " + process.getCode() + " Order Not Authorized"); order.setStatus(OrderStatus.PAYMENT_NOT_AUTHORIZED); modelService.save(order); return Transition.NOK.toString(); }  }
AdyenCheckAuthorizationAction extends AbstractWaitableAction<OrderProcessModel> { @Override public String execute(final OrderProcessModel process) { LOG.debug("Process: " + process.getCode() + " in step " + getClass().getSimpleName()); final OrderModel order = process.getOrder(); if (order == null) { LOG.error("Order is null!"); return Transition.NOK.toString(); } final PaymentInfoModel paymentInfo = order.getPaymentInfo(); if (paymentInfo.getAdyenPaymentMethod() == null || paymentInfo.getAdyenPaymentMethod().isEmpty()) { LOG.debug("Not Adyen Payment"); return Transition.OK.toString(); } if (order.getPaymentTransactions().isEmpty()) { LOG.debug("Process: " + process.getCode() + " Order Waiting"); return Transition.WAIT.toString(); } boolean orderAuthorized = isOrderAuthorized(order); if (orderAuthorized) { LOG.debug("Process: " + process.getCode() + " Order Authorized"); order.setStatus(OrderStatus.PAYMENT_AUTHORIZED); modelService.save(order); return Transition.OK.toString(); } LOG.debug("Process: " + process.getCode() + " Order Not Authorized"); order.setStatus(OrderStatus.PAYMENT_NOT_AUTHORIZED); modelService.save(order); return Transition.NOK.toString(); }  @Override String execute(final OrderProcessModel process); }
AdyenCheckAuthorizationAction extends AbstractWaitableAction<OrderProcessModel> { @Override public String execute(final OrderProcessModel process) { LOG.debug("Process: " + process.getCode() + " in step " + getClass().getSimpleName()); final OrderModel order = process.getOrder(); if (order == null) { LOG.error("Order is null!"); return Transition.NOK.toString(); } final PaymentInfoModel paymentInfo = order.getPaymentInfo(); if (paymentInfo.getAdyenPaymentMethod() == null || paymentInfo.getAdyenPaymentMethod().isEmpty()) { LOG.debug("Not Adyen Payment"); return Transition.OK.toString(); } if (order.getPaymentTransactions().isEmpty()) { LOG.debug("Process: " + process.getCode() + " Order Waiting"); return Transition.WAIT.toString(); } boolean orderAuthorized = isOrderAuthorized(order); if (orderAuthorized) { LOG.debug("Process: " + process.getCode() + " Order Authorized"); order.setStatus(OrderStatus.PAYMENT_AUTHORIZED); modelService.save(order); return Transition.OK.toString(); } LOG.debug("Process: " + process.getCode() + " Order Not Authorized"); order.setStatus(OrderStatus.PAYMENT_NOT_AUTHORIZED); modelService.save(order); return Transition.NOK.toString(); }  @Override String execute(final OrderProcessModel process);  }