rerobe-js-orm 3.8.7 → 3.8.9

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.
@@ -20,6 +20,7 @@ class MerchantFromFormState extends MerchantFactory_1.default {
20
20
  webhooks: fs.fields.webhooks.selectedValues,
21
21
  primaryDomain: fs.fields.primaryDomain.inputValue,
22
22
  socialLinks: fs.fields.socialLinks.selectedValue,
23
+ organizationNumber: fs.fields.organizationNumber.inputValue,
23
24
  };
24
25
  return new Merchant_1.default(Object.assign(Object.assign({}, fs.props), MerchantMutableData));
25
26
  }
@@ -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, _3, _4;
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,7 +98,7 @@ 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(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,
@@ -106,6 +106,8 @@ class OrderFromFormState extends OrderFactory_1.default {
106
106
  paymentIntentId: (_2 = fs.props) === null || _2 === void 0 ? void 0 : _2.paymentIntentId,
107
107
  })), (((_3 = fs.props) === null || _3 === void 0 ? void 0 : _3.receiptObj) && {
108
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,
109
111
  }));
110
112
  return new Order_1.default(Object.assign({}, orderAttributes));
111
113
  }
@@ -14,6 +14,7 @@ class MerchantFormState extends FormState_1.default {
14
14
  this.fields.senderEmail = this.fieldFactory('textInput', 'senderEmail');
15
15
  this.fields.industry = this.fieldFactory('singleSelect', 'industry', options_1.industryOptions);
16
16
  this.fields.legalName = this.fieldFactory('textInput', 'legalName');
17
+ this.fields.organizationNumber = this.fieldFactory('textInput', 'organizationNumber');
17
18
  this.fields.phone = this.fieldFactory('textInput', 'phone');
18
19
  this.fields.address = this.fieldFactory('singleSelect', 'address');
19
20
  this.fields.currency = this.fieldFactory('singleSelect', 'currency', options_1.currencyOptions);
@@ -217,10 +217,11 @@ export default class OrderHelpers {
217
217
  getPaymentTerminalReceiptInfo(payload?: any): PaymentTerminalReceiptInfo;
218
218
  getFormattedFulfillmentLocation(order: ReRobeOrderObj): string;
219
219
  generateReceiptLabels(locale: string, paymentMethod: string, entryMode?: string): ReceiptLabels;
220
- buildReceiptObjFromOrder({ order, merchant, merchantLogoUrl, receiptNumber, }: {
220
+ buildReceiptObjFromOrder({ order, merchant, merchantLogoUrl, receiptNumber, additionalInfo, }: {
221
221
  order: ReRobeOrderObj;
222
222
  merchant: MerchantObj;
223
223
  merchantLogoUrl: string;
224
224
  receiptNumber: string;
225
+ additionalInfo: string;
225
226
  }): ReceiptObj;
226
227
  }
@@ -547,7 +547,7 @@ class OrderHelpers {
547
547
  entryModeLabel,
548
548
  };
549
549
  }
550
- buildReceiptObjFromOrder({ order, merchant, merchantLogoUrl = '', receiptNumber = '', }) {
550
+ buildReceiptObjFromOrder({ order, merchant, merchantLogoUrl = '', receiptNumber = '', additionalInfo = '', }) {
551
551
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
552
552
  const { address: merchantAddress, legalName, contactEmail, phone = '', organizationNumber = '', primaryDomain, currency: storeCurrencyCode, } = merchant;
553
553
  const currencyCode = ((_a = order.totalPricePresentment) === null || _a === void 0 ? void 0 : _a.currencyCode) || storeCurrencyCode;
@@ -635,7 +635,8 @@ class OrderHelpers {
635
635
  return Object.assign(Object.assign({ merchantLogoUrl, merchantName: legalName, storeAddress: buildStoreAddress(), phone,
636
636
  contactEmail,
637
637
  organizationNumber,
638
- primaryDomain, storeUrl: `https://${primaryDomain}`, orderDate: (0, Utilities_1.getFormattedTimestamp)(presentmentLocale), receiptNumber, lineItems: buildLineItems(), subTotal: (0, Utilities_1.formatPrice)({
638
+ primaryDomain, storeUrl: `https://${primaryDomain}`, orderDate: (0, Utilities_1.getFormattedTimestamp)(presentmentLocale), receiptNumber,
639
+ additionalInfo, lineItems: buildLineItems(), subTotal: (0, Utilities_1.formatPrice)({
639
640
  currencyCode,
640
641
  amount: (_e = (_d = order.subtotalPricePresentment) === null || _d === void 0 ? void 0 : _d.amount) !== null && _e !== void 0 ? _e : '',
641
642
  fractionDigits: 2,
@@ -79,6 +79,10 @@ 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;
84
+ hasStripeBluetoothReader?: boolean;
85
+ organizationNumber?: string;
82
86
  constructor(props?: any);
83
87
  toObj(): MerchantObj;
84
88
  toMerchantMutableData(): MerchantMutableData;
@@ -47,9 +47,19 @@ class Merchant extends Base_1.default {
47
47
  pinterest: '',
48
48
  tiktok: '',
49
49
  };
50
+ this.organizationNumber = (props === null || props === void 0 ? void 0 : props.organizationNumber) || '';
51
+ if (props === null || props === void 0 ? void 0 : props.isChannelPartner) {
52
+ this.isChannelPartner = props.isChannelPartner;
53
+ }
54
+ if (props === null || props === void 0 ? void 0 : props.isZettleUser) {
55
+ this.isZettleUser = props.isZettleUser;
56
+ }
57
+ if (props === null || props === void 0 ? void 0 : props.hasStripeBluetoothReader) {
58
+ this.hasStripeBluetoothReader = props.hasStripeBluetoothReader;
59
+ }
50
60
  }
51
61
  toObj() {
52
- return {
62
+ const mObj = {
53
63
  name: this.name,
54
64
  type: this.type,
55
65
  paymentTier: this.paymentTier,
@@ -76,7 +86,18 @@ class Merchant extends Base_1.default {
76
86
  primaryDomain: this.primaryDomain,
77
87
  webshopHomePageId: this.webshopHomePageId,
78
88
  socialLinks: this.socialLinks,
89
+ organizationNumber: this.organizationNumber,
79
90
  };
91
+ if (this.isChannelPartner) {
92
+ mObj.isChannelPartner = this.isChannelPartner;
93
+ }
94
+ if (this.isZettleUser) {
95
+ mObj.isZettleUser = this.isZettleUser;
96
+ }
97
+ if (this.hasStripeBluetoothReader) {
98
+ mObj.hasStripeBluetoothReader = this.hasStripeBluetoothReader;
99
+ }
100
+ return mObj;
80
101
  }
81
102
  toMerchantMutableData() {
82
103
  return {
@@ -110,6 +110,7 @@ export default class Order extends Base {
110
110
  paymentIntentObj?: any;
111
111
  paymentIntentId?: string;
112
112
  receiptObj?: ReceiptObj;
113
+ channelPartnerOrderId?: string;
113
114
  constructor(props?: any);
114
115
  toObj(): ReRobeOrderObj;
115
116
  generateSchemaForTypesense(name?: string): {
@@ -141,6 +141,9 @@ class Order extends Base_1.default {
141
141
  if (props === null || props === void 0 ? void 0 : props.receiptObj) {
142
142
  this.receiptObj = props.receiptObj;
143
143
  }
144
+ if (props === null || props === void 0 ? void 0 : props.channelPartnerOrderId) {
145
+ this.channelPartnerOrderId = props.channelPartnerOrderId;
146
+ }
144
147
  }
145
148
  toObj() {
146
149
  const orderObj = {
@@ -229,6 +232,9 @@ class Order extends Base_1.default {
229
232
  if (this.receiptObj) {
230
233
  orderObj.receiptObj = this.receiptObj;
231
234
  }
235
+ if (this.channelPartnerOrderId) {
236
+ orderObj.channelPartnerOrderId = this.channelPartnerOrderId;
237
+ }
232
238
  return orderObj;
233
239
  }
234
240
  generateSchemaForTypesense(name = 'prod_orders_20220809') {
@@ -37,6 +37,8 @@ type MerchantSystemOnlyMutableData = {
37
37
  webshopHomePageId: string;
38
38
  defaultLocation: string;
39
39
  isZettleUser?: boolean;
40
+ isChannelPartner?: boolean;
41
+ hasStripeBluetoothReader?: boolean;
40
42
  };
41
43
  type MerchantObj = MerchantMutableData & MerchantSystemOnlyMutableData;
42
44
  type MerchantTypes = 'INDIVIDUAL' | 'BUSINESS';
@@ -69,6 +71,7 @@ type MerchantFormFields = {
69
71
  senderEmail: TextInputFormField<string>;
70
72
  industry: SingleSelectFormField<string>;
71
73
  legalName: TextInputFormField<string>;
74
+ organizationNumber: TextInputFormField<string>;
72
75
  phone: TextInputFormField<string>;
73
76
  address: SingleSelectFormField<AddressInput>;
74
77
  currency: SingleSelectFormField<string>;
@@ -73,6 +73,7 @@ type ReceiptObj = {
73
73
  taxRates: {
74
74
  [key: string]: string;
75
75
  };
76
+ additionalInfo: string;
76
77
  } & ReceiptLabelsAndPaymentTerminalInfo;
77
78
  type ReRobeOrderObj = {
78
79
  id: string;
@@ -145,6 +146,7 @@ type ReRobeOrderObj = {
145
146
  paymentIntentObj?: any;
146
147
  paymentIntentId?: string;
147
148
  receiptObj?: ReceiptObj;
149
+ channelPartnerOrderId?: string;
148
150
  };
149
151
  type OrderWithRefundsAndFulfillmentsInfoObj = {
150
152
  documentId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.8.7",
3
+ "version": "3.8.9",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",