rerobe-js-orm 4.5.7 → 4.5.8

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.
@@ -10,6 +10,7 @@ export namespace PAYMENT_TYPES {
10
10
  let shoppingCredit: string;
11
11
  let cash: string;
12
12
  let mobilePayment: string;
13
+ let shopifyPayment: string;
13
14
  }
14
15
  export namespace ORDER_STATES {
15
16
  let draft: string;
@@ -21,6 +22,7 @@ export namespace SALES_CHANNELS {
21
22
  let store: string;
22
23
  let onlineStore: string;
23
24
  let thirdParty: string;
25
+ let shopify: string;
24
26
  let ahlens: string;
25
27
  let ribbnMobilePOS: string;
26
28
  let ribbnWebPOS: string;
@@ -51,6 +53,7 @@ export const SALES_CHANNEL_TO_RETURN_POLICY_MAPPING: {
51
53
  [SALES_CHANNELS.webApp]: string;
52
54
  [SALES_CHANNELS.store]: string;
53
55
  [SALES_CHANNELS.onlineStore]: string;
56
+ [SALES_CHANNELS.shopify]: string;
54
57
  [SALES_CHANNELS.thirdParty]: string;
55
58
  [SALES_CHANNELS.ahlens]: string;
56
59
  [SALES_CHANNELS.ribbnMobilePOS]: string;
@@ -13,6 +13,7 @@ exports.PAYMENT_TYPES = {
13
13
  shoppingCredit: 'SHOPPING_CREDIT',
14
14
  cash: 'CASH',
15
15
  mobilePayment: 'MOBILE_PAYMENT',
16
+ shopifyPayment: 'SHOPIFY_PAYMENT',
16
17
  };
17
18
  exports.ORDER_STATES = {
18
19
  draft: 'DRAFT',
@@ -24,6 +25,7 @@ exports.SALES_CHANNELS = {
24
25
  store: 'STORE',
25
26
  onlineStore: 'ONLINE_STORE',
26
27
  thirdParty: 'THIRD_PARTY',
28
+ shopify: 'SHOPIFY',
27
29
  ahlens: 'AHLENS',
28
30
  ribbnMobilePOS: 'RIBBN_MOBILE_POS',
29
31
  ribbnWebPOS: 'RIBBN_WEB_POS',
@@ -54,6 +56,7 @@ exports.SALES_CHANNEL_TO_RETURN_POLICY_MAPPING = {
54
56
  [exports.SALES_CHANNELS.webApp]: exports.RETURN_POLICY_TYPES.inStore,
55
57
  [exports.SALES_CHANNELS.store]: exports.RETURN_POLICY_TYPES.inStore,
56
58
  [exports.SALES_CHANNELS.onlineStore]: exports.RETURN_POLICY_TYPES.online,
59
+ [exports.SALES_CHANNELS.shopify]: exports.RETURN_POLICY_TYPES.online,
57
60
  [exports.SALES_CHANNELS.thirdParty]: exports.RETURN_POLICY_TYPES.inStore,
58
61
  [exports.SALES_CHANNELS.ahlens]: exports.RETURN_POLICY_TYPES.inStore,
59
62
  [exports.SALES_CHANNELS.ribbnMobilePOS]: exports.RETURN_POLICY_TYPES.inStore,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const OrderFactory_1 = require("./OrderFactory");
4
4
  const Order_1 = require("../../models/Order");
5
5
  const OrderHelpers_1 = require("../../helpers/OrderHelpers");
6
+ const order_constants_1 = require("../../constants/order-constants");
6
7
  const orderHelpers = new OrderHelpers_1.default();
7
8
  const fulfillmentStatusRestMapping = {
8
9
  fulfilled: 'FULFILLED',
@@ -274,7 +275,7 @@ class OrderFromShopifyWebhook extends OrderFactory_1.default {
274
275
  fulfillments,
275
276
  refunds,
276
277
  taxLines,
277
- shippingLine, state: Order_1.default.ORDER_STATES.completed, shippingType: orderHelpers.getShippingTypeFromShopifyObj(shipping_lines), paymentType: orderHelpers.getPaymentTypeUsingTags(tags), salesChannel: orderHelpers.getSalesChannelUsingTags(tags), tags: tags ? tags.split(', ') : [] }));
278
+ shippingLine, state: Order_1.default.ORDER_STATES.completed, shippingType: orderHelpers.getShippingTypeFromShopifyObj(shipping_lines), paymentType: orderHelpers.getPaymentTypeUsingTags(tags), salesChannel: order_constants_1.SALES_CHANNELS.shopify, tags: tags ? tags.split(', ') : [] }));
278
279
  return rerobeOrder.toObj();
279
280
  }
280
281
  // Aligned with Shopify REST order payload that includes current_* fields
@@ -580,7 +581,8 @@ class OrderFromShopifyWebhook extends OrderFactory_1.default {
580
581
  // @ts-ignore
581
582
  const fulfillmentStatus = !fulfillment_status ? '' : fulfillmentStatusRestMapping[fulfillment_status];
582
583
  const rerobeOrder = new Order_1.default({
583
- id: orderHelpers.getOrderIdFromShopifyObj({ id, tags }),
584
+ id: this.utilities.makeRandId(28),
585
+ documentId: this.utilities.makeRandId(28),
584
586
  shopifyId: `gid://shopify/Order/${id}`,
585
587
  shopifyOrderNumber: name ? Number(String(name).replace('#', '')) : order_number || 0,
586
588
  name: name || '',
@@ -612,8 +614,8 @@ class OrderFromShopifyWebhook extends OrderFactory_1.default {
612
614
  tags: tags ? String(tags).split(', ').filter(Boolean) : [],
613
615
  state: Order_1.default.ORDER_STATES.completed,
614
616
  shippingType: orderHelpers.getShippingTypeFromShopifyObj((shipping_lines || [])),
615
- paymentType: orderHelpers.getPaymentTypeUsingTags(tags),
616
- salesChannel: orderHelpers.getSalesChannelUsingTags(tags),
617
+ paymentType: order_constants_1.PAYMENT_TYPES.shopifyPayment,
618
+ salesChannel: order_constants_1.SALES_CHANNELS.shopify,
617
619
  });
618
620
  return rerobeOrder.toObj();
619
621
  }
@@ -12,6 +12,7 @@ export default class Order extends Base {
12
12
  shoppingCredit: string;
13
13
  cash: string;
14
14
  mobilePayment: string;
15
+ shopifyPayment: string;
15
16
  };
16
17
  static ORDER_STATES: {
17
18
  draft: string;
@@ -23,6 +24,7 @@ export default class Order extends Base {
23
24
  store: string;
24
25
  onlineStore: string;
25
26
  thirdParty: string;
27
+ shopify: string;
26
28
  ahlens: string;
27
29
  ribbnMobilePOS: string;
28
30
  ribbnWebPOS: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "4.5.7",
3
+ "version": "4.5.8",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",