rerobe-js-orm 3.8.7 → 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.
- package/lib/factories/Order/OrderFromFormState.js +4 -2
- package/lib/models/Merchant.d.ts +2 -0
- package/lib/models/Merchant.js +14 -1
- package/lib/models/Order.d.ts +1 -0
- package/lib/models/Order.js +6 -0
- package/lib/types/merchant-types.d.ts +1 -0
- package/lib/types/rerobe-order-types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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
|
}
|
package/lib/models/Merchant.d.ts
CHANGED
|
@@ -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;
|
package/lib/models/Merchant.js
CHANGED
|
@@ -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
|
-
|
|
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 {
|
package/lib/models/Order.d.ts
CHANGED
|
@@ -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): {
|
package/lib/models/Order.js
CHANGED
|
@@ -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,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';
|