From d720389ba730bc1c1b10e5f3e6a3240c09845a76 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 26 Aug 2020 12:33:03 +0200 Subject: [PATCH] Update order history information --- locale/defaultMessages.json | 8 + schema.graphql | 16 +- .../components/OrderHistory/OrderHistory.tsx | 12 + src/orders/fixtures.ts | 46 +- .../__snapshots__/Stories.test.ts.snap | 1140 ++++++++++++++++- src/types/globalTypes.ts | 6 + 6 files changed, 1220 insertions(+), 8 deletions(-) diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 22f4dc4a3..4cbed23b6 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -3137,6 +3137,10 @@ "context": "order history message", "string": "Products were deleted from draft order" }, + "src_dot_orders_dot_components_dot_OrderHistory_dot_4121987561": { + "context": "order history message", + "string": "Order refund information was sent to customer" + }, "src_dot_orders_dot_components_dot_OrderHistory_dot_4265697648": { "context": "order history message", "string": "Updated fulfillment group's tracking number" @@ -3145,6 +3149,10 @@ "context": "order history message", "string": "Payment failed" }, + "src_dot_orders_dot_components_dot_OrderHistory_dot_493321552": { + "context": "order history message", + "string": "Order cancel information was sent to customer" + }, "src_dot_orders_dot_components_dot_OrderHistory_dot_651019008": { "context": "order history message", "string": "Shipping details was sent to customer" diff --git a/schema.graphql b/schema.graphql index fb385d55b..d5f75c891 100644 --- a/schema.graphql +++ b/schema.graphql @@ -897,6 +897,7 @@ type CheckoutComplete { errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order confirmationNeeded: Boolean! + confirmationData: JSONString checkoutErrors: [CheckoutError!]! } @@ -2749,7 +2750,7 @@ type Mutation { exportProducts(input: ExportProductsInput!): ExportProducts checkoutAddPromoCode(checkoutId: ID!, promoCode: String!): CheckoutAddPromoCode checkoutBillingAddressUpdate(billingAddress: AddressInput!, checkoutId: ID!): CheckoutBillingAddressUpdate - checkoutComplete(checkoutId: ID!, redirectUrl: String, storeSource: Boolean = false): CheckoutComplete + checkoutComplete(checkoutId: ID!, paymentData: JSONString, redirectUrl: String, storeSource: Boolean = false): CheckoutComplete checkoutCreate(input: CheckoutCreateInput!): CheckoutCreate checkoutCustomerAttach(checkoutId: ID!, customerId: ID): CheckoutCustomerAttach checkoutCustomerDetach(checkoutId: ID!): CheckoutCustomerDetach @@ -3044,6 +3045,8 @@ enum OrderEventsEmailsEnum { SHIPPING_CONFIRMATION TRACKING_UPDATED ORDER_CONFIRMATION + ORDER_CANCEL + ORDER_REFUND FULFILLMENT_CONFIRMATION DIGITAL_LINKS } @@ -3062,6 +3065,7 @@ enum OrderEventsEnum { EMAIL_SENT PAYMENT_AUTHORIZED PAYMENT_CAPTURED + EXTERNAL_SERVICE_NOTIFICATION PAYMENT_REFUNDED PAYMENT_VOIDED PAYMENT_FAILED @@ -3386,10 +3390,13 @@ type PaymentCapture { enum PaymentChargeStatusEnum { NOT_CHARGED + PENDING PARTIALLY_CHARGED FULLY_CHARGED PARTIALLY_REFUNDED FULLY_REFUNDED + REFUSED + CANCELLED } type PaymentCountableConnection { @@ -3433,9 +3440,10 @@ type PaymentGateway { input PaymentInput { gateway: String! - token: String! + token: String amount: Decimal billingAddress: AddressInput + returnUrl: String } type PaymentRefund { @@ -5021,10 +5029,14 @@ enum TransactionError { enum TransactionKind { AUTH + PENDING + ACTION_TO_CONFIRM REFUND + REFUND_ONGOING CAPTURE VOID CONFIRM + CANCEL } union TranslatableItem = ProductTranslatableContent | CollectionTranslatableContent | CategoryTranslatableContent | AttributeTranslatableContent | AttributeValueTranslatableContent | ProductVariantTranslatableContent | PageTranslatableContent | ShippingMethodTranslatableContent | SaleTranslatableContent | VoucherTranslatableContent | MenuItemTranslatableContent diff --git a/src/orders/components/OrderHistory/OrderHistory.tsx b/src/orders/components/OrderHistory/OrderHistory.tsx index dcdc59478..dcf53a533 100644 --- a/src/orders/components/OrderHistory/OrderHistory.tsx +++ b/src/orders/components/OrderHistory/OrderHistory.tsx @@ -76,6 +76,16 @@ const getEventMessage = (event: OrderDetails_order_events, intl: IntlShape) => { defaultMessage: "Shipping tracking number was sent to customer", description: "order history message" }); + case OrderEventsEmailsEnum.ORDER_CANCEL: + return intl.formatMessage({ + defaultMessage: "Order cancel information was sent to customer", + description: "order history message" + }); + case OrderEventsEmailsEnum.ORDER_REFUND: + return intl.formatMessage({ + defaultMessage: "Order refund information was sent to customer", + description: "order history message" + }); } case OrderEventsEnum.FULFILLMENT_CANCELED: return intl.formatMessage({ @@ -211,6 +221,8 @@ const getEventMessage = (event: OrderDetails_order_events, intl: IntlShape) => { defaultMessage: "Order address was updated", description: "order history message" }); + case OrderEventsEnum.EXTERNAL_SERVICE_NOTIFICATION: + return event.message; } }; diff --git a/src/orders/fixtures.ts b/src/orders/fixtures.ts index afa99300e..79ceaa641 100644 --- a/src/orders/fixtures.ts +++ b/src/orders/fixtures.ts @@ -8,6 +8,7 @@ import { FulfillmentStatus, JobStatusEnum, OrderAction, + OrderEventsEmailsEnum, OrderEventsEnum, OrderStatus, PaymentChargeStatusEnum @@ -821,7 +822,7 @@ export const order = (placeholder: string): OrderDetails_order => ({ email: null, emailType: null, id: "T3JkZXJFdmVudDoyMQ==", - invoiceNumber: "23/07/2020", + invoiceNumber: null, message: null, quantity: 1, type: OrderEventsEnum.FULFILLMENT_FULFILLED_ITEMS, @@ -838,7 +839,7 @@ export const order = (placeholder: string): OrderDetails_order => ({ email: null, emailType: null, id: "T3JkZXJFdmVudDo0", - invoiceNumber: "23/07/2020", + invoiceNumber: null, message: "This is note", quantity: null, type: OrderEventsEnum.NOTE_ADDED, @@ -851,11 +852,50 @@ export const order = (placeholder: string): OrderDetails_order => ({ email: null, emailType: null, id: "T3JkZXJFdmVudDo1", - invoiceNumber: "24/07/2020", + invoiceNumber: null, message: "This is note", quantity: null, type: OrderEventsEnum.NOTE_ADDED, user: null + }, + { + __typename: "OrderEvent", + amount: null, + date: "2019-09-17T13:22:24.376193+00:00", + email: null, + emailType: null, + id: "T3JkZXJFdmVudDo2", + invoiceNumber: null, + message: "Note from external service", + quantity: null, + type: OrderEventsEnum.EXTERNAL_SERVICE_NOTIFICATION, + user: null + }, + { + __typename: "OrderEvent", + amount: null, + date: "2019-09-17T13:22:24.376193+00:00", + email: null, + emailType: OrderEventsEmailsEnum.ORDER_CANCEL, + id: "T3JkZXJFdmVudDo3", + invoiceNumber: null, + message: null, + quantity: null, + type: OrderEventsEnum.EMAIL_SENT, + user: null + }, + { + __typename: "OrderEvent", + amount: null, + date: "2019-09-17T13:22:24.376193+00:00", + email: null, + emailType: OrderEventsEmailsEnum.ORDER_REFUND, + id: "T3JkZXJFdmVudDo4", + invoiceNumber: null, + message: null, + quantity: null, + type: OrderEventsEnum.EMAIL_SENT, + user: null } ], fulfillments: [ diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 1d5c30a43..b42c55abc 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -11404,6 +11404,87 @@ exports[`Storyshots Orders / OrderHistory default 1`] = ` +
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -86210,6 +86291,136 @@ exports[`Storyshots Views / Orders / Order details cancelled 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -87406,6 +87617,87 @@ exports[`Storyshots Views / Orders / Order details default 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -88633,16 +88925,48 @@ exports[`Storyshots Views / Orders / Order details fulfilled 1`] = `
+
+ > + Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+ Order cancel information was sent to customer +
+
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -91715,6 +92120,87 @@ exports[`Storyshots Views / Orders / Order details no payment 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -92941,6 +93427,87 @@ exports[`Storyshots Views / Orders / Order details no shipping address 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -94167,6 +94734,87 @@ exports[`Storyshots Views / Orders / Order details partially fulfilled 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -95393,6 +96041,87 @@ exports[`Storyshots Views / Orders / Order details payment confirmed 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -96619,6 +97348,87 @@ exports[`Storyshots Views / Orders / Order details payment error 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -97845,6 +98655,87 @@ exports[`Storyshots Views / Orders / Order details pending payment 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -99071,6 +99962,87 @@ exports[`Storyshots Views / Orders / Order details refunded payment 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -100297,6 +101269,87 @@ exports[`Storyshots Views / Orders / Order details rejected payment 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
@@ -101523,6 +102576,87 @@ exports[`Storyshots Views / Orders / Order details unfulfilled 1`] = `
+
+ +
+
+ Order refund information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Order cancel information was sent to customer +
+
+ +
+
+
+
+ +
+
+ Note from external service +
+
+ +
+
+
diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index 60f1160d5..b3d50c039 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -553,7 +553,9 @@ export enum OrderErrorCode { export enum OrderEventsEmailsEnum { DIGITAL_LINKS = "DIGITAL_LINKS", FULFILLMENT_CONFIRMATION = "FULFILLMENT_CONFIRMATION", + ORDER_CANCEL = "ORDER_CANCEL", ORDER_CONFIRMATION = "ORDER_CONFIRMATION", + ORDER_REFUND = "ORDER_REFUND", PAYMENT_CONFIRMATION = "PAYMENT_CONFIRMATION", SHIPPING_CONFIRMATION = "SHIPPING_CONFIRMATION", TRACKING_UPDATED = "TRACKING_UPDATED", @@ -565,6 +567,7 @@ export enum OrderEventsEnum { DRAFT_CREATED = "DRAFT_CREATED", DRAFT_REMOVED_PRODUCTS = "DRAFT_REMOVED_PRODUCTS", EMAIL_SENT = "EMAIL_SENT", + EXTERNAL_SERVICE_NOTIFICATION = "EXTERNAL_SERVICE_NOTIFICATION", FULFILLMENT_CANCELED = "FULFILLMENT_CANCELED", FULFILLMENT_FULFILLED_ITEMS = "FULFILLMENT_FULFILLED_ITEMS", FULFILLMENT_RESTOCKED_ITEMS = "FULFILLMENT_RESTOCKED_ITEMS", @@ -631,11 +634,14 @@ export enum PageSortField { } export enum PaymentChargeStatusEnum { + CANCELLED = "CANCELLED", FULLY_CHARGED = "FULLY_CHARGED", FULLY_REFUNDED = "FULLY_REFUNDED", NOT_CHARGED = "NOT_CHARGED", PARTIALLY_CHARGED = "PARTIALLY_CHARGED", PARTIALLY_REFUNDED = "PARTIALLY_REFUNDED", + PENDING = "PENDING", + REFUSED = "REFUSED", } export enum PermissionEnum {