/** Ensure logging of order payment refund with payment token has correct format. */ @Test public void ensureLoggingOfOrderPaymentRefundWithPaymentTokenHasCorrectFormat() { Order order = createBlankOrderWithLocale(); orderEventHelper.logOrderPaymentRefund(order, createPaymentTokenRefundOrderPayment()); OrderEvent refundOrderEvent = getSingleOrderEventFromOrder(order); String refundEventNote = refundOrderEvent.getNote(); assertNoteIsRefund(refundEventNote); assertThatNoteIsForPaymentToken(refundEventNote); assertThatNoteHasFormattedAmount(refundEventNote); }
/** Ensure logging of order payment capture with gift certificate has correct format. */ @Test public void ensureLoggingOfOrderPaymentCaptureWithGiftCertificateHasCorrectFormat() { Order order = createBlankOrderWithLocale(); orderEventHelper.logOrderPaymentCaptured(order, createGiftCertificateCaptureOrderPayment()); OrderEvent refundOrderEvent = getSingleOrderEventFromOrder(order); String captureEventNote = refundOrderEvent.getNote(); assertThatNoteIsCapture(captureEventNote); assertThatNoteIsForGiftCertificate(captureEventNote); assertThatNoteHasFormattedAmount(captureEventNote); }
/** Test logging when order shipment method is changed. */ @Test public void testLogOrderShipmentMethodChanged() { // Given final ShippingServiceLevelImpl serviceLevel = createShippingServiceLevel(); PhysicalOrderShipment physicalShipment = new PhysicalOrderShipmentImpl(); physicalShipment.setShippingServiceLevelGuid(serviceLevel.getGuid()); // Expectations context.checking( new Expectations() { { allowing(shippingLevelService).findByGuid(serviceLevel.getGuid()); will(returnValue(serviceLevel)); oneOf(order).addOrderEvent(orderEvent); } }); // When orderEventHelper.logOrderShipmentMethodChanged(order, physicalShipment); // Then assertTrue( "Message should contain shippingServLevel's display name", orderEvent.getNote().contains(serviceLevel.getDisplayName(Locale.CANADA, false))); }