rerobe-js-orm 3.8.6 → 3.8.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.
@@ -5,7 +5,7 @@ const Order_1 = require("../../models/Order");
5
5
  const order_constants_1 = require("../../constants/order-constants");
6
6
  class OrderFromFormState extends OrderFactory_1.default {
7
7
  createOrder(fs) {
8
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
8
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
9
9
  const currencyCode = fs.fields.currencyCode.inputValue || 'SEK';
10
10
  const customer = fs.fields.customer.selectedValue || {};
11
11
  const customerAttr = {
@@ -98,12 +98,16 @@ class OrderFromFormState extends OrderFactory_1.default {
98
98
  fulfillmentStatus: fs.fields.fulfillmentStatus.selectedValue,
99
99
  statusUrl: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.statusUrl) || '',
100
100
  };
101
- const orderAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, totalPricesAttr), presentmentTotalPricesAttr), discountsAttr), shippingAndLocationAttr), customerAttr), statusesAttr), { id: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.id) || '', documentId: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.documentId) || '', name: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.name) || '', orderNumber: (_o = fs.props) === null || _o === void 0 ? void 0 : _o.orderNumber, ribbnOrderNumber: (_p = fs.props) === null || _p === void 0 ? void 0 : _p.ribbnOrderNumber, merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '', currencyCode: fs.fields.currencyCode.inputValue, lineItems: fs.fields.lineItems.selectedValues || [], fulfillments: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.fulfillments) || [], refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [], paymentType: fs.fields.paymentType.selectedValue, paymentMethod: fs.fields.paymentMethod.selectedValue || '', paymentDetails: fs.fields.paymentDetails.selectedValue || {}, notes: fs.fields.notes.inputValue || '', tags: fs.fields.tags.selectedValues || [], cancelReason: fs.fields.cancelReason.selectedValue || '', canceledAt: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.canceledAt) || '', processedAt: ((_u = fs.props) === null || _u === void 0 ? void 0 : _u.processedAt) || new Date().toUTCString(), adjustments: ((_v = fs.props) === null || _v === void 0 ? void 0 : _v.adjustments) || [], createdAtTimestamp: 0, updatedAtTimestamp: 0, createdByUserId: ((_w = fs.props) === null || _w === void 0 ? void 0 : _w.createdByUserId) || '', taxTitle: fs.fields.taxTitle.inputValue || '' }), (((_x = fs.props) === null || _x === void 0 ? void 0 : _x.zettleTransactionObj) && {
101
+ const orderAttributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, totalPricesAttr), presentmentTotalPricesAttr), discountsAttr), shippingAndLocationAttr), customerAttr), statusesAttr), { id: ((_k = fs.props) === null || _k === void 0 ? void 0 : _k.id) || '', documentId: ((_l = fs.props) === null || _l === void 0 ? void 0 : _l.documentId) || '', name: ((_m = fs.props) === null || _m === void 0 ? void 0 : _m.name) || '', orderNumber: (_o = fs.props) === null || _o === void 0 ? void 0 : _o.orderNumber, ribbnOrderNumber: (_p = fs.props) === null || _p === void 0 ? void 0 : _p.ribbnOrderNumber, merchantId: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.merchantId) || '', currencyCode: fs.fields.currencyCode.inputValue, lineItems: fs.fields.lineItems.selectedValues || [], fulfillments: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.fulfillments) || [], refunds: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.refunds) || [], paymentType: fs.fields.paymentType.selectedValue, paymentMethod: fs.fields.paymentMethod.selectedValue || '', paymentDetails: fs.fields.paymentDetails.selectedValue || {}, notes: fs.fields.notes.inputValue || '', tags: fs.fields.tags.selectedValues || [], cancelReason: fs.fields.cancelReason.selectedValue || '', canceledAt: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.canceledAt) || '', processedAt: ((_u = fs.props) === null || _u === void 0 ? void 0 : _u.processedAt) || new Date().toUTCString(), adjustments: ((_v = fs.props) === null || _v === void 0 ? void 0 : _v.adjustments) || [], createdAtTimestamp: 0, updatedAtTimestamp: 0, createdByUserId: ((_w = fs.props) === null || _w === void 0 ? void 0 : _w.createdByUserId) || '', taxTitle: fs.fields.taxTitle.inputValue || '' }), (((_x = fs.props) === null || _x === void 0 ? void 0 : _x.zettleTransactionObj) && {
102
102
  zettleTransactionObj: (_y = fs.props) === null || _y === void 0 ? void 0 : _y.zettleTransactionObj,
103
103
  })), (((_z = fs.props) === null || _z === void 0 ? void 0 : _z.paymentIntentObj) && {
104
104
  paymentIntentObj: (_0 = fs.props) === null || _0 === void 0 ? void 0 : _0.paymentIntentObj,
105
105
  })), (((_1 = fs.props) === null || _1 === void 0 ? void 0 : _1.paymentIntentId) && {
106
106
  paymentIntentId: (_2 = fs.props) === null || _2 === void 0 ? void 0 : _2.paymentIntentId,
107
+ })), (((_3 = fs.props) === null || _3 === void 0 ? void 0 : _3.receiptObj) && {
108
+ receiptObj: (_4 = fs.props) === null || _4 === void 0 ? void 0 : _4.receiptObj,
109
+ })), (((_5 = fs.props) === null || _5 === void 0 ? void 0 : _5.channelPartnerOrderId) && {
110
+ channelPartnerOrderId: (_6 = fs.props) === null || _6 === void 0 ? void 0 : _6.channelPartnerOrderId,
107
111
  }));
108
112
  return new Order_1.default(Object.assign({}, orderAttributes));
109
113
  }
@@ -471,7 +471,7 @@ class OrderHelpers {
471
471
  };
472
472
  }
473
473
  getPaymentTerminalReceiptInfo(payload) {
474
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
474
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
475
475
  let aid = '';
476
476
  let tvr = '';
477
477
  let authorizationCode = '';
@@ -496,10 +496,12 @@ class OrderHelpers {
496
496
  tvr = (_1 = (_0 = (_z = (_y = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _y === void 0 ? void 0 : _y.cardPresentDetails) === null || _z === void 0 ? void 0 : _z.receipt) === null || _0 === void 0 ? void 0 : _0.terminalVerificationResults) !== null && _1 !== void 0 ? _1 : '';
497
497
  authorizationCode = (_5 = (_4 = (_3 = (_2 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _2 === void 0 ? void 0 : _2.cardPresentDetails) === null || _3 === void 0 ? void 0 : _3.receipt) === null || _4 === void 0 ? void 0 : _4.authorizationCode) !== null && _5 !== void 0 ? _5 : '';
498
498
  entryMode = (_8 = (_7 = (_6 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _6 === void 0 ? void 0 : _6.cardPresentDetails) === null || _7 === void 0 ? void 0 : _7.readMethod) !== null && _8 !== void 0 ? _8 : '';
499
- applicationName = (_12 = (_11 = (_10 = (_9 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _9 === void 0 ? void 0 : _9.cardPresentDetails) === null || _10 === void 0 ? void 0 : _10.receipt) === null || _11 === void 0 ? void 0 : _11.applicationPreferredName) !== null && _12 !== void 0 ? _12 : '';
500
- cardBrand = (_15 = (_14 = (_13 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _13 === void 0 ? void 0 : _13.cardPresentDetails) === null || _14 === void 0 ? void 0 : _14.brand) !== null && _15 !== void 0 ? _15 : '';
501
- lastFour = (_18 = (_17 = (_16 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _16 === void 0 ? void 0 : _16.cardPresentDetails) === null || _17 === void 0 ? void 0 : _17.last4) !== null && _18 !== void 0 ? _18 : '';
502
- referenceNumber = (_19 = charge === null || charge === void 0 ? void 0 : charge.id) !== null && _19 !== void 0 ? _19 : '';
499
+ applicationName =
500
+ (_14 = (((_11 = (_10 = (_9 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _9 === void 0 ? void 0 : _9.cardPresentDetails) === null || _10 === void 0 ? void 0 : _10.receipt) === null || _11 === void 0 ? void 0 : _11.applicationPreferredName) ||
501
+ ((_13 = (_12 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _12 === void 0 ? void 0 : _12.cardPresentDetails) === null || _13 === void 0 ? void 0 : _13.brand))) !== null && _14 !== void 0 ? _14 : '';
502
+ cardBrand = (_17 = (_16 = (_15 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _15 === void 0 ? void 0 : _15.cardPresentDetails) === null || _16 === void 0 ? void 0 : _16.brand) !== null && _17 !== void 0 ? _17 : '';
503
+ lastFour = (_20 = (_19 = (_18 = charge === null || charge === void 0 ? void 0 : charge.paymentMethodDetails) === null || _18 === void 0 ? void 0 : _18.cardPresentDetails) === null || _19 === void 0 ? void 0 : _19.last4) !== null && _20 !== void 0 ? _20 : '';
504
+ referenceNumber = (_21 = charge === null || charge === void 0 ? void 0 : charge.id) !== null && _21 !== void 0 ? _21 : '';
503
505
  }
504
506
  return {
505
507
  aid,
@@ -79,6 +79,8 @@ export default class Merchant extends Base {
79
79
  primaryDomain: string;
80
80
  webshopHomePageId: string;
81
81
  socialLinks: SocialLinksType | null;
82
+ isChannelPartner?: boolean;
83
+ isZettleUser?: boolean;
82
84
  constructor(props?: any);
83
85
  toObj(): MerchantObj;
84
86
  toMerchantMutableData(): MerchantMutableData;
@@ -47,9 +47,15 @@ class Merchant extends Base_1.default {
47
47
  pinterest: '',
48
48
  tiktok: '',
49
49
  };
50
+ if (props === null || props === void 0 ? void 0 : props.isChannelPartner) {
51
+ this.isChannelPartner = props.isChannelPartner;
52
+ }
53
+ if (props === null || props === void 0 ? void 0 : props.isZettleUser) {
54
+ this.isZettleUser = props.isZettleUser;
55
+ }
50
56
  }
51
57
  toObj() {
52
- return {
58
+ const mObj = {
53
59
  name: this.name,
54
60
  type: this.type,
55
61
  paymentTier: this.paymentTier,
@@ -77,6 +83,13 @@ class Merchant extends Base_1.default {
77
83
  webshopHomePageId: this.webshopHomePageId,
78
84
  socialLinks: this.socialLinks,
79
85
  };
86
+ if (this.isChannelPartner) {
87
+ mObj.isChannelPartner = this.isChannelPartner;
88
+ }
89
+ if (this.isZettleUser) {
90
+ mObj.isZettleUser = this.isZettleUser;
91
+ }
92
+ return mObj;
80
93
  }
81
94
  toMerchantMutableData() {
82
95
  return {
@@ -109,6 +109,8 @@ export default class Order extends Base {
109
109
  zettleTransactionObj?: ZettleTransactionObj;
110
110
  paymentIntentObj?: any;
111
111
  paymentIntentId?: string;
112
+ receiptObj?: ReceiptObj;
113
+ channelPartnerOrderId?: string;
112
114
  constructor(props?: any);
113
115
  toObj(): ReRobeOrderObj;
114
116
  generateSchemaForTypesense(name?: string): {
@@ -138,6 +138,12 @@ class Order extends Base_1.default {
138
138
  if (props === null || props === void 0 ? void 0 : props.paymentIntentId) {
139
139
  this.paymentIntentId = props.paymentIntentId;
140
140
  }
141
+ if (props === null || props === void 0 ? void 0 : props.receiptObj) {
142
+ this.receiptObj = props.receiptObj;
143
+ }
144
+ if (props === null || props === void 0 ? void 0 : props.channelPartnerOrderId) {
145
+ this.channelPartnerOrderId = props.channelPartnerOrderId;
146
+ }
141
147
  }
142
148
  toObj() {
143
149
  const orderObj = {
@@ -223,6 +229,12 @@ class Order extends Base_1.default {
223
229
  if (this.paymentIntentId) {
224
230
  orderObj.paymentIntentId = this.paymentIntentId;
225
231
  }
232
+ if (this.receiptObj) {
233
+ orderObj.receiptObj = this.receiptObj;
234
+ }
235
+ if (this.channelPartnerOrderId) {
236
+ orderObj.channelPartnerOrderId = this.channelPartnerOrderId;
237
+ }
226
238
  return orderObj;
227
239
  }
228
240
  generateSchemaForTypesense(name = 'prod_orders_20220809') {
@@ -37,6 +37,7 @@ type MerchantSystemOnlyMutableData = {
37
37
  webshopHomePageId: string;
38
38
  defaultLocation: string;
39
39
  isZettleUser?: boolean;
40
+ isChannelPartner?: boolean;
40
41
  };
41
42
  type MerchantObj = MerchantMutableData & MerchantSystemOnlyMutableData;
42
43
  type MerchantTypes = 'INDIVIDUAL' | 'BUSINESS';
@@ -144,6 +144,8 @@ type ReRobeOrderObj = {
144
144
  zettleTransactionObj?: ZettleTransactionObj;
145
145
  paymentIntentObj?: any;
146
146
  paymentIntentId?: string;
147
+ receiptObj?: ReceiptObj;
148
+ channelPartnerOrderId?: string;
147
149
  };
148
150
  type OrderWithRefundsAndFulfillmentsInfoObj = {
149
151
  documentId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.8.6",
3
+ "version": "3.8.8",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",