rerobe-js-orm 3.5.9 → 3.6.1
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/Product/ProductFromFormState.js +1 -0
- package/lib/form-states/Product/ProductFormState.js +7 -1
- package/lib/form-states/Product/options.d.ts +1 -1
- package/lib/form-states/Product/options.js +3 -3
- package/lib/helpers/OrderHelpers.d.ts +112 -18
- package/lib/helpers/OrderHelpers.js +52 -6
- package/lib/models/Product.js +8 -0
- package/lib/types/rerobe-order-types.d.ts +23 -0
- package/lib/types/rerobe-product-types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ class ProductFromFormState extends ProductFactory_1.default {
|
|
|
14
14
|
coverPhotoUrl: ((_b = props.props) === null || _b === void 0 ? void 0 : _b.coverPhotoUrl) || '',
|
|
15
15
|
imageUrls: ((_c = props.props) === null || _c === void 0 ? void 0 : _c.imageUrls) || [],
|
|
16
16
|
price: props.fields.price.inputValue,
|
|
17
|
+
isTaxable: props.fields.isTaxable.selectedValue,
|
|
17
18
|
createdAt: ((_d = props.props) === null || _d === void 0 ? void 0 : _d.createdAt) || new Date().toUTCString(),
|
|
18
19
|
updatedAt: ((_e = props.props) === null || _e === void 0 ? void 0 : _e.updatedAt) || new Date().toUTCString(),
|
|
19
20
|
publishedAt: ((_f = props.props) === null || _f === void 0 ? void 0 : _f.publishedAt) || new Date().toUTCString(),
|
|
@@ -14,6 +14,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
14
14
|
this.fields.description = this.fieldFactory('textInput', 'description');
|
|
15
15
|
this.fields.title = this.fieldFactory('textInput', 'title');
|
|
16
16
|
this.fields.price = this.fieldFactory('textInput', 'price');
|
|
17
|
+
this.fields.isTaxable = this.fieldFactory('singleSelect', 'isTaxable', options_1.productYesNoOptions);
|
|
17
18
|
this.fields.weight = this.fieldFactory('textInput', 'weight');
|
|
18
19
|
this.fields.weightRange = this.fieldFactory('singleSelect', 'weightRange', options_1.productWeightRanges);
|
|
19
20
|
this.fields.weightUnit = this.fieldFactory('singleSelect', 'weightUnit', options_1.weightUnits);
|
|
@@ -65,7 +66,7 @@ class ProductFormState extends FormState_1.default {
|
|
|
65
66
|
valid: false,
|
|
66
67
|
onChangeHandler: (fileArr) => this.multiSelectMediaChangeHandler('filesToUpload', fileArr),
|
|
67
68
|
};
|
|
68
|
-
this.fields.isOnSale = this.fieldFactory('singleSelect', 'isOnSale', options_1.
|
|
69
|
+
this.fields.isOnSale = this.fieldFactory('singleSelect', 'isOnSale', options_1.productYesNoOptions);
|
|
69
70
|
this.fields.discountType = this.fieldFactory('singleSelect', 'discountType', options_1.discountTypeOptions);
|
|
70
71
|
this.fields.discountValue = this.fieldFactory('textInput', 'discountValue');
|
|
71
72
|
this.fields.editorAuthorizations = this.fieldFactory('singleSelect', 'editorAuthorizations', Object.keys(new Product_1.default().toObj()).map((v) => ({ label: this.utilities.startCase(v), value: v })));
|
|
@@ -509,6 +510,11 @@ class ProductFormState extends FormState_1.default {
|
|
|
509
510
|
valid = true;
|
|
510
511
|
onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
|
|
511
512
|
}
|
|
513
|
+
if (fieldKey === 'isTaxable') {
|
|
514
|
+
selectedValue = this.props[fieldKey] || '';
|
|
515
|
+
valid = true;
|
|
516
|
+
onChangeHandler = (val) => this.singleSelectChangeHandler(fieldKey, val);
|
|
517
|
+
}
|
|
512
518
|
if (fieldKey === 'discountType') {
|
|
513
519
|
valid = true;
|
|
514
520
|
onChangeHandler = (val) => this.discountTypeChangeHandler(val);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.measurementCategoryOptions = exports.minorDefectOptions = exports.majorDefectOptions = exports.productOptions = exports.
|
|
3
|
+
exports.measurementCategoryOptions = exports.minorDefectOptions = exports.majorDefectOptions = exports.productOptions = exports.productYesNoOptions = exports.discountTypeOptions = exports.salesChannelOptions = exports.unisexJewelry = exports.mensJewelry = exports.jewelry = exports.unisexAccessories = exports.mensAccessories = exports.accessories = exports.unisexBags = exports.mensBags = exports.bags = exports.weightUnits = exports.productWeightRanges = exports.unisexShoes = exports.mensShoes = exports.shoes = exports.unisexClothing = exports.mensClothing = exports.clothing = exports.productCategories = exports.clothingMaterials = exports.shoeSizes = exports.jeanSizes = exports.genderOptions = exports.conditions = exports.colors = exports.brands = exports.sizeCommentOptions = exports.manClothingSizeOptions = exports.womanClothingSizeOptions = exports.clothingSizeOptions = exports.sizeOptions = exports.statusOptions = exports.publishTypeOptions = exports.availableForSaleOptions = void 0;
|
|
4
4
|
const product_constants_1 = require("../../constants/product-constants");
|
|
5
5
|
const lodash_1 = require("lodash");
|
|
6
6
|
const availableForSaleOptions = [
|
|
@@ -2378,7 +2378,7 @@ const discountTypeOptions = [
|
|
|
2378
2378
|
},
|
|
2379
2379
|
];
|
|
2380
2380
|
exports.discountTypeOptions = discountTypeOptions;
|
|
2381
|
-
const
|
|
2381
|
+
const productYesNoOptions = [
|
|
2382
2382
|
{
|
|
2383
2383
|
label: 'Yes',
|
|
2384
2384
|
value: 'yes',
|
|
@@ -2388,7 +2388,7 @@ const productIsOnSaleOptions = [
|
|
|
2388
2388
|
value: 'no',
|
|
2389
2389
|
},
|
|
2390
2390
|
];
|
|
2391
|
-
exports.
|
|
2391
|
+
exports.productYesNoOptions = productYesNoOptions;
|
|
2392
2392
|
const productOptions = [
|
|
2393
2393
|
{ value: 'size', label: 'Size' },
|
|
2394
2394
|
{ value: 'color', label: 'Color' },
|
|
@@ -3,7 +3,7 @@ export default class OrderHelpers {
|
|
|
3
3
|
getShippingTypeFromShopifyObj(shippingLines: ShippingLineRest[] | null | undefined): string;
|
|
4
4
|
getPaymentTypeUsingTags(tags: string | null | undefined): string | null;
|
|
5
5
|
getSalesChannelUsingTags(tags: string | null | undefined): string | null;
|
|
6
|
-
buildLineItemFromProduct(product: CompleteProduct, currencyCode: string, quantity?: number): ReRobeOrderLineItem;
|
|
6
|
+
buildLineItemFromProduct(product: CompleteProduct, currencyCode: string, quantity?: number, taxProps?: RibbnTaxProps): ReRobeOrderLineItem;
|
|
7
7
|
toFixedPointPrice(price: number | string): string;
|
|
8
8
|
getAmountSumByField(array: OrderRefund[] | ReRobeOrderLineItem[], fieldKey: string): number;
|
|
9
9
|
getOrderInfoWithRefundsAndFulfillments(order: CompleteOrder): OrderWithRefundsAndFulfillmentsInfoObj;
|
|
@@ -25,33 +25,24 @@ export default class OrderHelpers {
|
|
|
25
25
|
additionalDiscount: number;
|
|
26
26
|
currency: string;
|
|
27
27
|
}): string;
|
|
28
|
-
getSubtotalWithoutSalePrice(productsFullInfoWithQuantity?:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
getSubtotalWithSalePriceIncluded(productsFullInfoWithQuantity?: {
|
|
33
|
-
product: CompleteProduct;
|
|
34
|
-
quantity: number;
|
|
35
|
-
}[]): number;
|
|
36
|
-
getSaleDiscountAmount(productsFullInfoWithQuantity: {
|
|
37
|
-
product: CompleteProduct;
|
|
38
|
-
quantity: number;
|
|
39
|
-
}[]): number;
|
|
40
|
-
preparePresentmentData({ merchantName, merchantCurrency, presentmentCurrencyCode, productsFullInfoWithQuantity, currencyConverter, saleDiscountAmount, creditDiscountAmount, additionalDiscount, shippingPrice, subTotalWithSalePriceIncluded, totalIncludingShipping, }: {
|
|
28
|
+
getSubtotalWithoutSalePrice(productsFullInfoWithQuantity?: ProductsFullInfoWithQuantity): number;
|
|
29
|
+
getSubtotalWithSalePriceIncluded(productsFullInfoWithQuantity?: ProductsFullInfoWithQuantity): number;
|
|
30
|
+
getSaleDiscountAmount(productsFullInfoWithQuantity: ProductsFullInfoWithQuantity): number;
|
|
31
|
+
preparePresentmentData({ merchantName, merchantCurrency, presentmentCurrencyCode, productsFullInfoWithQuantity, currencyConverter, saleDiscountAmount, creditDiscountAmount, additionalDiscount, shippingPrice, itemsTax, shippingFeeTax, subTotalWithSalePriceIncluded, totalIncludingShipping, totalIncludingShippingAndTaxes, }: {
|
|
41
32
|
merchantName: string;
|
|
42
33
|
merchantCurrency: string;
|
|
43
34
|
presentmentCurrencyCode?: string;
|
|
44
|
-
productsFullInfoWithQuantity:
|
|
45
|
-
product: CompleteProduct;
|
|
46
|
-
quantity: number;
|
|
47
|
-
}[];
|
|
35
|
+
productsFullInfoWithQuantity: ProductsFullInfoWithQuantity;
|
|
48
36
|
currencyConverter?(v: number | string, roundUpTo?: number): number;
|
|
49
37
|
saleDiscountAmount: number;
|
|
50
38
|
creditDiscountAmount: number;
|
|
51
39
|
additionalDiscount: number;
|
|
52
40
|
shippingPrice: number;
|
|
41
|
+
itemsTax: number;
|
|
42
|
+
shippingFeeTax: number;
|
|
53
43
|
subTotalWithSalePriceIncluded: number;
|
|
54
44
|
totalIncludingShipping: number;
|
|
45
|
+
totalIncludingShippingAndTaxes: number;
|
|
55
46
|
}): {
|
|
56
47
|
discountTitlePresentment: string;
|
|
57
48
|
saleDiscountPresentment: {
|
|
@@ -89,6 +80,14 @@ export default class OrderHelpers {
|
|
|
89
80
|
status?: string | undefined;
|
|
90
81
|
isOnSale?: string | undefined;
|
|
91
82
|
salePrice?: string | undefined;
|
|
83
|
+
presentmentTaxPrice?: Money | undefined;
|
|
84
|
+
isTaxable?: boolean | undefined;
|
|
85
|
+
taxRate?: number | undefined;
|
|
86
|
+
fromCountry?: string | undefined;
|
|
87
|
+
toCountry?: string | undefined;
|
|
88
|
+
taxAmount?: Money | undefined;
|
|
89
|
+
discountedPrice?: Money | undefined;
|
|
90
|
+
taxAmountWithDiscount?: Money | undefined;
|
|
92
91
|
title: string;
|
|
93
92
|
quantity: string | number;
|
|
94
93
|
variant: ProductVariant | null;
|
|
@@ -109,9 +108,104 @@ export default class OrderHelpers {
|
|
|
109
108
|
amount: string;
|
|
110
109
|
currencyCode: string;
|
|
111
110
|
};
|
|
111
|
+
itemsTaxPresentment: {
|
|
112
|
+
amount: string;
|
|
113
|
+
currencyCode: string;
|
|
114
|
+
};
|
|
115
|
+
shippingFeeTax: {
|
|
116
|
+
amount: string;
|
|
117
|
+
currencyCode: string;
|
|
118
|
+
};
|
|
119
|
+
totalTaxPresentment: {
|
|
120
|
+
amount: string;
|
|
121
|
+
currencyCode: string;
|
|
122
|
+
};
|
|
112
123
|
totalPricePresentment: {
|
|
113
124
|
amount: string;
|
|
114
125
|
currencyCode: string;
|
|
115
126
|
};
|
|
127
|
+
shippingFeeTaxPresentment?: undefined;
|
|
128
|
+
} | {
|
|
129
|
+
discountTitlePresentment: string;
|
|
130
|
+
lineItems: {
|
|
131
|
+
presentmentTotalPrice: {
|
|
132
|
+
amount: string;
|
|
133
|
+
currencyCode: string;
|
|
134
|
+
};
|
|
135
|
+
presentmentUnitPrice: {
|
|
136
|
+
amount: string;
|
|
137
|
+
currencyCode: string;
|
|
138
|
+
};
|
|
139
|
+
presentmentSalePrice: {
|
|
140
|
+
amount: string;
|
|
141
|
+
currencyCode: string;
|
|
142
|
+
};
|
|
143
|
+
brand?: string | null | undefined;
|
|
144
|
+
productId?: string | null | undefined;
|
|
145
|
+
shopifyProductId?: string | number | null | undefined;
|
|
146
|
+
refundedQuantity?: string | number | undefined;
|
|
147
|
+
canceledQuantity?: string | number | undefined;
|
|
148
|
+
fulfilledQuantity?: string | number | undefined;
|
|
149
|
+
unfulfilledQuantity?: string | number | undefined;
|
|
150
|
+
status?: string | undefined;
|
|
151
|
+
isOnSale?: string | undefined;
|
|
152
|
+
salePrice?: string | undefined;
|
|
153
|
+
presentmentTaxPrice?: Money | undefined;
|
|
154
|
+
isTaxable?: boolean | undefined;
|
|
155
|
+
taxRate?: number | undefined;
|
|
156
|
+
fromCountry?: string | undefined;
|
|
157
|
+
toCountry?: string | undefined;
|
|
158
|
+
taxAmount?: Money | undefined;
|
|
159
|
+
discountedPrice?: Money | undefined;
|
|
160
|
+
taxAmountWithDiscount?: Money | undefined;
|
|
161
|
+
title: string;
|
|
162
|
+
quantity: string | number;
|
|
163
|
+
variant: ProductVariant | null;
|
|
164
|
+
originalTotalPrice?: Money | undefined;
|
|
165
|
+
originalUnitPrice?: Money | undefined;
|
|
166
|
+
discountedTotalPrice?: Money | undefined;
|
|
167
|
+
image?: Image | undefined;
|
|
168
|
+
}[];
|
|
169
|
+
saleDiscountPresentment: {
|
|
170
|
+
amount: string;
|
|
171
|
+
currencyCode: string;
|
|
172
|
+
};
|
|
173
|
+
creditDiscountPresentment: {
|
|
174
|
+
amount: string;
|
|
175
|
+
currencyCode: string;
|
|
176
|
+
};
|
|
177
|
+
additionalDiscountPresentment: {
|
|
178
|
+
amount: string;
|
|
179
|
+
currencyCode: string;
|
|
180
|
+
};
|
|
181
|
+
subtotalPricePresentment: {
|
|
182
|
+
amount: string;
|
|
183
|
+
currencyCode: string;
|
|
184
|
+
};
|
|
185
|
+
totalDiscountPresentment: {
|
|
186
|
+
amount: string;
|
|
187
|
+
currencyCode: string;
|
|
188
|
+
};
|
|
189
|
+
totalShippingPricePresentment: {
|
|
190
|
+
amount: string;
|
|
191
|
+
currencyCode: string;
|
|
192
|
+
};
|
|
193
|
+
totalPricePresentment: {
|
|
194
|
+
amount: string;
|
|
195
|
+
currencyCode: string;
|
|
196
|
+
};
|
|
197
|
+
itemsTaxPresentment: {
|
|
198
|
+
amount: string;
|
|
199
|
+
currencyCode: string;
|
|
200
|
+
};
|
|
201
|
+
shippingFeeTaxPresentment: {
|
|
202
|
+
amount: string;
|
|
203
|
+
currencyCode: string;
|
|
204
|
+
};
|
|
205
|
+
totalTaxPresentment: {
|
|
206
|
+
amount: string;
|
|
207
|
+
currencyCode: string;
|
|
208
|
+
};
|
|
209
|
+
shippingFeeTax?: undefined;
|
|
116
210
|
};
|
|
117
211
|
}
|
|
@@ -62,8 +62,17 @@ class OrderHelpers {
|
|
|
62
62
|
}
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
|
-
buildLineItemFromProduct(product, currencyCode, quantity = 1) {
|
|
65
|
+
buildLineItemFromProduct(product, currencyCode, quantity = 1, taxProps = {}) {
|
|
66
66
|
const q = quantity || 1;
|
|
67
|
+
const getImgSrc = () => {
|
|
68
|
+
if (product.imageUrls && !!product.imageUrls.length) {
|
|
69
|
+
return product.imageUrls[0];
|
|
70
|
+
}
|
|
71
|
+
if (product.sellRequestImageUrls && !!product.sellRequestImageUrls.length) {
|
|
72
|
+
return product.sellRequestImageUrls[0];
|
|
73
|
+
}
|
|
74
|
+
return '';
|
|
75
|
+
};
|
|
67
76
|
return {
|
|
68
77
|
title: product.title,
|
|
69
78
|
quantity: q,
|
|
@@ -80,13 +89,29 @@ class OrderHelpers {
|
|
|
80
89
|
currencyCode,
|
|
81
90
|
},
|
|
82
91
|
image: {
|
|
83
|
-
originalSrc:
|
|
92
|
+
originalSrc: getImgSrc(),
|
|
84
93
|
},
|
|
85
94
|
shopifyProductId: product.shopifyId || null,
|
|
86
95
|
productId: product.documentId,
|
|
87
96
|
status: product.status || '',
|
|
88
97
|
isOnSale: product.isOnSale === 'yes' && product.clearanceTimestamp ? 'yes' : '',
|
|
89
98
|
salePrice: product.salePrice || '',
|
|
99
|
+
isTaxable: Boolean((taxProps === null || taxProps === void 0 ? void 0 : taxProps.isTaxable) || ''),
|
|
100
|
+
taxAmount: {
|
|
101
|
+
amount: Number(Number((taxProps === null || taxProps === void 0 ? void 0 : taxProps.taxAmount) || 0).toFixed(2)),
|
|
102
|
+
currencyCode,
|
|
103
|
+
},
|
|
104
|
+
taxRate: (taxProps === null || taxProps === void 0 ? void 0 : taxProps.taxRate) || 0,
|
|
105
|
+
fromCountry: (taxProps === null || taxProps === void 0 ? void 0 : taxProps.fromCountry) || '',
|
|
106
|
+
toCountry: (taxProps === null || taxProps === void 0 ? void 0 : taxProps.toCountry) || '',
|
|
107
|
+
discountedPrice: {
|
|
108
|
+
amount: Number(Number((taxProps === null || taxProps === void 0 ? void 0 : taxProps.discountedPrice) || product.price).toFixed(2)),
|
|
109
|
+
currencyCode,
|
|
110
|
+
},
|
|
111
|
+
taxAmountWithDiscount: {
|
|
112
|
+
amount: Number(Number((taxProps === null || taxProps === void 0 ? void 0 : taxProps.taxAmountWithDiscount) || 0).toFixed(2)),
|
|
113
|
+
currencyCode,
|
|
114
|
+
},
|
|
90
115
|
};
|
|
91
116
|
}
|
|
92
117
|
toFixedPointPrice(price) {
|
|
@@ -346,16 +371,26 @@ class OrderHelpers {
|
|
|
346
371
|
})
|
|
347
372
|
.reduce((a, b) => a + b, 0);
|
|
348
373
|
}
|
|
349
|
-
preparePresentmentData({ merchantName, merchantCurrency, presentmentCurrencyCode = '', productsFullInfoWithQuantity, currencyConverter = (v) => Number(v), saleDiscountAmount, creditDiscountAmount, additionalDiscount, shippingPrice, subTotalWithSalePriceIncluded, totalIncludingShipping, }) {
|
|
374
|
+
preparePresentmentData({ merchantName, merchantCurrency, presentmentCurrencyCode = '', productsFullInfoWithQuantity, currencyConverter = (v) => Number(v), saleDiscountAmount, creditDiscountAmount, additionalDiscount, shippingPrice, itemsTax, shippingFeeTax, subTotalWithSalePriceIncluded, totalIncludingShipping, totalIncludingShippingAndTaxes, }) {
|
|
350
375
|
const convertAndFixPrice = (v, roundUpTo = 1) => this.toFixedPointPrice(currencyConverter(Number(this.toFixedPointPrice(v || 0)), roundUpTo));
|
|
351
376
|
const prepareMoneyObj = (amount) => ({
|
|
352
377
|
amount: this.toFixedPointPrice(amount),
|
|
353
378
|
currencyCode: presentmentCurrencyCode || merchantCurrency,
|
|
354
379
|
});
|
|
355
380
|
let subtotalOriginalPresentment = 0;
|
|
381
|
+
const totalTax = Number(itemsTax || 0) + Number(shippingFeeTax || 0);
|
|
356
382
|
const lineItems = productsFullInfoWithQuantity.map((item) => {
|
|
357
383
|
var _a;
|
|
358
|
-
const lineItem = this.buildLineItemFromProduct(item.product, merchantCurrency, item.quantity
|
|
384
|
+
const lineItem = this.buildLineItemFromProduct(item.product, merchantCurrency, item.quantity, {
|
|
385
|
+
price: item.price,
|
|
386
|
+
isTaxable: item.isTaxable,
|
|
387
|
+
taxAmount: item.taxAmount,
|
|
388
|
+
taxRate: item.taxRate,
|
|
389
|
+
fromCountry: item.fromCountry,
|
|
390
|
+
toCountry: item.toCountry,
|
|
391
|
+
discountedPrice: item.discountedPrice,
|
|
392
|
+
taxAmountWithDiscount: item.taxAmountWithDiscount,
|
|
393
|
+
});
|
|
359
394
|
const presentmentUnitPrice = convertAndFixPrice((_a = lineItem.originalUnitPrice) === null || _a === void 0 ? void 0 : _a.amount, 5);
|
|
360
395
|
const presentmentSalePrice = convertAndFixPrice(lineItem.salePrice, 5);
|
|
361
396
|
const presentmentItemPrice = lineItem.isOnSale === 'yes' ? presentmentSalePrice : presentmentUnitPrice;
|
|
@@ -379,7 +414,10 @@ class OrderHelpers {
|
|
|
379
414
|
subtotalPricePresentment: prepareMoneyObj(subTotalWithSalePriceIncluded - creditDiscountAmount - additionalDiscount),
|
|
380
415
|
totalDiscountPresentment: prepareMoneyObj(creditDiscountAmount + additionalDiscount),
|
|
381
416
|
totalShippingPricePresentment: prepareMoneyObj(shippingPrice),
|
|
382
|
-
|
|
417
|
+
itemsTaxPresentment: prepareMoneyObj(itemsTax),
|
|
418
|
+
shippingFeeTax: prepareMoneyObj(shippingFeeTax),
|
|
419
|
+
totalTaxPresentment: prepareMoneyObj(totalTax),
|
|
420
|
+
totalPricePresentment: prepareMoneyObj(totalIncludingShippingAndTaxes || totalIncludingShipping),
|
|
383
421
|
};
|
|
384
422
|
}
|
|
385
423
|
const subtotalPricePresentmentWithSalePrice = lineItems
|
|
@@ -389,6 +427,9 @@ class OrderHelpers {
|
|
|
389
427
|
const creditDiscountPresentmentAmount = convertAndFixPrice(creditDiscountAmount || 0);
|
|
390
428
|
const additionalDiscountPresentmentAmount = convertAndFixPrice(additionalDiscount || 0);
|
|
391
429
|
const totalShippingPricePresentmentAmount = convertAndFixPrice(shippingPrice || 0);
|
|
430
|
+
const itemsTaxPresentmentAmount = convertAndFixPrice(itemsTax || 0);
|
|
431
|
+
const shippingFeeTaxPresentmentAmount = convertAndFixPrice(shippingFeeTax || 0);
|
|
432
|
+
const totalTaxPresentmentAmount = convertAndFixPrice(totalTax || 0);
|
|
392
433
|
let subtotalPricePresentmentAmount = subtotalPricePresentmentWithSalePrice -
|
|
393
434
|
Number(creditDiscountPresentmentAmount) -
|
|
394
435
|
Number(additionalDiscountPresentmentAmount);
|
|
@@ -413,7 +454,12 @@ class OrderHelpers {
|
|
|
413
454
|
subtotalPricePresentment: prepareMoneyObj(subtotalPricePresentmentAmount),
|
|
414
455
|
totalDiscountPresentment: prepareMoneyObj(Number(creditDiscountPresentmentAmount) + Number(additionalDiscountPresentmentAmount)),
|
|
415
456
|
totalShippingPricePresentment: prepareMoneyObj(totalShippingPricePresentmentAmount),
|
|
416
|
-
totalPricePresentment: prepareMoneyObj(Number(subtotalPricePresentmentAmount) +
|
|
457
|
+
totalPricePresentment: prepareMoneyObj(Number(subtotalPricePresentmentAmount) +
|
|
458
|
+
Number(totalShippingPricePresentmentAmount) +
|
|
459
|
+
Number(totalTaxPresentmentAmount)),
|
|
460
|
+
itemsTaxPresentment: prepareMoneyObj(itemsTaxPresentmentAmount),
|
|
461
|
+
shippingFeeTaxPresentment: prepareMoneyObj(shippingFeeTaxPresentmentAmount),
|
|
462
|
+
totalTaxPresentment: prepareMoneyObj(totalTaxPresentmentAmount),
|
|
417
463
|
};
|
|
418
464
|
}
|
|
419
465
|
}
|
package/lib/models/Product.js
CHANGED
|
@@ -37,6 +37,7 @@ class Product extends Base_1.default {
|
|
|
37
37
|
sku: (props === null || props === void 0 ? void 0 : props.sku) || '',
|
|
38
38
|
metaDataTitle: (props === null || props === void 0 ? void 0 : props.metaDataTitle) || '',
|
|
39
39
|
metaDataDescription: (props === null || props === void 0 ? void 0 : props.metaDataDescription) || '',
|
|
40
|
+
isTaxable: (props === null || props === void 0 ? void 0 : props.isTaxable) || '',
|
|
40
41
|
};
|
|
41
42
|
this.filterAttributes = {
|
|
42
43
|
documentId: (props === null || props === void 0 ? void 0 : props.documentId) || this.utilities.makeRandId(28),
|
|
@@ -287,6 +288,7 @@ class Product extends Base_1.default {
|
|
|
287
288
|
featuredCollections: this.utilities.sanitzeStringArr(this.filterAttributes.featuredCollections),
|
|
288
289
|
primaryAgeCategory: this.utilities.sanitizeString(this.filterAttributes.primaryAgeCategory),
|
|
289
290
|
isOnSale: this.utilities.sanitizeString(this.consignmentAttributes.isOnSale),
|
|
291
|
+
isTaxable: this.utilities.sanitizeString(this.attributes.isTaxable),
|
|
290
292
|
merchants: this.utilities.sanitzeStringArr(this.attributes.merchants),
|
|
291
293
|
merchantId: this.utilities.sanitizeString(this.attributes.merchantId),
|
|
292
294
|
price: this.utilities.sanitizeNumber(this.attributes.price),
|
|
@@ -629,6 +631,12 @@ class Product extends Base_1.default {
|
|
|
629
631
|
name: 'isOnSale',
|
|
630
632
|
type: 'string',
|
|
631
633
|
},
|
|
634
|
+
{
|
|
635
|
+
facet: true,
|
|
636
|
+
optional: true,
|
|
637
|
+
name: 'isTaxable',
|
|
638
|
+
type: 'string',
|
|
639
|
+
},
|
|
632
640
|
{
|
|
633
641
|
facet: false,
|
|
634
642
|
optional: false,
|
|
@@ -228,6 +228,21 @@ type MoneyBag = {
|
|
|
228
228
|
shopMoney: Money;
|
|
229
229
|
presentmentMoney?: Money;
|
|
230
230
|
};
|
|
231
|
+
type RibbnTaxProps = {
|
|
232
|
+
price?: number;
|
|
233
|
+
isTaxable?: boolean;
|
|
234
|
+
taxAmount?: number;
|
|
235
|
+
taxRate?: number;
|
|
236
|
+
fromCountry?: string;
|
|
237
|
+
toCountry?: string;
|
|
238
|
+
discountedPrice?: number;
|
|
239
|
+
taxAmountWithDiscount?: number;
|
|
240
|
+
};
|
|
241
|
+
type ProductsFullInfoWithQuantity = ({
|
|
242
|
+
product: CompleteProduct;
|
|
243
|
+
quantity: number;
|
|
244
|
+
price?: number;
|
|
245
|
+
} & RibbnTaxProps)[];
|
|
231
246
|
interface OrderLineItem {
|
|
232
247
|
title: string;
|
|
233
248
|
quantity: number | string;
|
|
@@ -251,6 +266,14 @@ interface ReRobeOrderLineItem extends OrderLineItem {
|
|
|
251
266
|
presentmentTotalPrice?: Money;
|
|
252
267
|
presentmentUnitPrice?: Money;
|
|
253
268
|
presentmentSalePrice?: Money;
|
|
269
|
+
presentmentTaxPrice?: Money;
|
|
270
|
+
isTaxable?: boolean;
|
|
271
|
+
taxRate?: number;
|
|
272
|
+
fromCountry?: string;
|
|
273
|
+
toCountry?: string;
|
|
274
|
+
taxAmount?: Money;
|
|
275
|
+
discountedPrice?: Money;
|
|
276
|
+
taxAmountWithDiscount?: Money;
|
|
254
277
|
}
|
|
255
278
|
type OrderLineItemConnection = {
|
|
256
279
|
edges: OrderLineItemEdge[];
|
|
@@ -28,6 +28,7 @@ type ProductAttributes = {
|
|
|
28
28
|
sku?: string;
|
|
29
29
|
metaDataTitle?: string;
|
|
30
30
|
metaDataDescription?: string;
|
|
31
|
+
isTaxable?: string;
|
|
31
32
|
};
|
|
32
33
|
type ProductFilterAttributes = {
|
|
33
34
|
documentId: string;
|
|
@@ -166,6 +167,7 @@ type ProductAttributesFormFields = {
|
|
|
166
167
|
metaDataTitle: TextInputFormField<string>;
|
|
167
168
|
metaDataDescription: TextInputFormField<string>;
|
|
168
169
|
handle: TextInputFormField<string>;
|
|
170
|
+
isTaxable: SingleSelectFormField<string>;
|
|
169
171
|
};
|
|
170
172
|
type ProductFilterAttributesFormFields = {
|
|
171
173
|
brand: SingleSelectFormField<string>;
|
|
@@ -259,6 +261,7 @@ type TypesenseProductObj = {
|
|
|
259
261
|
featuredCollections: string[];
|
|
260
262
|
primaryAgeCategory: string;
|
|
261
263
|
isOnSale: string;
|
|
264
|
+
isTaxable: string;
|
|
262
265
|
merchants: string[];
|
|
263
266
|
merchantId: string;
|
|
264
267
|
price: number;
|