@pvh-afl/graphql 1.1.52 → 1.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.module.d.ts","sourceRoot":"","sources":["../src/graphql.module.ts"],"names":[],"mappings":"AAwBA,qBA6Ba,aAAa;CAAG"}
1
+ {"version":3,"file":"graphql.module.d.ts","sourceRoot":"","sources":["../src/graphql.module.ts"],"names":[],"mappings":"AAyBA,qBA8Ba,aAAa;CAAG"}
@@ -17,6 +17,7 @@ const header_module_1 = require("./header/header.module");
17
17
  const serviceability_module_1 = require("./serviceability/serviceability.module");
18
18
  const store_locator_module_1 = require("./store-locator/store-locator.module");
19
19
  const order_tracking_module_1 = require("./order-tracking/order-tracking.module");
20
+ const order_cancel_module_1 = require("./order-cancel/order-cancel.module");
20
21
  const loyalty_module_1 = require("./loyalty/loyalty.module");
21
22
  const static_pages_module_1 = require("./static-pages/static-pages.module");
22
23
  let GraphqlModule = class GraphqlModule {
@@ -48,6 +49,7 @@ exports.GraphqlModule = GraphqlModule = tslib_1.__decorate([
48
49
  serviceability_module_1.ServiceabilityModule,
49
50
  store_locator_module_1.StoreLocatorModule,
50
51
  order_tracking_module_1.OrderTrackingModule,
52
+ order_cancel_module_1.OrderCancelModule,
51
53
  loyalty_module_1.LoyaltyModule,
52
54
  static_pages_module_1.StaticPagesModule,
53
55
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.module.js","sourceRoot":"","sources":["../src/graphql.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,2CAAkE;AAClE,+BAA4B;AAE5B,6DAAyD;AACzD,sEAAkE;AAClE,oDAAgD;AAChD,gEAA4D;AAC5D,iDAA6C;AAC7C,4EAAuE;AACvE,qFAAgF;AAChF,0DAAsD;AACtD,kFAA8E;AAC9E,+EAA0E;AAC1E,kFAA6E;AAC7E,6DAAyD;AACzD,4EAAuE;AAoChE,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IA7BzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,OAAO,CAAqB;gBACxC,MAAM,EAAE,qBAAY;gBACpB,cAAc,EAAE,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC;gBACrD,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,IAAI;gBAChB,aAAa,EAAE,IAAI;gBACnB,OAAO,EAAE,CAAC,EAAE,GAAG,EAA6B,EAAE,EAAE,CAAC,CAAC;oBAChD,GAAG;oBACH,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,WAAW,EAAE,GAAG,CAAC,WAAW;iBAC7B,CAAC;aACH,CAAC;YACF,8BAAa;YACb,oCAAgB;YAChB,wBAAU;YACV,gCAAc;YACd,sBAAS;YACT,uCAAiB;YACjB,6CAAoB;YACpB,4BAAY;YACZ,4CAAoB;YACpB,yCAAkB;YAClB,2CAAmB;YACnB,8BAAa;YACb,uCAAiB;SAClB;KACF,CAAC;GACW,aAAa,CAAG"}
1
+ {"version":3,"file":"graphql.module.js","sourceRoot":"","sources":["../src/graphql.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,2CAAkE;AAClE,+BAA4B;AAE5B,6DAAyD;AACzD,sEAAkE;AAClE,oDAAgD;AAChD,gEAA4D;AAC5D,iDAA6C;AAC7C,4EAAuE;AACvE,qFAAgF;AAChF,0DAAsD;AACtD,kFAA8E;AAC9E,+EAA0E;AAC1E,kFAA6E;AAC7E,4EAAuE;AACvE,6DAAyD;AACzD,4EAAuE;AAqChE,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IA9BzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,OAAO,CAAqB;gBACxC,MAAM,EAAE,qBAAY;gBACpB,cAAc,EAAE,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC;gBACrD,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,IAAI;gBAChB,aAAa,EAAE,IAAI;gBACnB,OAAO,EAAE,CAAC,EAAE,GAAG,EAA6B,EAAE,EAAE,CAAC,CAAC;oBAChD,GAAG;oBACH,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,WAAW,EAAE,GAAG,CAAC,WAAW;iBAC7B,CAAC;aACH,CAAC;YACF,8BAAa;YACb,oCAAgB;YAChB,wBAAU;YACV,gCAAc;YACd,sBAAS;YACT,uCAAiB;YACjB,6CAAoB;YACpB,4BAAY;YACZ,4CAAoB;YACpB,yCAAkB;YAClB,2CAAmB;YACnB,uCAAiB;YACjB,8BAAa;YACb,uCAAiB;SAClB;KACF,CAAC;GACW,aAAa,CAAG"}
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from './serviceability';
12
12
  export * from './store-locator';
13
13
  export * from './order-tracking';
14
14
  export * from './customer-orders';
15
+ export * from './order-cancel';
15
16
  export * from './loyalty';
16
17
  export * from './page-content';
17
18
  export * from './product-content';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,kBAAkB,CAAC;AAGjC,cAAc,WAAW,CAAC;AAG1B,cAAc,QAAQ,CAAC;AAGvB,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,UAAU,CAAC;AAGzB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,OAAO,CAAC;AAGtB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,kBAAkB,CAAC;AAGjC,cAAc,WAAW,CAAC;AAG1B,cAAc,QAAQ,CAAC;AAGvB,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,UAAU,CAAC;AAGzB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,OAAO,CAAC;AAGtB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -24,6 +24,8 @@ tslib_1.__exportStar(require("./store-locator"), exports);
24
24
  tslib_1.__exportStar(require("./order-tracking"), exports);
25
25
  // Customer Orders ("My Orders" listing)
26
26
  tslib_1.__exportStar(require("./customer-orders"), exports);
27
+ // Order Cancel (customer-initiated cancellation)
28
+ tslib_1.__exportStar(require("./order-cancel"), exports);
27
29
  // Loyalty
28
30
  tslib_1.__exportStar(require("./loyalty"), exports);
29
31
  // Page Content
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mDAAmD;AACnD,2DAAiC;AAEjC,UAAU;AACV,oDAA0B;AAE1B,OAAO;AACP,iDAAuB;AAEvB,0BAA0B;AAC1B,qDAA2B;AAE3B,aAAa;AACb,uDAA6B;AAE7B,iBAAiB;AACjB,2DAAiC;AAEjC,gBAAgB;AAChB,0DAAgC;AAEhC,iBAAiB;AACjB,2DAAiC;AAEjC,wCAAwC;AACxC,4DAAkC;AAElC,UAAU;AACV,oDAA0B;AAE1B,eAAe;AACf,yDAA+B;AAE/B,kBAAkB;AAClB,4DAAkC;AAElC,SAAS;AACT,mDAAyB;AAEzB,0CAA0C;AAC1C,yDAA+B;AAE/B,MAAM;AACN,gDAAsB;AAEtB,eAAe;AACf,yDAA+B;AAE/B,2BAA2B;AAC3B,mDAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mDAAmD;AACnD,2DAAiC;AAEjC,UAAU;AACV,oDAA0B;AAE1B,OAAO;AACP,iDAAuB;AAEvB,0BAA0B;AAC1B,qDAA2B;AAE3B,aAAa;AACb,uDAA6B;AAE7B,iBAAiB;AACjB,2DAAiC;AAEjC,gBAAgB;AAChB,0DAAgC;AAEhC,iBAAiB;AACjB,2DAAiC;AAEjC,wCAAwC;AACxC,4DAAkC;AAElC,iDAAiD;AACjD,yDAA+B;AAE/B,UAAU;AACV,oDAA0B;AAE1B,eAAe;AACf,yDAA+B;AAE/B,kBAAkB;AAClB,4DAAkC;AAElC,SAAS;AACT,mDAAyB;AAEzB,0CAA0C;AAC1C,yDAA+B;AAE/B,MAAM;AACN,gDAAsB;AAEtB,eAAe;AACf,yDAA+B;AAE/B,2BAA2B;AAC3B,mDAAyB"}
@@ -0,0 +1,5 @@
1
+ export * from './order-cancel.module';
2
+ export * from './order-cancel.resolver';
3
+ export * from './order-cancel.service';
4
+ export * from './order-cancel.types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/order-cancel/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./order-cancel.module"), exports);
5
+ tslib_1.__exportStar(require("./order-cancel.resolver"), exports);
6
+ tslib_1.__exportStar(require("./order-cancel.service"), exports);
7
+ tslib_1.__exportStar(require("./order-cancel.types"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/order-cancel/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,kEAAwC;AACxC,iEAAuC;AACvC,+DAAqC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Order Cancel Module
3
+ *
4
+ * GraphQL module for customer-initiated order cancellation.
5
+ */
6
+ export declare class OrderCancelModule {
7
+ }
8
+ //# sourceMappingURL=order-cancel.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-cancel.module.d.ts","sourceRoot":"","sources":["../../src/order-cancel/order-cancel.module.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,qBAIa,iBAAiB;CAAG"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderCancelModule = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const core_1 = require("@pvh-afl/core");
7
+ const order_cancel_resolver_1 = require("./order-cancel.resolver");
8
+ const order_cancel_service_1 = require("./order-cancel.service");
9
+ /**
10
+ * Order Cancel Module
11
+ *
12
+ * GraphQL module for customer-initiated order cancellation.
13
+ */
14
+ let OrderCancelModule = class OrderCancelModule {
15
+ };
16
+ exports.OrderCancelModule = OrderCancelModule;
17
+ exports.OrderCancelModule = OrderCancelModule = tslib_1.__decorate([
18
+ (0, common_1.Module)({
19
+ imports: [core_1.IntegrationsModule],
20
+ providers: [order_cancel_resolver_1.OrderCancelResolver, order_cancel_service_1.OrderCancelService],
21
+ })
22
+ ], OrderCancelModule);
23
+ //# sourceMappingURL=order-cancel.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-cancel.module.js","sourceRoot":"","sources":["../../src/order-cancel/order-cancel.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,wCAAmD;AACnD,mEAA8D;AAC9D,iEAA4D;AAE5D;;;;GAIG;AAKI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IAJ7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,yBAAkB,CAAC;QAC7B,SAAS,EAAE,CAAC,2CAAmB,EAAE,yCAAkB,CAAC;KACrD,CAAC;GACW,iBAAiB,CAAG"}
@@ -0,0 +1,18 @@
1
+ import { AuthUser } from '@pvh-afl/core';
2
+ import { OrderCancelService } from './order-cancel.service';
3
+ import { CancelOrderInput, CancelOrderResult } from './order-cancel.types';
4
+ /**
5
+ * Order Cancel Resolver
6
+ *
7
+ * GraphQL mutation for a customer to cancel one of their own orders. Requires
8
+ * authentication; the caller's identity comes from the verified token, and the
9
+ * order must belong to that caller.
10
+ */
11
+ export declare class OrderCancelResolver {
12
+ private readonly orderCancelService;
13
+ constructor(orderCancelService: OrderCancelService);
14
+ cancelOrder(user: AuthUser, input: CancelOrderInput, context: {
15
+ brand: string;
16
+ }): Promise<CancelOrderResult>;
17
+ }
18
+ //# sourceMappingURL=order-cancel.resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-cancel.resolver.d.ts","sourceRoot":"","sources":["../../src/order-cancel/order-cancel.resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAIT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE3E;;;;;;GAMG;AACH,qBACa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAAlB,kBAAkB,EAAE,kBAAkB;IAiB7D,WAAW,CACA,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,gBAAgB,EAC3B,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,iBAAiB,CAAC;CAS9B"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderCancelResolver = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_1 = require("@nestjs/graphql");
6
+ const common_1 = require("@nestjs/common");
7
+ const core_1 = require("@pvh-afl/core");
8
+ const order_cancel_service_1 = require("./order-cancel.service");
9
+ const order_cancel_types_1 = require("./order-cancel.types");
10
+ /**
11
+ * Order Cancel Resolver
12
+ *
13
+ * GraphQL mutation for a customer to cancel one of their own orders. Requires
14
+ * authentication; the caller's identity comes from the verified token, and the
15
+ * order must belong to that caller.
16
+ */
17
+ let OrderCancelResolver = class OrderCancelResolver {
18
+ orderCancelService;
19
+ constructor(orderCancelService) {
20
+ this.orderCancelService = orderCancelService;
21
+ }
22
+ async cancelOrder(user, input, context) {
23
+ // The customer id comes from the verified token, never from the request, so
24
+ // there is no argument a caller could change to cancel another's order.
25
+ return this.orderCancelService.cancelOrder(context.brand, input, user.customerId);
26
+ }
27
+ };
28
+ exports.OrderCancelResolver = OrderCancelResolver;
29
+ tslib_1.__decorate([
30
+ (0, graphql_1.Mutation)(() => order_cancel_types_1.CancelOrderResult, {
31
+ description: `Cancel one of the logged-in customer's own orders.
32
+
33
+ Requires authentication. Ownership is verified by looking the order up on
34
+ Shopify and comparing its customer to the token — an order that is not the
35
+ caller's is reported as not found, so the response cannot confirm that an order
36
+ number exists.
37
+
38
+ Runs the eligibility gate (cancellation enabled, not a free gift, still
39
+ unfulfilled and not already cancelled, payment method allowed), calls Shopify
40
+ Admin \`orderCancel\`, then waits until the order is provably cancelled before
41
+ reporting success. Refund and inventory reconciliation are handled downstream
42
+ by checkout/payments, so no refund method is passed here.`,
43
+ }),
44
+ (0, common_1.UseGuards)(core_1.TenantGuard, core_1.JwtAuthGuard),
45
+ tslib_1.__param(0, (0, core_1.CurrentUser)()),
46
+ tslib_1.__param(1, (0, graphql_1.Args)('input')),
47
+ tslib_1.__param(2, (0, graphql_1.Context)()),
48
+ tslib_1.__metadata("design:type", Function),
49
+ tslib_1.__metadata("design:paramtypes", [Object, order_cancel_types_1.CancelOrderInput, Object]),
50
+ tslib_1.__metadata("design:returntype", Promise)
51
+ ], OrderCancelResolver.prototype, "cancelOrder", null);
52
+ exports.OrderCancelResolver = OrderCancelResolver = tslib_1.__decorate([
53
+ (0, graphql_1.Resolver)(),
54
+ tslib_1.__metadata("design:paramtypes", [order_cancel_service_1.OrderCancelService])
55
+ ], OrderCancelResolver);
56
+ //# sourceMappingURL=order-cancel.resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-cancel.resolver.js","sourceRoot":"","sources":["../../src/order-cancel/order-cancel.resolver.ts"],"names":[],"mappings":";;;;AAAA,6CAAoE;AACpE,2CAA2C;AAC3C,wCAKuB;AACvB,iEAA4D;AAC5D,6DAA2E;AAE3E;;;;;;GAMG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IACD;IAA7B,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAiBjE,AAAN,KAAK,CAAC,WAAW,CACA,IAAc,EACd,KAAuB,EAC3B,OAA0B;QAErC,4EAA4E;QAC5E,wEAAwE;QACxE,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,CACxC,OAAO,CAAC,KAAK,EACb,KAAK,EACL,IAAI,CAAC,UAAU,CAChB,CAAC;IACJ,CAAC;CACF,CAAA;AA/BY,kDAAmB;AAkBxB;IAfL,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,sCAAiB,EAAE;QACjC,WAAW,EAAE;;;;;;;;;;;0DAWyC;KACvD,CAAC;IACD,IAAA,kBAAS,EAAC,kBAAW,EAAE,mBAAY,CAAC;IAElC,mBAAA,IAAA,kBAAW,GAAE,CAAA;IACb,mBAAA,IAAA,cAAI,EAAC,OAAO,CAAC,CAAA;IACb,mBAAA,IAAA,iBAAO,GAAE,CAAA;;qDADY,qCAAgB;;sDAUvC;8BA9BU,mBAAmB;IAD/B,IAAA,kBAAQ,GAAE;6CAEwC,yCAAkB;GADxD,mBAAmB,CA+B/B"}
@@ -0,0 +1,60 @@
1
+ import { ConfigService } from '@pvh-afl/core';
2
+ import { CancelOrderInput, CancelOrderResult } from './order-cancel.types';
3
+ /**
4
+ * Order Cancellation Service
5
+ *
6
+ * Runs the eligibility gate against Shopify order data, initiates the
7
+ * cancellation via the Shopify Admin `orderCancel` mutation, and then confirms
8
+ * the order is provably cancelled (`cancelledAt` set) before reporting success.
9
+ * No refund method is passed — refund and inventory reconciliation are owned by
10
+ * checkout/payments.
11
+ */
12
+ export declare class OrderCancelService {
13
+ private readonly configService;
14
+ constructor(configService: ConfigService);
15
+ cancelOrder(brand: string, input: CancelOrderInput, customerId: string): Promise<CancelOrderResult>;
16
+ /**
17
+ * Whether an order belongs to the given customer. Compares the numeric part,
18
+ * since Shopify returns a GID while the caller may hold either form. An order
19
+ * with no customer attached belongs to nobody.
20
+ */
21
+ private belongsTo;
22
+ /**
23
+ * Whether the order's payment method satisfies the brand policy. A prepaid
24
+ * order is one whose financial status shows it was paid up front; everything
25
+ * else (notably PENDING) is treated as COD.
26
+ */
27
+ private paymentMethodAllowed;
28
+ /**
29
+ * Fetch the order by GID or by name. Both forms select the same fields,
30
+ * including `customer { id }` for the ownership check.
31
+ */
32
+ private fetchOrder;
33
+ /**
34
+ * Call Shopify Admin `orderCancel`, then confirm the order is provably
35
+ * cancelled before reporting success. No `refundMethod` is passed — refund is
36
+ * reconciled downstream by checkout/payments.
37
+ */
38
+ private initiateCancel;
39
+ /**
40
+ * Poll the order until Shopify records `cancelledAt`, proving the async
41
+ * cancellation completed. Returns false if it does not confirm in time.
42
+ */
43
+ private confirmCancelled;
44
+ /**
45
+ * Execute a query/mutation against the Shopify Admin API. Returns the parsed
46
+ * body, or null when the HTTP call fails or the response carries GraphQL
47
+ * errors.
48
+ */
49
+ private executeAdmin;
50
+ /** Build a rejected result, carrying the order identity when known. */
51
+ private reject;
52
+ /**
53
+ * Read the brand's cancellation policy from `features.orderCancellation`,
54
+ * applying safe defaults. Cancellation is opt-in (`enabled` defaults to false).
55
+ */
56
+ private getCancellationConfig;
57
+ /** Get Shopify Admin API configuration for the brand. */
58
+ private getShopifyAdminConfig;
59
+ }
60
+ //# sourceMappingURL=order-cancel.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-cancel.service.d.ts","sourceRoot":"","sources":["../../src/order-cancel/order-cancel.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAU,MAAM,eAAe,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAmH9B;;;;;;;;GAQG;AACH,qBACa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAEnD,WAAW,CACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,gBAAgB,EACvB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,iBAAiB,CAAC;IA+E7B;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAMjB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;OAGG;YACW,UAAU;IAoDxB;;;;OAIG;YACW,cAAc;IAyH5B;;;OAGG;YACW,gBAAgB;IAgC9B;;;;OAIG;YACW,YAAY;IAiC1B,uEAAuE;IACvE,OAAO,CAAC,MAAM;IAcd;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAmB7B,yDAAyD;IACzD,OAAO,CAAC,qBAAqB;CAgB9B"}
@@ -0,0 +1,362 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderCancelService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const core_1 = require("@pvh-afl/core");
7
+ const order_cancel_types_1 = require("./order-cancel.types");
8
+ /** Valid Shopify OrderCancelReason enum values (2025-07+). */
9
+ const ORDER_CANCEL_REASONS = new Set([
10
+ 'CUSTOMER',
11
+ 'PAYMENT',
12
+ 'FRAUD',
13
+ 'INVENTORY',
14
+ 'STAFF_ERROR',
15
+ 'OTHER',
16
+ ]);
17
+ /**
18
+ * Shopify `displayFinancialStatus` values that mean the order was paid up front
19
+ * (prepaid). Anything else (notably `PENDING`) is treated as cash-on-delivery.
20
+ * Shopify has no native COD flag, so this status is the closest first-class
21
+ * signal.
22
+ */
23
+ const PREPAID_FINANCIAL_STATUSES = new Set([
24
+ 'PAID',
25
+ 'AUTHORIZED',
26
+ 'PARTIALLY_PAID',
27
+ 'PARTIALLY_REFUNDED',
28
+ 'REFUNDED',
29
+ ]);
30
+ /** A Shopify Order GID, e.g. `gid://shopify/Order/1234567890`. */
31
+ const ORDER_GID_RE = /^gid:\/\/shopify\/Order\/\d+$/;
32
+ /**
33
+ * The store's order-name format — an optional `#` and/or `TH` prefix followed by
34
+ * digits (e.g. `TH1044`, `#1001`, `#TH1044`, `1044`). Mirrors the validation in
35
+ * OrderTrackingService so search metacharacters can never be interpolated into
36
+ * the Admin search filter.
37
+ */
38
+ const ORDER_NAME_RE = /^#?(?:TH)?\d+$/i;
39
+ /** How long to wait for Shopify to confirm the cancellation completed. */
40
+ const CONFIRM_MAX_ATTEMPTS = 6;
41
+ const CONFIRM_DELAY_MS = 1000;
42
+ /** Reduce a Shopify customer GID to its numeric part. */
43
+ function stripCustomerGid(value) {
44
+ return String(value).trim().replace(/^gid:\/\/shopify\/Customer\//, '');
45
+ }
46
+ function sleep(ms) {
47
+ return new Promise((resolve) => setTimeout(resolve, ms));
48
+ }
49
+ /**
50
+ * Order Cancellation Service
51
+ *
52
+ * Runs the eligibility gate against Shopify order data, initiates the
53
+ * cancellation via the Shopify Admin `orderCancel` mutation, and then confirms
54
+ * the order is provably cancelled (`cancelledAt` set) before reporting success.
55
+ * No refund method is passed — refund and inventory reconciliation are owned by
56
+ * checkout/payments.
57
+ */
58
+ let OrderCancelService = class OrderCancelService {
59
+ configService;
60
+ constructor(configService) {
61
+ this.configService = configService;
62
+ }
63
+ async cancelOrder(brand, input, customerId) {
64
+ const adminConfig = this.getShopifyAdminConfig(brand);
65
+ if (!adminConfig) {
66
+ core_1.logger.warn('Shopify Admin API not configured', { brand });
67
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.NOT_CONFIGURED, 'Order cancellation is not available right now.');
68
+ }
69
+ const orderId = input.orderId?.trim() ?? '';
70
+ if (!ORDER_GID_RE.test(orderId) && !ORDER_NAME_RE.test(orderId)) {
71
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.INVALID_ORDER_ID, 'That does not look like a valid order reference.');
72
+ }
73
+ // 1–2. Fetch the order (read-only) and confirm it is the caller's own.
74
+ const order = await this.fetchOrder(brand, adminConfig, orderId);
75
+ if (!order || !this.belongsTo(order, customerId)) {
76
+ // Report missing and not-yours identically, so the response cannot be
77
+ // used to confirm that an order number exists.
78
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.ORDER_NOT_FOUND, 'We could not find that order on your account.');
79
+ }
80
+ // 3. The brand must have cancellation enabled.
81
+ const config = this.getCancellationConfig(brand);
82
+ if (!config.enabled) {
83
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.NOT_ENABLED, 'Order cancellation is not enabled.', order);
84
+ }
85
+ // 4. A free gift (zero total) has nothing to cancel.
86
+ if (parseFloat(order.originalTotalPriceSet.shopMoney.amount || '0') <= 0) {
87
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.FREE_GIFT, 'This order cannot be cancelled.', order);
88
+ }
89
+ // 5. Still unfulfilled and not already cancelled — any fulfillment activity
90
+ // at all closes the window.
91
+ if (order.cancelledAt) {
92
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.ORDER_CANCELLED, 'This order has already been cancelled.', order);
93
+ }
94
+ if (order.displayFulfillmentStatus !== 'UNFULFILLED') {
95
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.ORDER_FULFILLED, 'We have already started the shipping process, so this order can no longer be cancelled.', order);
96
+ }
97
+ // 6. Payment method allowed, per the brand policy. Prepaid vs COD is decided
98
+ // by the order's financial status (Shopify has no native COD flag).
99
+ if (!this.paymentMethodAllowed(order, config.paymentMethodPolicy)) {
100
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.PAYMENT_METHOD_NOT_ALLOWED, 'This payment method is not eligible for cancellation.', order);
101
+ }
102
+ // Eligible — initiate the cancellation on Shopify and confirm it completed.
103
+ return this.initiateCancel(brand, adminConfig, order, config, customerId);
104
+ }
105
+ /**
106
+ * Whether an order belongs to the given customer. Compares the numeric part,
107
+ * since Shopify returns a GID while the caller may hold either form. An order
108
+ * with no customer attached belongs to nobody.
109
+ */
110
+ belongsTo(order, customerId) {
111
+ const owner = order.customer?.id;
112
+ if (!owner)
113
+ return false;
114
+ return stripCustomerGid(owner) === stripCustomerGid(customerId);
115
+ }
116
+ /**
117
+ * Whether the order's payment method satisfies the brand policy. A prepaid
118
+ * order is one whose financial status shows it was paid up front; everything
119
+ * else (notably PENDING) is treated as COD.
120
+ */
121
+ paymentMethodAllowed(order, policy) {
122
+ if (policy === 'BOTH')
123
+ return true;
124
+ const isPrepaid = PREPAID_FINANCIAL_STATUSES.has((order.displayFinancialStatus ?? '').toUpperCase());
125
+ return policy === 'PREPAID' ? isPrepaid : !isPrepaid;
126
+ }
127
+ /**
128
+ * Fetch the order by GID or by name. Both forms select the same fields,
129
+ * including `customer { id }` for the ownership check.
130
+ */
131
+ async fetchOrder(brand, adminConfig, orderId) {
132
+ const selection = `
133
+ id
134
+ name
135
+ customer { id }
136
+ cancelledAt
137
+ displayFinancialStatus
138
+ displayFulfillmentStatus
139
+ originalTotalPriceSet { shopMoney { amount currencyCode } }
140
+ `;
141
+ const byGid = ORDER_GID_RE.test(orderId);
142
+ const query = byGid
143
+ ? `query CancelOrderLookup($id: ID!) { order(id: $id) { ${selection} } }`
144
+ : `query CancelOrderLookup($query: String!) {
145
+ orders(first: 1, query: $query) { edges { node { ${selection} } } }
146
+ }`;
147
+ const variables = byGid
148
+ ? { id: orderId }
149
+ : {
150
+ query: orderId.startsWith('#')
151
+ ? `name:${orderId}`
152
+ : `name:#${orderId} OR name:${orderId}`,
153
+ };
154
+ try {
155
+ const result = await this.executeAdmin(brand, adminConfig, query, variables);
156
+ if (!result)
157
+ return null;
158
+ if (byGid) {
159
+ return result.data?.order ?? null;
160
+ }
161
+ return (result.data?.orders?.edges?.[0]?.node ??
162
+ null);
163
+ }
164
+ catch (error) {
165
+ core_1.logger.error('Shopify order fetch failed (cancel)', {
166
+ brand,
167
+ error: error instanceof Error ? error.message : 'Unknown',
168
+ });
169
+ return null;
170
+ }
171
+ }
172
+ /**
173
+ * Call Shopify Admin `orderCancel`, then confirm the order is provably
174
+ * cancelled before reporting success. No `refundMethod` is passed — refund is
175
+ * reconciled downstream by checkout/payments.
176
+ */
177
+ async initiateCancel(brand, adminConfig, order, config, customerId) {
178
+ const mutation = `
179
+ mutation CancelOrder(
180
+ $orderId: ID!
181
+ $reason: OrderCancelReason!
182
+ $restock: Boolean!
183
+ $notifyCustomer: Boolean
184
+ $staffNote: String
185
+ ) {
186
+ orderCancel(
187
+ orderId: $orderId
188
+ reason: $reason
189
+ restock: $restock
190
+ notifyCustomer: $notifyCustomer
191
+ staffNote: $staffNote
192
+ ) {
193
+ job { id done }
194
+ orderCancelUserErrors { field message code }
195
+ }
196
+ }
197
+ `;
198
+ const variables = {
199
+ orderId: order.id,
200
+ reason: config.reason,
201
+ restock: config.restock,
202
+ notifyCustomer: config.notifyCustomer,
203
+ // Staff-facing, capped at Shopify's 255-char limit.
204
+ staffNote: `Customer-initiated cancellation via app (customer ${stripCustomerGid(customerId)}).`.slice(0, 255),
205
+ };
206
+ let jobId;
207
+ try {
208
+ const result = await this.executeAdmin(brand, adminConfig, mutation, variables);
209
+ if (!result) {
210
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.CANCEL_FAILED, 'We could not cancel this order right now. Please try again.', order);
211
+ }
212
+ const userErrors = result.data?.orderCancel?.orderCancelUserErrors ?? [];
213
+ if (userErrors.length) {
214
+ core_1.logger.warn('Shopify orderCancel user errors', {
215
+ brand,
216
+ orderId: order.id,
217
+ userErrors,
218
+ });
219
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.CANCEL_FAILED, userErrors[0]?.message ?? 'This order could not be cancelled.', order);
220
+ }
221
+ jobId = result.data?.orderCancel?.job?.id ?? undefined;
222
+ }
223
+ catch (error) {
224
+ core_1.logger.error('Shopify orderCancel failed', {
225
+ brand,
226
+ orderId: order.id,
227
+ error: error instanceof Error ? error.message : 'Unknown',
228
+ });
229
+ return this.reject(order_cancel_types_1.CancelOrderErrorCode.CANCEL_FAILED, 'We could not cancel this order right now. Please try again.', order);
230
+ }
231
+ // Strong guarantee: the cancel is asynchronous, so poll the order until
232
+ // Shopify records `cancelledAt`. Only then is the cancellation provable.
233
+ const confirmed = await this.confirmCancelled(brand, adminConfig, order.id);
234
+ if (!confirmed) {
235
+ core_1.logger.warn('Order cancellation not confirmed within wait window', {
236
+ brand,
237
+ orderId: order.id,
238
+ jobId,
239
+ });
240
+ return {
241
+ success: false,
242
+ orderId: order.id,
243
+ orderName: order.name,
244
+ jobId,
245
+ errorCode: order_cancel_types_1.CancelOrderErrorCode.CANCEL_UNCONFIRMED,
246
+ message: 'Your cancellation request was accepted and is being processed. Please check the order again shortly.',
247
+ };
248
+ }
249
+ core_1.logger.info('Order cancellation confirmed', {
250
+ brand,
251
+ orderId: order.id,
252
+ jobId,
253
+ });
254
+ return {
255
+ success: true,
256
+ orderId: order.id,
257
+ orderName: order.name,
258
+ status: 'cancelled',
259
+ jobId,
260
+ message: 'Your order has been cancelled.',
261
+ };
262
+ }
263
+ /**
264
+ * Poll the order until Shopify records `cancelledAt`, proving the async
265
+ * cancellation completed. Returns false if it does not confirm in time.
266
+ */
267
+ async confirmCancelled(brand, adminConfig, orderGid) {
268
+ const query = `query CancelConfirm($id: ID!) { order(id: $id) { id cancelledAt } }`;
269
+ for (let attempt = 0; attempt < CONFIRM_MAX_ATTEMPTS; attempt++) {
270
+ await sleep(CONFIRM_DELAY_MS);
271
+ try {
272
+ const result = await this.executeAdmin(brand, adminConfig, query, { id: orderGid });
273
+ if (result?.data?.order?.cancelledAt) {
274
+ return true;
275
+ }
276
+ }
277
+ catch (error) {
278
+ core_1.logger.warn('Cancellation confirmation poll failed', {
279
+ brand,
280
+ orderId: orderGid,
281
+ attempt,
282
+ error: error instanceof Error ? error.message : 'Unknown',
283
+ });
284
+ }
285
+ }
286
+ return false;
287
+ }
288
+ /**
289
+ * Execute a query/mutation against the Shopify Admin API. Returns the parsed
290
+ * body, or null when the HTTP call fails or the response carries GraphQL
291
+ * errors.
292
+ */
293
+ async executeAdmin(brand, adminConfig, query, variables) {
294
+ const response = await fetch(`${adminConfig.baseUrl}/graphql.json`, {
295
+ method: 'POST',
296
+ headers: {
297
+ 'Content-Type': 'application/json',
298
+ 'X-Shopify-Access-Token': adminConfig.apiKey,
299
+ },
300
+ body: JSON.stringify({ query, variables }),
301
+ });
302
+ if (!response.ok) {
303
+ core_1.logger.error('Shopify Admin API request failed', {
304
+ brand,
305
+ status: response.status,
306
+ });
307
+ return null;
308
+ }
309
+ const result = (await response.json());
310
+ if (result.errors?.length) {
311
+ core_1.logger.error('Shopify GraphQL errors', { brand, errors: result.errors });
312
+ return null;
313
+ }
314
+ return result;
315
+ }
316
+ /** Build a rejected result, carrying the order identity when known. */
317
+ reject(errorCode, message, order) {
318
+ return {
319
+ success: false,
320
+ orderId: order?.id,
321
+ orderName: order?.name,
322
+ errorCode,
323
+ message,
324
+ };
325
+ }
326
+ /**
327
+ * Read the brand's cancellation policy from `features.orderCancellation`,
328
+ * applying safe defaults. Cancellation is opt-in (`enabled` defaults to false).
329
+ */
330
+ getCancellationConfig(brand) {
331
+ const raw = this.configService.getFeature(brand, 'orderCancellation') ?? {};
332
+ const policy = String(raw.paymentMethodPolicy ?? 'BOTH').toUpperCase();
333
+ const reason = String(raw.reason ?? 'CUSTOMER').toUpperCase();
334
+ return {
335
+ enabled: raw.enabled === true,
336
+ paymentMethodPolicy: policy === 'COD' || policy === 'PREPAID' ? policy : 'BOTH',
337
+ restock: raw.restock !== false,
338
+ notifyCustomer: raw.notifyCustomer !== false,
339
+ reason: ORDER_CANCEL_REASONS.has(reason) ? reason : 'CUSTOMER',
340
+ };
341
+ }
342
+ /** Get Shopify Admin API configuration for the brand. */
343
+ getShopifyAdminConfig(brand) {
344
+ try {
345
+ const brandConfig = this.configService.getBrand(brand);
346
+ const adminConfig = brandConfig?.integrations?.commerceAdmin;
347
+ if (!adminConfig?.baseUrl || !adminConfig?.apiKey) {
348
+ return null;
349
+ }
350
+ return { baseUrl: adminConfig.baseUrl, apiKey: adminConfig.apiKey };
351
+ }
352
+ catch {
353
+ return null;
354
+ }
355
+ }
356
+ };
357
+ exports.OrderCancelService = OrderCancelService;
358
+ exports.OrderCancelService = OrderCancelService = tslib_1.__decorate([
359
+ (0, common_1.Injectable)(),
360
+ tslib_1.__metadata("design:paramtypes", [core_1.ConfigService])
361
+ ], OrderCancelService);
362
+ //# sourceMappingURL=order-cancel.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-cancel.service.js","sourceRoot":"","sources":["../../src/order-cancel/order-cancel.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,wCAAsD;AACtD,6DAI8B;AAmE9B,8DAA8D;AAC9D,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,UAAU;IACV,SAAS;IACT,OAAO;IACP,WAAW;IACX,aAAa;IACb,OAAO;CACR,CA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AEb,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACvD,MAAM,WAAW,GAAG,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC;YAE7D,IAAI,CAAC,WAAW,EAAE,OAAO,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;gBAClD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;QACtE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AA1aY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;6CAEiC,oBAAa;GAD9C,kBAAkB,CA0a9B"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * GraphQL Types for Order Cancellation
3
+ *
4
+ * A customer-initiated cancel. It runs an eligibility gate, then calls Shopify
5
+ * Admin `orderCancel` and waits until the order is provably cancelled before
6
+ * reporting success. Refund and inventory reconciliation are handled downstream
7
+ * by checkout/payments, so no refund method is passed here.
8
+ */
9
+ /**
10
+ * Stable, machine-readable outcomes returned on `CancelOrderResult.errorCode`
11
+ * when `success` is false. Clients branch on these; keep the strings stable.
12
+ */
13
+ export declare const CancelOrderErrorCode: {
14
+ /** Shopify Admin API is not configured for the brand. */
15
+ readonly NOT_CONFIGURED: "CANCELLATION_NOT_CONFIGURED";
16
+ /** The `orderId` is neither a valid Shopify Order GID nor a valid order name. */
17
+ readonly INVALID_ORDER_ID: "INVALID_ORDER_ID";
18
+ /**
19
+ * The order does not exist, or does not belong to the caller. The two are
20
+ * reported identically on purpose, so the response cannot be used to confirm
21
+ * that an order number exists (see the order-tracking ownership note).
22
+ */
23
+ readonly ORDER_NOT_FOUND: "ORDER_NOT_FOUND";
24
+ /** Order cancellation is not enabled for the brand. */
25
+ readonly NOT_ENABLED: "CANCELLATION_NOT_ENABLED";
26
+ /** The order total is zero (a free gift), so there is nothing to cancel. */
27
+ readonly FREE_GIFT: "FREE_GIFT";
28
+ /** The order has fulfillment activity — the cancellation window has passed. */
29
+ readonly ORDER_FULFILLED: "ORDER_FULFILLED";
30
+ /** The order is already cancelled. */
31
+ readonly ORDER_CANCELLED: "ORDER_CANCELLED";
32
+ /** The order's payment method is not permitted by the brand's cancel policy. */
33
+ readonly PAYMENT_METHOD_NOT_ALLOWED: "PAYMENT_METHOD_NOT_ALLOWED";
34
+ /** Eligible, but Shopify rejected the cancel (user errors) or the call failed. */
35
+ readonly CANCEL_FAILED: "CANCEL_FAILED";
36
+ /**
37
+ * Shopify accepted the request but the cancellation could not be confirmed as
38
+ * complete within the wait window. It is likely still finishing — the client
39
+ * should re-check the order shortly rather than treat it as failed.
40
+ */
41
+ readonly CANCEL_UNCONFIRMED: "CANCEL_UNCONFIRMED";
42
+ };
43
+ export type CancelOrderErrorCode = (typeof CancelOrderErrorCode)[keyof typeof CancelOrderErrorCode];
44
+ export declare class CancelOrderInput {
45
+ orderId: string;
46
+ }
47
+ export declare class CancelOrderResult {
48
+ success: boolean;
49
+ orderId?: string;
50
+ orderName?: string;
51
+ status?: string;
52
+ jobId?: string;
53
+ errorCode?: string;
54
+ message: string;
55
+ }
56
+ //# sourceMappingURL=order-cancel.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-cancel.types.d.ts","sourceRoot":"","sources":["../../src/order-cancel/order-cancel.types.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAMH;;;GAGG;AACH,eAAO,MAAM,oBAAoB;IAC/B,yDAAyD;;IAEzD,iFAAiF;;IAEjF;;;;OAIG;;IAEH,uDAAuD;;IAEvD,4EAA4E;;IAE5E,+EAA+E;;IAE/E,sCAAsC;;IAEtC,gFAAgF;;IAEhF,kFAAkF;;IAElF;;;;OAIG;;CAEK,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAC9B,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAMnE,qBACa,gBAAgB;IAK3B,OAAO,EAAG,MAAM,CAAC;CAClB;AAMD,qBACa,iBAAiB;IAK5B,OAAO,EAAG,OAAO,CAAC;IAGlB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAMnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAOhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAOf,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,OAAO,EAAG,MAAM,CAAC;CAClB"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancelOrderResult = exports.CancelOrderInput = exports.CancelOrderErrorCode = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_1 = require("@nestjs/graphql");
6
+ /**
7
+ * GraphQL Types for Order Cancellation
8
+ *
9
+ * A customer-initiated cancel. It runs an eligibility gate, then calls Shopify
10
+ * Admin `orderCancel` and waits until the order is provably cancelled before
11
+ * reporting success. Refund and inventory reconciliation are handled downstream
12
+ * by checkout/payments, so no refund method is passed here.
13
+ */
14
+ // ============================================================================
15
+ // Error codes
16
+ // ============================================================================
17
+ /**
18
+ * Stable, machine-readable outcomes returned on `CancelOrderResult.errorCode`
19
+ * when `success` is false. Clients branch on these; keep the strings stable.
20
+ */
21
+ exports.CancelOrderErrorCode = {
22
+ /** Shopify Admin API is not configured for the brand. */
23
+ NOT_CONFIGURED: 'CANCELLATION_NOT_CONFIGURED',
24
+ /** The `orderId` is neither a valid Shopify Order GID nor a valid order name. */
25
+ INVALID_ORDER_ID: 'INVALID_ORDER_ID',
26
+ /**
27
+ * The order does not exist, or does not belong to the caller. The two are
28
+ * reported identically on purpose, so the response cannot be used to confirm
29
+ * that an order number exists (see the order-tracking ownership note).
30
+ */
31
+ ORDER_NOT_FOUND: 'ORDER_NOT_FOUND',
32
+ /** Order cancellation is not enabled for the brand. */
33
+ NOT_ENABLED: 'CANCELLATION_NOT_ENABLED',
34
+ /** The order total is zero (a free gift), so there is nothing to cancel. */
35
+ FREE_GIFT: 'FREE_GIFT',
36
+ /** The order has fulfillment activity — the cancellation window has passed. */
37
+ ORDER_FULFILLED: 'ORDER_FULFILLED',
38
+ /** The order is already cancelled. */
39
+ ORDER_CANCELLED: 'ORDER_CANCELLED',
40
+ /** The order's payment method is not permitted by the brand's cancel policy. */
41
+ PAYMENT_METHOD_NOT_ALLOWED: 'PAYMENT_METHOD_NOT_ALLOWED',
42
+ /** Eligible, but Shopify rejected the cancel (user errors) or the call failed. */
43
+ CANCEL_FAILED: 'CANCEL_FAILED',
44
+ /**
45
+ * Shopify accepted the request but the cancellation could not be confirmed as
46
+ * complete within the wait window. It is likely still finishing — the client
47
+ * should re-check the order shortly rather than treat it as failed.
48
+ */
49
+ CANCEL_UNCONFIRMED: 'CANCEL_UNCONFIRMED',
50
+ };
51
+ // ============================================================================
52
+ // Input
53
+ // ============================================================================
54
+ let CancelOrderInput = class CancelOrderInput {
55
+ orderId;
56
+ };
57
+ exports.CancelOrderInput = CancelOrderInput;
58
+ tslib_1.__decorate([
59
+ (0, graphql_1.Field)({
60
+ description: 'Order to cancel — a Shopify order GID (gid://shopify/Order/123) or an order name (e.g. TH1044, #1001, 1044).',
61
+ }),
62
+ tslib_1.__metadata("design:type", String)
63
+ ], CancelOrderInput.prototype, "orderId", void 0);
64
+ exports.CancelOrderInput = CancelOrderInput = tslib_1.__decorate([
65
+ (0, graphql_1.InputType)()
66
+ ], CancelOrderInput);
67
+ // ============================================================================
68
+ // Output
69
+ // ============================================================================
70
+ let CancelOrderResult = class CancelOrderResult {
71
+ success;
72
+ orderId;
73
+ orderName;
74
+ status;
75
+ jobId;
76
+ errorCode;
77
+ message;
78
+ };
79
+ exports.CancelOrderResult = CancelOrderResult;
80
+ tslib_1.__decorate([
81
+ (0, graphql_1.Field)({
82
+ description: 'True only when the order is provably cancelled. False for any rejection or when the cancellation could not be confirmed — see errorCode.',
83
+ }),
84
+ tslib_1.__metadata("design:type", Boolean)
85
+ ], CancelOrderResult.prototype, "success", void 0);
86
+ tslib_1.__decorate([
87
+ (0, graphql_1.Field)({ nullable: true, description: 'Shopify order GID for the order.' }),
88
+ tslib_1.__metadata("design:type", String)
89
+ ], CancelOrderResult.prototype, "orderId", void 0);
90
+ tslib_1.__decorate([
91
+ (0, graphql_1.Field)({ nullable: true, description: 'Order name (e.g. TH1044).' }),
92
+ tslib_1.__metadata("design:type", String)
93
+ ], CancelOrderResult.prototype, "orderName", void 0);
94
+ tslib_1.__decorate([
95
+ (0, graphql_1.Field)({
96
+ nullable: true,
97
+ description: "Order status after the call — 'cancelled' once confirmed.",
98
+ }),
99
+ tslib_1.__metadata("design:type", String)
100
+ ], CancelOrderResult.prototype, "status", void 0);
101
+ tslib_1.__decorate([
102
+ (0, graphql_1.Field)({
103
+ nullable: true,
104
+ description: 'Shopify async cancellation job GID, when the cancel was accepted.',
105
+ }),
106
+ tslib_1.__metadata("design:type", String)
107
+ ], CancelOrderResult.prototype, "jobId", void 0);
108
+ tslib_1.__decorate([
109
+ (0, graphql_1.Field)({
110
+ nullable: true,
111
+ description: 'Stable machine-readable code when success is false (e.g. ORDER_FULFILLED, PAYMENT_METHOD_NOT_ALLOWED, CANCEL_UNCONFIRMED).',
112
+ }),
113
+ tslib_1.__metadata("design:type", String)
114
+ ], CancelOrderResult.prototype, "errorCode", void 0);
115
+ tslib_1.__decorate([
116
+ (0, graphql_1.Field)({
117
+ description: 'Human-readable outcome, so a failure is never returned bare.',
118
+ }),
119
+ tslib_1.__metadata("design:type", String)
120
+ ], CancelOrderResult.prototype, "message", void 0);
121
+ exports.CancelOrderResult = CancelOrderResult = tslib_1.__decorate([
122
+ (0, graphql_1.ObjectType)()
123
+ ], CancelOrderResult);
124
+ //# sourceMappingURL=order-cancel.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-cancel.types.js","sourceRoot":"","sources":["../../src/order-cancel/order-cancel.types.ts"],"names":[],"mappings":";;;;AAAA,6CAA+D;AAE/D;;;;;;;GAOG;AAEH,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IAClC,yDAAyD;IACzD,cAAc,EAAE,6BAA6B;IAC7C,iFAAiF;IACjF,gBAAgB,EAAE,kBAAkB;IACpC;;;;OAIG;IACH,eAAe,EAAE,iBAAiB;IAClC,uDAAuD;IACvD,WAAW,EAAE,0BAA0B;IACvC,4EAA4E;IAC5E,SAAS,EAAE,WAAW;IACtB,+EAA+E;IAC/E,eAAe,EAAE,iBAAiB;IAClC,sCAAsC;IACtC,eAAe,EAAE,iBAAiB;IAClC,gFAAgF;IAChF,0BAA0B,EAAE,4BAA4B;IACxD,kFAAkF;IAClF,aAAa,EAAE,eAAe;IAC9B;;;;OAIG;IACH,kBAAkB,EAAE,oBAAoB;CAChC,CAAC;AAKX,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAGxE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAK3B,OAAO,CAAU;CAClB,CAAA;AANY,4CAAgB;AAK3B;IAJC,IAAA,eAAK,EAAC;QACL,WAAW,EACT,8GAA8G;KACjH,CAAC;;iDACe;2BALN,gBAAgB;IAD5B,IAAA,mBAAS,GAAE;GACC,gBAAgB,CAM5B;AAED,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAGxE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAK5B,OAAO,CAAW;IAGlB,OAAO,CAAU;IAGjB,SAAS,CAAU;IAMnB,MAAM,CAAU;IAOhB,KAAK,CAAU;IAOf,SAAS,CAAU;IAKnB,OAAO,CAAU;CAClB,CAAA;AArCY,8CAAiB;AAK5B;IAJC,IAAA,eAAK,EAAC;QACL,WAAW,EACT,0IAA0I;KAC7I,CAAC;;kDACgB;AAGlB;IADC,IAAA,eAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;kDAC1D;AAGjB;IADC,IAAA,eAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;oDACjD;AAMnB;IAJC,IAAA,eAAK,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,2DAA2D;KACzE,CAAC;;iDACc;AAOhB;IALC,IAAA,eAAK,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,mEAAmE;KACtE,CAAC;;gDACa;AAOf;IALC,IAAA,eAAK,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,4HAA4H;KAC/H,CAAC;;oDACiB;AAKnB;IAHC,IAAA,eAAK,EAAC;QACL,WAAW,EAAE,8DAA8D;KAC5E,CAAC;;kDACe;4BApCN,iBAAiB;IAD7B,IAAA,oBAAU,GAAE;GACA,iBAAiB,CAqC7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pvh-afl/graphql",
3
- "version": "1.1.52",
3
+ "version": "1.1.53",
4
4
  "description": "AFL GraphQL - Shared GraphQL modules for multi-brand commerce platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "@nestjs/common": "^10.0.0",
23
23
  "@nestjs/core": "^10.0.0",
24
24
  "@nestjs/graphql": "^12.0.0",
25
- "@pvh-afl/core": "^1.1.34",
25
+ "@pvh-afl/core": "^1.2.0",
26
26
  "graphql": "^16.0.0"
27
27
  },
28
28
  "devDependencies": {
@@ -32,7 +32,7 @@
32
32
  "@nestjs/core": "^10.4.0",
33
33
  "@nestjs/graphql": "^12.2.0",
34
34
  "@nestjs/testing": "^10.4.0",
35
- "@pvh-afl/core": "^1.1.34",
35
+ "@pvh-afl/core": "^1.2.0",
36
36
  "@types/jest": "^29.5.0",
37
37
  "graphql": "^16.9.0",
38
38
  "graphql-type-json": "^0.3.2",