@Test public void testHandleStandardPaymentOkOfflineAuth() throws Exception { String label = assertPgFeatures("courierPaymentGateway", false, false, true, true); CustomerOrder customerOrder = createTestOrder(AbstractEventHandlerImplTest.TestOrderType.STANDARD, label, false); assertTrue(pendingHandler.handle( new OrderEventImpl("", customerOrder, null, Collections.EMPTY_MAP))); assertTrue(handler.handle( new OrderEventImpl("", customerOrder, null, Collections.singletonMap("refundNotificationAmount", customerOrder.getOrderTotal())))); assertInventory(WAREHOUSE_ID, "CC_TEST1", "9.00", "2.00"); assertInventory(WAREHOUSE_ID, "CC_TEST2", "1.00", "1.00"); assertDeliveryStates(customerOrder.getDelivery(), CustomerOrderDelivery.DELIVERY_STATUS_INVENTORY_RESERVED); assertNoPaymentEntries(customerOrder.getOrdernum()); assertEquals("689.74", customerOrder.getOrderTotal().toPlainString()); assertEquals("0.00", paymentService.getOrderAmount(customerOrder.getOrdernum()).toPlainString()); assertEquals(CustomerOrder.ORDER_STATUS_WAITING, customerOrder.getOrderStatus()); assertTrue(cancelHandler.handle( new OrderEventImpl("", customerOrder, null, Collections.EMPTY_MAP))); assertInventory(WAREHOUSE_ID, "CC_TEST1", "9.00", "0.00"); assertInventory(WAREHOUSE_ID, "CC_TEST2", "1.00", "0.00"); assertDeliveryStates(customerOrder.getDelivery(), CustomerOrderDelivery.DELIVERY_STATUS_INVENTORY_VOID_RESERVATION); assertNoPaymentEntries(customerOrder.getOrdernum()); assertEquals("689.74", customerOrder.getOrderTotal().toPlainString()); assertEquals("0.00", paymentService.getOrderAmount(customerOrder.getOrdernum()).toPlainString()); assertEquals(CustomerOrder.ORDER_STATUS_CANCELLED, customerOrder.getOrderStatus()); }
@Override public boolean handle(final OrderEvent orderEvent) throws OrderException { synchronized (OrderEventHandler.syncMonitor) { final CustomerOrder order = orderEvent.getCustomerOrder(); final Shop pgShop = order.getShop().getMaster() != null ? order.getShop().getMaster() : order.getShop(); final PaymentProcessor paymentProcessor = paymentProcessorFactory.create(order.getPgLabel(), pgShop.getCode()); if (!paymentProcessor.isPaymentGatewayEnabled()) { throw new PGDisabledException("PG " + order.getPgLabel() + " is disabled in " + order.getShop().getCode(), order.getPgLabel()); } if (paymentProcessor.getPaymentGateway().getPaymentGatewayFeatures().isOnlineGateway()) { final String state = paymentProcessor.refundNotification(orderEvent.getCustomerOrder(), isForceProcessing(orderEvent), orderEvent.getParams()); if (Payment.PAYMENT_STATUS_OK.equals(state)) { LOG.info("Received refund notification for order {}", orderEvent.getCustomerOrder().getOrdernum()); } } return true; } }
ExternalRefundOrderEventHandlerImpl extends AbstractOrderEventHandlerImpl implements OrderEventHandler { @Override public boolean handle(final OrderEvent orderEvent) throws OrderException { synchronized (OrderEventHandler.syncMonitor) { final CustomerOrder order = orderEvent.getCustomerOrder(); final Shop pgShop = order.getShop().getMaster() != null ? order.getShop().getMaster() : order.getShop(); final PaymentProcessor paymentProcessor = paymentProcessorFactory.create(order.getPgLabel(), pgShop.getCode()); if (!paymentProcessor.isPaymentGatewayEnabled()) { throw new PGDisabledException("PG " + order.getPgLabel() + " is disabled in " + order.getShop().getCode(), order.getPgLabel()); } if (paymentProcessor.getPaymentGateway().getPaymentGatewayFeatures().isOnlineGateway()) { final String state = paymentProcessor.refundNotification(orderEvent.getCustomerOrder(), isForceProcessing(orderEvent), orderEvent.getParams()); if (Payment.PAYMENT_STATUS_OK.equals(state)) { LOG.info("Received refund notification for order {}", orderEvent.getCustomerOrder().getOrdernum()); } } return true; } } }
ExternalRefundOrderEventHandlerImpl extends AbstractOrderEventHandlerImpl implements OrderEventHandler { @Override public boolean handle(final OrderEvent orderEvent) throws OrderException { synchronized (OrderEventHandler.syncMonitor) { final CustomerOrder order = orderEvent.getCustomerOrder(); final Shop pgShop = order.getShop().getMaster() != null ? order.getShop().getMaster() : order.getShop(); final PaymentProcessor paymentProcessor = paymentProcessorFactory.create(order.getPgLabel(), pgShop.getCode()); if (!paymentProcessor.isPaymentGatewayEnabled()) { throw new PGDisabledException("PG " + order.getPgLabel() + " is disabled in " + order.getShop().getCode(), order.getPgLabel()); } if (paymentProcessor.getPaymentGateway().getPaymentGatewayFeatures().isOnlineGateway()) { final String state = paymentProcessor.refundNotification(orderEvent.getCustomerOrder(), isForceProcessing(orderEvent), orderEvent.getParams()); if (Payment.PAYMENT_STATUS_OK.equals(state)) { LOG.info("Received refund notification for order {}", orderEvent.getCustomerOrder().getOrdernum()); } } return true; } } ExternalRefundOrderEventHandlerImpl(final PaymentProcessorFactory paymentProcessorFactory); }
ExternalRefundOrderEventHandlerImpl extends AbstractOrderEventHandlerImpl implements OrderEventHandler { @Override public boolean handle(final OrderEvent orderEvent) throws OrderException { synchronized (OrderEventHandler.syncMonitor) { final CustomerOrder order = orderEvent.getCustomerOrder(); final Shop pgShop = order.getShop().getMaster() != null ? order.getShop().getMaster() : order.getShop(); final PaymentProcessor paymentProcessor = paymentProcessorFactory.create(order.getPgLabel(), pgShop.getCode()); if (!paymentProcessor.isPaymentGatewayEnabled()) { throw new PGDisabledException("PG " + order.getPgLabel() + " is disabled in " + order.getShop().getCode(), order.getPgLabel()); } if (paymentProcessor.getPaymentGateway().getPaymentGatewayFeatures().isOnlineGateway()) { final String state = paymentProcessor.refundNotification(orderEvent.getCustomerOrder(), isForceProcessing(orderEvent), orderEvent.getParams()); if (Payment.PAYMENT_STATUS_OK.equals(state)) { LOG.info("Received refund notification for order {}", orderEvent.getCustomerOrder().getOrdernum()); } } return true; } } ExternalRefundOrderEventHandlerImpl(final PaymentProcessorFactory paymentProcessorFactory); @Override boolean handle(final OrderEvent orderEvent); }
ExternalRefundOrderEventHandlerImpl extends AbstractOrderEventHandlerImpl implements OrderEventHandler { @Override public boolean handle(final OrderEvent orderEvent) throws OrderException { synchronized (OrderEventHandler.syncMonitor) { final CustomerOrder order = orderEvent.getCustomerOrder(); final Shop pgShop = order.getShop().getMaster() != null ? order.getShop().getMaster() : order.getShop(); final PaymentProcessor paymentProcessor = paymentProcessorFactory.create(order.getPgLabel(), pgShop.getCode()); if (!paymentProcessor.isPaymentGatewayEnabled()) { throw new PGDisabledException("PG " + order.getPgLabel() + " is disabled in " + order.getShop().getCode(), order.getPgLabel()); } if (paymentProcessor.getPaymentGateway().getPaymentGatewayFeatures().isOnlineGateway()) { final String state = paymentProcessor.refundNotification(orderEvent.getCustomerOrder(), isForceProcessing(orderEvent), orderEvent.getParams()); if (Payment.PAYMENT_STATUS_OK.equals(state)) { LOG.info("Received refund notification for order {}", orderEvent.getCustomerOrder().getOrdernum()); } } return true; } } ExternalRefundOrderEventHandlerImpl(final PaymentProcessorFactory paymentProcessorFactory); @Override boolean handle(final OrderEvent orderEvent);  }