rerobe-js-orm 2.9.5 → 2.9.6
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.d.ts +1 -0
- package/lib/factories/Order/OrderFromFormState.js +75 -58
- package/lib/form-states/FormState.d.ts +6 -0
- package/lib/form-states/FormState.js +12 -0
- package/lib/form-states/Order/OrderFormState.js +15 -2
- package/lib/form-states/Order/options.d.ts +7 -0
- package/lib/form-states/Order/options.js +25 -1
- package/lib/models/Order.d.ts +5 -0
- package/lib/models/Order.js +17 -21
- package/lib/types/rerobe-form-types.d.ts +1 -1
- package/lib/types/rerobe-order-types.d.ts +44 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import OrderFactory from './OrderFactory';
|
|
2
2
|
import OrderFormState from '../../form-states/Order/OrderFormState';
|
|
3
3
|
export default class OrderFromFormState extends OrderFactory {
|
|
4
|
+
getCustomerNameFromOrderFormState(fs: OrderFormState): string;
|
|
4
5
|
createOrder(fs: OrderFormState): ReRobeOrderObj;
|
|
5
6
|
}
|
|
@@ -2,41 +2,66 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const OrderFactory_1 = require("./OrderFactory");
|
|
4
4
|
const Order_1 = require("../../models/Order");
|
|
5
|
+
const order_constants_1 = require("../../constants/order-constants");
|
|
5
6
|
class OrderFromFormState extends OrderFactory_1.default {
|
|
6
|
-
|
|
7
|
-
var _a, _b
|
|
8
|
-
const currencyCode = fs.fields.currencyCode.inputValue || 'SEK';
|
|
7
|
+
getCustomerNameFromOrderFormState(fs) {
|
|
8
|
+
var _a, _b;
|
|
9
9
|
const customer = fs.fields.customer.selectedValue || {};
|
|
10
10
|
const firstName = fs.fields.firstName.inputValue;
|
|
11
11
|
const lastName = fs.fields.lastName.inputValue;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
12
|
+
if ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.customerName) {
|
|
13
|
+
return (_b = fs.props) === null || _b === void 0 ? void 0 : _b.customerName;
|
|
14
|
+
}
|
|
15
|
+
if (customer.displayName) {
|
|
16
|
+
return customer.displayName;
|
|
17
|
+
}
|
|
18
|
+
if (customer.firstName || customer.lastName) {
|
|
19
|
+
return `${customer.firstName} ${customer.lastName}`.trim();
|
|
20
|
+
}
|
|
21
|
+
if (firstName || lastName) {
|
|
22
|
+
return `${firstName} ${lastName}`.trim();
|
|
23
|
+
}
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
createOrder(fs) {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
28
|
+
const currencyCode = fs.fields.currencyCode.inputValue || 'SEK';
|
|
29
|
+
const customer = fs.fields.customer.selectedValue || {};
|
|
30
|
+
const customerAttr = {
|
|
31
|
+
userId: (customer === null || customer === void 0 ? void 0 : customer.uid) || '',
|
|
32
|
+
customerName: this.getCustomerNameFromOrderFormState(fs),
|
|
33
|
+
email: (customer === null || customer === void 0 ? void 0 : customer.email) || fs.fields.email.inputValue || '',
|
|
34
|
+
phone: (customer === null || customer === void 0 ? void 0 : customer.phone) || fs.fields.phone.inputValue || '',
|
|
35
|
+
customerUrl: ((_a = fs.props) === null || _a === void 0 ? void 0 : _a.customerUrl) || '',
|
|
36
|
+
};
|
|
37
|
+
const discountsAttr = {
|
|
38
|
+
appliedDiscount: {
|
|
39
|
+
amount: ((_b = fs.fields) === null || _b === void 0 ? void 0 : _b.totalDiscount.inputValue) || 0,
|
|
40
|
+
value: ((_c = fs.fields) === null || _c === void 0 ? void 0 : _c.totalDiscount.inputValue) || 0,
|
|
41
|
+
title: ((_d = fs.fields) === null || _d === void 0 ? void 0 : _d.discountTitle.inputValue) || '',
|
|
42
|
+
valueType: 'FIXED_AMOUNT',
|
|
38
43
|
},
|
|
39
|
-
|
|
44
|
+
discountApplications: ((_e = fs.props) === null || _e === void 0 ? void 0 : _e.discountApplications) || [],
|
|
45
|
+
creditDiscount: { amount: fs.fields.creditDiscount.inputValue || 0, currencyCode },
|
|
46
|
+
saleDiscount: { amount: fs.fields.saleDiscount.inputValue || 0, currencyCode },
|
|
47
|
+
additionalDiscount: { amount: fs.fields.additionalDiscount.inputValue || 0, currencyCode },
|
|
48
|
+
};
|
|
49
|
+
const initShippingAddress = {
|
|
50
|
+
id: '',
|
|
51
|
+
address1: '',
|
|
52
|
+
address2: '',
|
|
53
|
+
city: '',
|
|
54
|
+
country: '',
|
|
55
|
+
countryCode: '',
|
|
56
|
+
province: '',
|
|
57
|
+
zip: '',
|
|
58
|
+
};
|
|
59
|
+
const shippingAndLocationAttr = {
|
|
60
|
+
fulfillmentLocations: ((_f = fs.fields.shippingInfo.selectedValue) === null || _f === void 0 ? void 0 : _f.productsLocationsMapping) || [],
|
|
61
|
+
shippingAddress: fs.fields.shippingType.selectedValue === order_constants_1.SHIPPING_TYPES.localPickUp
|
|
62
|
+
? initShippingAddress
|
|
63
|
+
: fs.fields.shippingAddress.selectedValue || initShippingAddress,
|
|
64
|
+
shippingDiscountAllocations: ((_g = fs.props) === null || _g === void 0 ? void 0 : _g.shippingDiscountAllocations) || [],
|
|
40
65
|
shippingLine: fs.fields.shippingLine
|
|
41
66
|
? fs.fields.shippingLine.selectedValue
|
|
42
67
|
: {
|
|
@@ -47,19 +72,6 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
47
72
|
source: '',
|
|
48
73
|
},
|
|
49
74
|
shippingType: fs.fields.shippingType.selectedValue,
|
|
50
|
-
paymentType: fs.fields.paymentType.selectedValue,
|
|
51
|
-
subtotalPrice: { amount: fs.fields.subtotalPrice.inputValue || 0, currencyCode },
|
|
52
|
-
totalDiscount: { amount: fs.fields.totalDiscount.inputValue || 0, currencyCode },
|
|
53
|
-
totalPrice: { amount: fs.fields.totalPrice.inputValue || 0, currencyCode },
|
|
54
|
-
totalRefunded: { amount: fs.fields.totalRefunded.inputValue || 0, currencyCode },
|
|
55
|
-
totalShippingPrice: { amount: fs.fields.totalShippingPrice.inputValue || 0, currencyCode },
|
|
56
|
-
totalTax: { amount: fs.fields.totalTax.inputValue || 0, currencyCode },
|
|
57
|
-
originalTotalPrice: { amount: fs.fields.originalTotalPrice.inputValue || 0, currencyCode },
|
|
58
|
-
lineItems: fs.fields.lineItems.selectedValues || [],
|
|
59
|
-
cancelReason: fs.fields.cancelReason.selectedValue || '',
|
|
60
|
-
canceledAt: ((_o = fs.props) === null || _o === void 0 ? void 0 : _o.canceledAt) || '',
|
|
61
|
-
customerUrl: ((_p = fs.props) === null || _p === void 0 ? void 0 : _p.customerUrl) || '',
|
|
62
|
-
discountApplications: ((_q = fs.props) === null || _q === void 0 ? void 0 : _q.discountApplications) || [],
|
|
63
75
|
physicalLocation: fs.fields.physicalLocation.selectedValue || {
|
|
64
76
|
id: '',
|
|
65
77
|
activatable: true,
|
|
@@ -76,28 +88,33 @@ class OrderFromFormState extends OrderFactory_1.default {
|
|
|
76
88
|
isActive: false,
|
|
77
89
|
name: 'string',
|
|
78
90
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
customerName: ((_r = fs.props) === null || _r === void 0 ? void 0 : _r.customerName) ||
|
|
82
|
-
(customer.displayName ? customer.displayName : '') ||
|
|
83
|
-
(customer.firstName && customer.lastName ? `${customer.firstName} ${customer.lastName}` : '') ||
|
|
84
|
-
(firstName && lastName ? `${firstName} ${lastName}` : ''),
|
|
85
|
-
email: (customer === null || customer === void 0 ? void 0 : customer.email) || fs.fields.email.inputValue || '',
|
|
86
|
-
phone: (customer === null || customer === void 0 ? void 0 : customer.phone) || fs.fields.phone.inputValue || '',
|
|
87
|
-
paymentMethod: fs.fields.paymentMethod.selectedValue || '',
|
|
88
|
-
paymentDetails: fs.fields.paymentDetails.selectedValue || {},
|
|
89
|
-
merchantId: ((_s = fs.props) === null || _s === void 0 ? void 0 : _s.merchantId) || '',
|
|
90
|
-
tags: fs.fields.tags.selectedValues || [],
|
|
91
|
-
refunds: ((_t = fs.props) === null || _t === void 0 ? void 0 : _t.refunds) || [],
|
|
91
|
+
};
|
|
92
|
+
const presentmentTotalPricesAttr = {
|
|
92
93
|
subtotalPricePresentment: fs.props.subtotalPricePresentment,
|
|
93
94
|
totalDiscountPresentment: fs.props.totalDiscountPresentment,
|
|
94
95
|
totalPricePresentment: fs.props.totalPricePresentment,
|
|
95
96
|
totalRefundedPresentment: fs.props.totalRefundedPresentment,
|
|
96
97
|
totalShippingPricePresentment: fs.props.totalShippingPricePresentment,
|
|
97
98
|
totalTaxPresentment: fs.props.totalTaxPresentment,
|
|
98
|
-
createdAtTimestamp: 0,
|
|
99
|
-
updatedAtTimestamp: 0,
|
|
100
99
|
};
|
|
100
|
+
const totalPricesAttr = {
|
|
101
|
+
subtotalPrice: { amount: fs.fields.subtotalPrice.inputValue || 0, currencyCode },
|
|
102
|
+
subTotalWithSalePriceIncluded: { amount: fs.fields.subTotalWithSalePriceIncluded.inputValue || 0, currencyCode },
|
|
103
|
+
subTotalWithShipping: { amount: fs.fields.subTotalWithShipping.inputValue || 0, currencyCode },
|
|
104
|
+
totalDiscount: { amount: fs.fields.totalDiscount.inputValue || 0, currencyCode },
|
|
105
|
+
totalPrice: { amount: fs.fields.totalPrice.inputValue || 0, currencyCode },
|
|
106
|
+
totalRefunded: { amount: fs.fields.totalRefunded.inputValue || 0, currencyCode },
|
|
107
|
+
totalShippingPrice: { amount: fs.fields.totalShippingPrice.inputValue || 0, currencyCode },
|
|
108
|
+
totalTax: { amount: fs.fields.totalTax.inputValue || 0, currencyCode },
|
|
109
|
+
originalTotalPrice: { amount: fs.fields.originalTotalPrice.inputValue || 0, currencyCode },
|
|
110
|
+
};
|
|
111
|
+
const statusesAttr = {
|
|
112
|
+
state: ((_h = fs.props) === null || _h === void 0 ? void 0 : _h.state) || Order_1.default.ORDER_STATES.draft,
|
|
113
|
+
financialStatus: fs.fields.financialStatus.selectedValue,
|
|
114
|
+
fulfillmentStatus: fs.fields.fulfillmentStatus.selectedValue,
|
|
115
|
+
statusUrl: ((_j = fs.props) === null || _j === void 0 ? void 0 : _j.statusUrl) || '',
|
|
116
|
+
};
|
|
117
|
+
const orderAttributes = 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(), createdAtTimestamp: 0, updatedAtTimestamp: 0 });
|
|
101
118
|
return new Order_1.default(Object.assign({}, orderAttributes));
|
|
102
119
|
}
|
|
103
120
|
}
|
|
@@ -9,4 +9,10 @@ export default abstract class FormState extends Base {
|
|
|
9
9
|
onAddNewOptionToFormFieldOptions(key: keyof FormStateObject, option: FormFieldOption): void;
|
|
10
10
|
onSetNewFormFieldOptions(key: keyof FormStateObject, options: FormFieldOption[]): void;
|
|
11
11
|
editExistingOption(key: keyof FormStateObject, oldOptionValue: string, option: FormFieldOption): void;
|
|
12
|
+
setTextInputFormStateFields(formStateSlice: {
|
|
13
|
+
[key: string]: string | number | null;
|
|
14
|
+
}): void;
|
|
15
|
+
setSingleSelectFormStateFields(formStateSlice: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}): void;
|
|
12
18
|
}
|
|
@@ -50,5 +50,17 @@ class FormState extends Base_1.default {
|
|
|
50
50
|
formField.options[existingOptionIndex] = option;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
setTextInputFormStateFields(formStateSlice) {
|
|
54
|
+
Object.keys(formStateSlice).forEach((key) => {
|
|
55
|
+
const field = this.fields[key];
|
|
56
|
+
field.inputValue = formStateSlice[key] || '';
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
setSingleSelectFormStateFields(formStateSlice) {
|
|
60
|
+
Object.keys(formStateSlice).forEach((key) => {
|
|
61
|
+
const field = this.fields[key];
|
|
62
|
+
field.selectedValue = formStateSlice[key] || '';
|
|
63
|
+
});
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
exports.default = FormState;
|
|
@@ -15,7 +15,7 @@ class OrderFormState extends FormState_1.default {
|
|
|
15
15
|
this.fields.financialStatus = this.fieldFactory('singleSelect', 'financialStatus', options_1.financialStatusOptions);
|
|
16
16
|
this.fields.fulfillmentStatus = this.fieldFactory('singleSelect', 'fulfillmentStatus', options_1.fulfillmentStatusOptions);
|
|
17
17
|
this.fields.shippingAddress = this.fieldFactory('singleSelect', 'shippingAddress');
|
|
18
|
-
this.fields.shippingType = this.fieldFactory('singleSelect', 'shippingType');
|
|
18
|
+
this.fields.shippingType = this.fieldFactory('singleSelect', 'shippingType', options_1.defaultShippingTypeOptions);
|
|
19
19
|
this.fields.paymentType = this.fieldFactory('singleSelect', 'paymentType');
|
|
20
20
|
this.fields.subtotalPrice = this.fieldFactory('textInput', 'subtotalPrice');
|
|
21
21
|
this.fields.totalPrice = this.fieldFactory('textInput', 'totalPrice');
|
|
@@ -36,6 +36,15 @@ class OrderFormState extends FormState_1.default {
|
|
|
36
36
|
this.fields.paymentMethod = this.fieldFactory('singleSelect', 'paymentMethod');
|
|
37
37
|
this.fields.paymentDetails = this.fieldFactory('singleSelect', 'paymentDetails');
|
|
38
38
|
this.fields.tags = this.fieldFactory('multiSelect', 'tags', options_1.defaultTags);
|
|
39
|
+
this.fields.subTotalWithSalePriceIncluded = this.fieldFactory('textInput', 'subTotalWithSalePriceIncluded');
|
|
40
|
+
this.fields.subTotalWithShipping = this.fieldFactory('textInput', 'subTotalWithShipping');
|
|
41
|
+
this.fields.discountTitle = this.fieldFactory('textInput', 'discountTitle');
|
|
42
|
+
this.fields.creditDiscount = this.fieldFactory('textInput', 'creditDiscount');
|
|
43
|
+
this.fields.saleDiscount = this.fieldFactory('textInput', 'saleDiscount');
|
|
44
|
+
this.fields.availableCredit = this.fieldFactory('textInput', 'availableCredit');
|
|
45
|
+
this.fields.additionalDiscount = this.fieldFactory('textInput', 'additionalDiscount');
|
|
46
|
+
this.fields.shippingInfo = this.fieldFactory('singleSelect', 'shippingInfo');
|
|
47
|
+
this.fields.pickupLocation = this.fieldFactory('singleSelect', 'pickupLocation');
|
|
39
48
|
}
|
|
40
49
|
createOrder() {
|
|
41
50
|
const orderFactory = new OrderFromFormState_1.default();
|
|
@@ -103,7 +112,11 @@ class OrderFormState extends FormState_1.default {
|
|
|
103
112
|
fieldKey === 'totalShippingPrice' ||
|
|
104
113
|
fieldKey === 'totalTax' ||
|
|
105
114
|
fieldKey === 'totalRefunded' ||
|
|
106
|
-
fieldKey === 'originalTotalPrice'
|
|
115
|
+
fieldKey === 'originalTotalPrice' ||
|
|
116
|
+
fieldKey === 'creditDiscount' ||
|
|
117
|
+
fieldKey === 'saleDiscount' ||
|
|
118
|
+
fieldKey === 'additionalDiscount' ||
|
|
119
|
+
fieldKey === 'subTotalWithShipping') {
|
|
107
120
|
// @ts-ignore
|
|
108
121
|
inputValue = this.props[fieldKey] ? this.props[fieldKey].amount : 0;
|
|
109
122
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultTags = exports.cancelTypeOptions = exports.fulfillmentStatusOptions = exports.financialStatusOptions = void 0;
|
|
3
|
+
exports.defaultShippingTypeOptions = exports.defaultTags = exports.cancelTypeOptions = exports.fulfillmentStatusOptions = exports.financialStatusOptions = void 0;
|
|
4
4
|
const financialStatusOptions = [
|
|
5
5
|
{ label: 'Authorized', value: 'AUTHORIZED' },
|
|
6
6
|
{ label: 'Paid', value: 'PAID' },
|
|
@@ -34,3 +34,27 @@ const defaultTags = [
|
|
|
34
34
|
{ label: 'third-party-channel', value: 'third-party-channel' },
|
|
35
35
|
];
|
|
36
36
|
exports.defaultTags = defaultTags;
|
|
37
|
+
const defaultShippingTypeOptions = [
|
|
38
|
+
{
|
|
39
|
+
label: 'Local pick up',
|
|
40
|
+
value: 'LOCAL_PICK_UP',
|
|
41
|
+
description: 'FREE',
|
|
42
|
+
price: 0,
|
|
43
|
+
disabled: false,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: 'Local delivery',
|
|
47
|
+
value: 'LOCAL_DELIVERY',
|
|
48
|
+
description: '',
|
|
49
|
+
price: 0,
|
|
50
|
+
disabled: true,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: 'Shipping',
|
|
54
|
+
value: 'SHIPPING',
|
|
55
|
+
description: '',
|
|
56
|
+
price: 0,
|
|
57
|
+
disabled: true,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
exports.defaultShippingTypeOptions = defaultShippingTypeOptions;
|
package/lib/models/Order.d.ts
CHANGED
|
@@ -72,6 +72,9 @@ export default class Order extends Base {
|
|
|
72
72
|
customerUrl: string;
|
|
73
73
|
email: string;
|
|
74
74
|
phone: string;
|
|
75
|
+
creditDiscount: Money;
|
|
76
|
+
saleDiscount: Money;
|
|
77
|
+
additionalDiscount: Money;
|
|
75
78
|
discountApplications: DiscountApplication[];
|
|
76
79
|
physicalLocation: OrderLocation;
|
|
77
80
|
paymentType: ReRobePaymentTypes;
|
|
@@ -84,6 +87,8 @@ export default class Order extends Base {
|
|
|
84
87
|
merchantId: string;
|
|
85
88
|
refunds: OrderRefund[];
|
|
86
89
|
subtotalPricePresentment: Money;
|
|
90
|
+
subTotalWithSalePriceIncluded: Money;
|
|
91
|
+
subTotalWithShipping: Money;
|
|
87
92
|
totalDiscountPresentment: Money;
|
|
88
93
|
totalPricePresentment: Money;
|
|
89
94
|
totalRefundedPresentment: Money;
|
package/lib/models/Order.js
CHANGED
|
@@ -52,34 +52,25 @@ class Order extends Base_1.default {
|
|
|
52
52
|
this.shopifyId = (props === null || props === void 0 ? void 0 : props.shopifyId) || null;
|
|
53
53
|
this.shopifyOrderNumber = (props === null || props === void 0 ? void 0 : props.shopifyOrderNumber) || null;
|
|
54
54
|
this.ribbnOrderNumber = (props === null || props === void 0 ? void 0 : props.ribbnOrderNumber) || null;
|
|
55
|
-
this.subtotalPrice = (props === null || props === void 0 ? void 0 : props.subtotalPrice) || {
|
|
56
|
-
|
|
57
|
-
};
|
|
55
|
+
this.subtotalPrice = (props === null || props === void 0 ? void 0 : props.subtotalPrice) || { amount: 0 };
|
|
56
|
+
this.subTotalWithSalePriceIncluded = (props === null || props === void 0 ? void 0 : props.subTotalWithSalePriceIncluded) || { amount: 0 };
|
|
57
|
+
this.subTotalWithShipping = (props === null || props === void 0 ? void 0 : props.subTotalWithShipping) || { amount: 0 };
|
|
58
58
|
this.tags = (props === null || props === void 0 ? void 0 : props.tags) || [];
|
|
59
|
-
this.totalDiscount = (props === null || props === void 0 ? void 0 : props.totalDiscount) || {
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
};
|
|
65
|
-
this.totalRefunded = (props === null || props === void 0 ? void 0 : props.totalRefunded) || {
|
|
66
|
-
amount: 0,
|
|
67
|
-
};
|
|
68
|
-
this.totalShippingPrice = (props === null || props === void 0 ? void 0 : props.totalShippingPrice) || {
|
|
69
|
-
amount: 0,
|
|
70
|
-
};
|
|
71
|
-
this.totalTax = (props === null || props === void 0 ? void 0 : props.totalTax) || {
|
|
72
|
-
amount: 0,
|
|
73
|
-
};
|
|
74
|
-
this.originalTotalPrice = (props === null || props === void 0 ? void 0 : props.originalTotalPrice) || {
|
|
75
|
-
amount: 0,
|
|
76
|
-
};
|
|
59
|
+
this.totalDiscount = (props === null || props === void 0 ? void 0 : props.totalDiscount) || { amount: 0 };
|
|
60
|
+
this.totalPrice = (props === null || props === void 0 ? void 0 : props.totalPrice) || { amount: 0 };
|
|
61
|
+
this.totalRefunded = (props === null || props === void 0 ? void 0 : props.totalRefunded) || { amount: 0 };
|
|
62
|
+
this.totalShippingPrice = (props === null || props === void 0 ? void 0 : props.totalShippingPrice) || { amount: 0 };
|
|
63
|
+
this.totalTax = (props === null || props === void 0 ? void 0 : props.totalTax) || { amount: 0 };
|
|
64
|
+
this.originalTotalPrice = (props === null || props === void 0 ? void 0 : props.originalTotalPrice) || { amount: 0 };
|
|
77
65
|
this.lineItems = (props === null || props === void 0 ? void 0 : props.lineItems) || [];
|
|
78
66
|
this.cancelReason = (props === null || props === void 0 ? void 0 : props.cancelReason) ? props === null || props === void 0 ? void 0 : props.cancelReason.toUpperCase() : '';
|
|
79
67
|
this.canceledAt = (props === null || props === void 0 ? void 0 : props.canceledAt) || '';
|
|
80
68
|
this.customerUrl = (props === null || props === void 0 ? void 0 : props.customerUrl) || '';
|
|
81
69
|
this.email = (props === null || props === void 0 ? void 0 : props.email) || '';
|
|
82
70
|
this.phone = (props === null || props === void 0 ? void 0 : props.phone) || '';
|
|
71
|
+
this.creditDiscount = (props === null || props === void 0 ? void 0 : props.creditDiscount) || { amount: 0 };
|
|
72
|
+
this.saleDiscount = (props === null || props === void 0 ? void 0 : props.saleDiscount) || { amount: 0 };
|
|
73
|
+
this.additionalDiscount = (props === null || props === void 0 ? void 0 : props.additionalDiscount) || { amount: 0 };
|
|
83
74
|
this.discountApplications = (props === null || props === void 0 ? void 0 : props.discountApplications) || [];
|
|
84
75
|
this.physicalLocation = (props === null || props === void 0 ? void 0 : props.physicalLocation) || {
|
|
85
76
|
id: '',
|
|
@@ -150,6 +141,8 @@ class Order extends Base_1.default {
|
|
|
150
141
|
shopifyOrderNumber: this.shopifyOrderNumber,
|
|
151
142
|
ribbnOrderNumber: this.ribbnOrderNumber,
|
|
152
143
|
subtotalPrice: this.subtotalPrice,
|
|
144
|
+
subTotalWithSalePriceIncluded: this.subTotalWithSalePriceIncluded,
|
|
145
|
+
subTotalWithShipping: this.subTotalWithShipping,
|
|
153
146
|
tags: this.tags,
|
|
154
147
|
totalDiscount: this.totalDiscount,
|
|
155
148
|
totalPrice: this.totalPrice,
|
|
@@ -163,6 +156,9 @@ class Order extends Base_1.default {
|
|
|
163
156
|
customerUrl: this.customerUrl,
|
|
164
157
|
email: this.email,
|
|
165
158
|
phone: this.phone,
|
|
159
|
+
creditDiscount: this.creditDiscount,
|
|
160
|
+
saleDiscount: this.saleDiscount,
|
|
161
|
+
additionalDiscount: this.additionalDiscount,
|
|
166
162
|
discountApplications: this.discountApplications,
|
|
167
163
|
physicalLocation: this.physicalLocation,
|
|
168
164
|
state: this.state,
|
|
@@ -18,6 +18,9 @@ declare type DraftOrderObj = {
|
|
|
18
18
|
declare type ReRobeOrderObj = {
|
|
19
19
|
id: string;
|
|
20
20
|
appliedDiscount: AppliedDiscount;
|
|
21
|
+
creditDiscount?: Money;
|
|
22
|
+
saleDiscount?: Money;
|
|
23
|
+
additionalDiscount?: Money;
|
|
21
24
|
documentId?: string;
|
|
22
25
|
name: string;
|
|
23
26
|
orderNumber: number;
|
|
@@ -42,6 +45,8 @@ declare type ReRobeOrderObj = {
|
|
|
42
45
|
shopifyOrderNumber?: number | null;
|
|
43
46
|
ribbnOrderNumber?: number | null;
|
|
44
47
|
subtotalPrice: Money;
|
|
48
|
+
subTotalWithSalePriceIncluded?: Money;
|
|
49
|
+
subTotalWithShipping?: Money;
|
|
45
50
|
tags?: string[] | string | null;
|
|
46
51
|
totalDiscount: Money;
|
|
47
52
|
totalPrice: Money;
|
|
@@ -629,6 +634,36 @@ declare type ShippingLineRest = {
|
|
|
629
634
|
tax_lines: TaxLineRest[];
|
|
630
635
|
carrier_identifier: string | null;
|
|
631
636
|
};
|
|
637
|
+
declare type FulfillmentLocationInfo = {
|
|
638
|
+
locationId: string;
|
|
639
|
+
name: string;
|
|
640
|
+
address1: string;
|
|
641
|
+
address2: string;
|
|
642
|
+
city: string;
|
|
643
|
+
country: string;
|
|
644
|
+
countryCode: string;
|
|
645
|
+
province: string;
|
|
646
|
+
zip: string;
|
|
647
|
+
};
|
|
648
|
+
declare type ShippingTypeOption = {
|
|
649
|
+
label: string;
|
|
650
|
+
value: ReRobeShippingAndDeliveryTypes;
|
|
651
|
+
description: string;
|
|
652
|
+
price: string | number;
|
|
653
|
+
disabled: boolean;
|
|
654
|
+
};
|
|
655
|
+
declare type ProductLocationMapping = {
|
|
656
|
+
location: FulfillmentLocationInfo;
|
|
657
|
+
productsIds: string[];
|
|
658
|
+
shippingPrice: number | string;
|
|
659
|
+
shippingRateName: string;
|
|
660
|
+
};
|
|
661
|
+
declare type OrderShippingInfo = {
|
|
662
|
+
description: string;
|
|
663
|
+
price: string | number | null;
|
|
664
|
+
disabled: boolean;
|
|
665
|
+
productsLocationsMapping: ProductLocationMapping[];
|
|
666
|
+
};
|
|
632
667
|
declare type CompleteOrder = ReRobeOrderObj & {
|
|
633
668
|
[key: string]: any;
|
|
634
669
|
};
|
|
@@ -667,6 +702,15 @@ declare type OrderAttributesFormFields = {
|
|
|
667
702
|
paymentDetails: SingleSelectFormField<PaymentDetails>;
|
|
668
703
|
tags: MultiSelectFormField<string>;
|
|
669
704
|
refunds: MultiSelectFormField<OrderRefund>;
|
|
705
|
+
subTotalWithSalePriceIncluded: TextInputFormField<string | number>;
|
|
706
|
+
subTotalWithShipping: TextInputFormField<string | number>;
|
|
707
|
+
discountTitle: TextInputFormField<string>;
|
|
708
|
+
creditDiscount: TextInputFormField<string | number>;
|
|
709
|
+
saleDiscount: TextInputFormField<string | number>;
|
|
710
|
+
availableCredit: TextInputFormField<string | number>;
|
|
711
|
+
additionalDiscount: TextInputFormField<string | number>;
|
|
712
|
+
shippingInfo: SingleSelectFormField<OrderShippingInfo>;
|
|
713
|
+
pickupLocation: SingleSelectFormField<string>;
|
|
670
714
|
};
|
|
671
715
|
declare type OrderRefundFormFields = {
|
|
672
716
|
totalRefunded: TextInputFormField<string | number>;
|