@unchainedshop/api 3.0.0-rc7 → 3.0.0-rc8
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/resolvers/type/delivery-provider-types.d.ts +0 -1
- package/lib/resolvers/type/delivery-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.js +0 -2
- package/lib/resolvers/type/delivery-provider-types.js.map +1 -1
- package/lib/resolvers/type/index.d.ts +11 -42
- package/lib/resolvers/type/index.d.ts.map +1 -1
- package/lib/resolvers/type/index.js +0 -4
- package/lib/resolvers/type/index.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts +2 -3
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.js +1 -3
- package/lib/resolvers/type/order/order-delivery-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.d.ts +2 -3
- package/lib/resolvers/type/order/order-global-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.js +1 -3
- package/lib/resolvers/type/order/order-global-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.d.ts +2 -3
- package/lib/resolvers/type/order/order-item-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.js +1 -3
- package/lib/resolvers/type/order/order-item-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-types.js +2 -11
- package/lib/resolvers/type/order/order-item-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts +2 -3
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.js +1 -7
- package/lib/resolvers/type/order/order-payment-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-types.js +2 -7
- package/lib/resolvers/type/order/order-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.d.ts +0 -1
- package/lib/resolvers/type/payment/payment-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.js +0 -2
- package/lib/resolvers/type/payment/payment-provider-types.js.map +1 -1
- package/lib/resolvers/type/price-types.d.ts +0 -1
- package/lib/resolvers/type/price-types.d.ts.map +1 -1
- package/lib/resolvers/type/price-types.js.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.js +2 -31
- package/lib/resolvers/type/product/product-configurable-types.js.map +1 -1
- package/lib/resolvers/type/product/product-discount.d.ts +2 -3
- package/lib/resolvers/type/product/product-discount.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-discount.js +2 -4
- package/lib/resolvers/type/product/product-discount.js.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.js +0 -2
- package/lib/resolvers/type/product/product-plan-types.js.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.js.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts.map +1 -1
- package/lib/schema/inputTypes.d.ts.map +1 -1
- package/lib/schema/inputTypes.js +0 -1
- package/lib/schema/inputTypes.js.map +1 -1
- package/lib/schema/types/dispatch.d.ts.map +1 -1
- package/lib/schema/types/dispatch.js +0 -1
- package/lib/schema/types/dispatch.js.map +1 -1
- package/lib/schema/types/price.d.ts.map +1 -1
- package/lib/schema/types/price.js +0 -2
- package/lib/schema/types/price.js.map +1 -1
- package/lib/schema/types/stock.d.ts.map +1 -1
- package/lib/schema/types/stock.js +0 -1
- package/lib/schema/types/stock.js.map +1 -1
- package/package.json +6 -6
- package/src/resolvers/type/delivery-provider-types.ts +0 -3
- package/src/resolvers/type/index.ts +0 -4
- package/src/resolvers/type/order/order-delivery-discount-types.ts +1 -3
- package/src/resolvers/type/order/order-global-discount-types.ts +2 -3
- package/src/resolvers/type/order/order-item-discount-types.ts +1 -3
- package/src/resolvers/type/order/order-item-types.ts +3 -11
- package/src/resolvers/type/order/order-payment-discount-types.ts +2 -9
- package/src/resolvers/type/order/order-types.ts +3 -7
- package/src/resolvers/type/payment/payment-provider-types.ts +0 -2
- package/src/resolvers/type/price-types.ts +0 -1
- package/src/resolvers/type/product/product-configurable-types.ts +2 -39
- package/src/resolvers/type/product/product-discount.ts +2 -4
- package/src/resolvers/type/product/product-plan-types.ts +0 -4
- package/src/resolvers/type/product/product-simple-types.ts +0 -1
- package/src/schema/inputTypes.ts +0 -1
- package/src/schema/types/dispatch.ts +0 -1
- package/src/schema/types/price.ts +0 -2
- package/src/schema/types/stock.ts +0 -1
- package/src/resolvers/type/dispatch-types.ts +0 -27
- package/src/resolvers/type/stock-types.ts +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-types.d.ts","sourceRoot":"","sources":["../../../src/resolvers/type/price-types.ts"],"names":[],"mappings":"AAEA,KAAK,SAAS,GAAG;IACf,
|
|
1
|
+
{"version":3,"file":"price-types.d.ts","sourceRoot":"","sources":["../../../src/resolvers/type/price-types.ts"],"names":[],"mappings":"AAEA,KAAK,SAAS,GAAG;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,KAAK;6BACS,SAAS;+BAGP,SAAS;kBAGtB,SAAS;gBAGX,SAAS;CAMtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-types.js","sourceRoot":"","sources":["../../../src/resolvers/type/price-types.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"price-types.js","sourceRoot":"","sources":["../../../src/resolvers/type/price-types.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAWpC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,SAAS,CAAC,EAAE,SAAS,EAAa;QAChC,OAAO,SAAS,IAAI,KAAK,CAAC;IAC5B,CAAC;IACD,UAAU,CAAC,EAAE,UAAU,EAAa;QAClC,OAAO,UAAU,IAAI,KAAK,CAAC;IAC7B,CAAC;IACD,QAAQ,CAAC,GAAc;QACrB,OAAO,GAAG,EAAE,YAAY,IAAI,GAAG,EAAE,QAAQ,CAAC;IAC5C,CAAC;IACD,MAAM,CAAC,GAAc;QACnB,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-configurable-types.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-configurable-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"product-configurable-types.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-configurable-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OA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
1
|
import { Product } from './product-types.js';
|
|
2
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
3
2
|
export const ConfigurableProduct = {
|
|
4
3
|
...Product,
|
|
5
4
|
async assignments(product, params, { modules }) {
|
|
@@ -47,13 +46,6 @@ export const ConfigurableProduct = {
|
|
|
47
46
|
return null;
|
|
48
47
|
const unitPrice = pricing.unitPrice({ useNetPrice });
|
|
49
48
|
return {
|
|
50
|
-
_id: await sha256([
|
|
51
|
-
proxyProduct._id,
|
|
52
|
-
countryContext,
|
|
53
|
-
quantity,
|
|
54
|
-
useNetPrice,
|
|
55
|
-
requestContext.userId || 'ANONYMOUS',
|
|
56
|
-
].join('')),
|
|
57
49
|
...unitPrice,
|
|
58
50
|
isNetPrice: useNetPrice,
|
|
59
51
|
isTaxable: pricing.taxSum() > 0,
|
|
@@ -66,30 +58,9 @@ export const ConfigurableProduct = {
|
|
|
66
58
|
productId: product._id,
|
|
67
59
|
prices: filteredPrices,
|
|
68
60
|
});
|
|
69
|
-
const minPriceHash = await sha256([
|
|
70
|
-
product._id,
|
|
71
|
-
minPrice?.isTaxable,
|
|
72
|
-
minPrice?.isNetPrice,
|
|
73
|
-
minPrice?.amount,
|
|
74
|
-
minPrice?.currencyCode,
|
|
75
|
-
].join(''));
|
|
76
|
-
const maxPriceHash = await sha256([
|
|
77
|
-
product._id,
|
|
78
|
-
maxPrice?.isTaxable,
|
|
79
|
-
maxPrice?.isNetPrice,
|
|
80
|
-
maxPrice?.amount,
|
|
81
|
-
maxPrice?.currencyCode,
|
|
82
|
-
].join(''));
|
|
83
61
|
return {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
_id: minPriceHash,
|
|
87
|
-
...minPrice,
|
|
88
|
-
},
|
|
89
|
-
maxPrice: {
|
|
90
|
-
_id: maxPriceHash,
|
|
91
|
-
...maxPrice,
|
|
92
|
-
},
|
|
62
|
+
minPrice,
|
|
63
|
+
maxPrice,
|
|
93
64
|
};
|
|
94
65
|
},
|
|
95
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-configurable-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-configurable-types.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"product-configurable-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-configurable-types.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,OAAO;IAEV,KAAK,CAAC,WAAW,CACf,OAAoB,EACpB,MAEC,EACD,EAAE,OAAO,EAAW;QAOpB,OAAO,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,OAAoB,EACpB,EACE,OAAO,EACP,eAAe,GAIhB,EACD,EAAE,OAAO,EAAW;QAEpB,OAAO,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE;YACtD,eAAe;SAChB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,OAAoB,EACpB,EACE,QAAQ,EACR,OAAO,EACP,QAAQ,EAAE,kBAAkB,EAC5B,eAAe,GAMhB,EACD,cAAuB;QAEvB,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;QACnD,MAAM,YAAY,GAAG,kBAAkB,IAAI,cAAc,CAAC,eAAe,CAAC;QAC1E,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE;YACxD,QAAQ;YACR,OAAO;YACP,eAAe;YACf,OAAO,EAAE,cAAc;YACvB,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CACd,OAAoB,EAC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,YAAY,EAAE,OAAO,CAAC,QAAQ;aAC/B,CAAC;QACJ,CAAC,CAAC,CACH,CACF,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAElB,IAAI,CAAC,cAAc,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAExC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC;YAChE,SAAS,EAAE,OAAO,CAAC,GAAa;YAChC,MAAM,EAAE,cAAc;SACvB,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ;YACR,QAAQ;SACT,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -7,10 +7,9 @@ export declare const ProductDiscount: {
|
|
|
7
7
|
isManualAdditionAllowed: boolean;
|
|
8
8
|
isManualRemovalAllowed: boolean;
|
|
9
9
|
}>;
|
|
10
|
-
total(productDiscount: ProductDiscountType):
|
|
11
|
-
_id: string;
|
|
10
|
+
total(productDiscount: ProductDiscountType): {
|
|
12
11
|
amount: number;
|
|
13
12
|
currency: string;
|
|
14
|
-
}
|
|
13
|
+
};
|
|
15
14
|
};
|
|
16
15
|
//# sourceMappingURL=product-discount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-discount.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-discount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"product-discount.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-discount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGtF,eAAO,MAAM,eAAe;iCACS,mBAAmB;;;;;;;2BAY/B,mBAAmB;;;;CAU3C,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ProductDiscountDirector } from '@unchainedshop/core';
|
|
2
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
3
2
|
export const ProductDiscount = {
|
|
4
3
|
interface: async (productDiscount) => {
|
|
5
4
|
const Interface = ProductDiscountDirector.getAdapter(productDiscount.discountKey);
|
|
@@ -13,11 +12,10 @@ export const ProductDiscount = {
|
|
|
13
12
|
isManualRemovalAllowed: await Interface.isManualRemovalAllowed(),
|
|
14
13
|
};
|
|
15
14
|
},
|
|
16
|
-
|
|
17
|
-
const { total
|
|
15
|
+
total(productDiscount) {
|
|
16
|
+
const { total } = productDiscount;
|
|
18
17
|
if (productDiscount.total) {
|
|
19
18
|
return {
|
|
20
|
-
_id: await sha256([`${_id}`, total.amount, total.currency].join('')),
|
|
21
19
|
amount: total.amount,
|
|
22
20
|
currency: total.currency,
|
|
23
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-discount.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-discount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"product-discount.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-discount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,KAAK,EAAE,eAAoC,EAAE,EAAE;QACxD,MAAM,SAAS,GAAG,uBAAuB,CAAC,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAClF,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAC5B,OAAO;YACL,GAAG,EAAE,SAAS,CAAC,GAAG;YAClB,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,uBAAuB,EAAE,MAAM,SAAS,CAAC,uBAAuB,CAAC,eAAe,CAAC,IAAI,CAAC;YACtF,sBAAsB,EAAE,MAAM,SAAS,CAAC,sBAAsB,EAAE;SACjE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,eAAoC;QACxC,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC;QAClC,IAAI,eAAe,CAAC,KAAK,EAAE,CAAC;YAC1B,OAAO;gBACL,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;aACzB,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-plan-types.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-plan-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,OAAO,IAAI,WAAW,EACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"product-plan-types.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-plan-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,OAAO,IAAI,WAAW,EACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,eAAO,MAAM,WAAW;0BAIX,WAAW,8CACwB;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,kBACpE,OAAO,GACtB,OAAO,CAAC,YAAY,CAAC;wBAWjB,WAAW,2EAMb;QACD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,aAAa,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;KAC7C,kBACe,OAAO,GACtB,OAAO,CAAC,YAAY,CAAC;8BA0BjB,WAAW,oCACkB;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,kBACvC,OAAO,GACtB,OAAO,CACR,KAAK,CAAC;QACJ,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC,CACH;4BAMuB,WAAW,GAAG,MAAM;uCAGT,WAAW,GAAG,MAAM;uCAGpB,WAAW,GAAG,MAAM;;;mBA1DtC,CAAC;;;;;;;YAaf,CAAC;;;mBAuBA,CAAC;aAAqB,CAAC;cAEzB,CAAJ;YAAoB,CAAC;;;mBAWb,CAAC;;;oBAMqC,CAAC;;;;;;;mBAOstB,CAAC;;CADrwB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Product } from './product-types.js';
|
|
2
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
3
2
|
export const PlanProduct = {
|
|
4
3
|
...Product,
|
|
5
4
|
async catalogPrice(product, { quantity, currency: forcedCurrencyCode }, requestContext) {
|
|
@@ -27,7 +26,6 @@ export const PlanProduct = {
|
|
|
27
26
|
return null;
|
|
28
27
|
const unitPrice = pricing.unitPrice({ useNetPrice });
|
|
29
28
|
return {
|
|
30
|
-
_id: await sha256([obj._id, countryContext, quantity, useNetPrice, user ? user._id : 'ANONYMOUS'].join('')),
|
|
31
29
|
...unitPrice,
|
|
32
30
|
isNetPrice: useNetPrice,
|
|
33
31
|
isTaxable: pricing.taxSum() > 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-plan-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-plan-types.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"product-plan-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-plan-types.ts"],"names":[],"mappings":"AAMA,OAAO,EA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AC/B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,GAAgB,EAChB,EAAE,QAAQ,EAAE,kBAAkB,EAAyB,EACvD,cAAuB;QAQvB,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;QACnD,MAAM,QAAQ,GAAG,kBAAkB,IAAI,cAAc,CAAC,eAAe,CAAC;QACtE,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,SAAS,CAAC,EAAE,QAAQ,EAAe;QACjC,OAAO,QAAQ,EAAE,SAAS,CAAC;IAC7B,CAAC;IACD,oBAAoB,CAAC,EAAE,QAAQ,EAAe;QAC5C,OAAO,QAAQ,EAAE,oBAAoB,CAAC;IACxC,CAAC;IACD,oBAAoB,CAAC,EAAE,QAAQ,EAAe;QAC5C,OAAO,QAAQ,EAAE,oBAAoB,CAAC;IACxC,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-simple-types.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-simple-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"product-simple-types.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-simple-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,eAAO,MAAM,aAAa;6BAIjB,OAAO,UACJ;QAAE,aAAa,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,oBAAoB,EAAE,oBAAoB,CAAA;KAAE,kBAC7E,OAAO,GACtB,OAAO,CACR,KAAK,CAAC;QACJ,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;QAC1C,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,gBAAgB,CAAC,EAAE,IAAI,CAAC;KACzB,CAAC,CACH;yBAeM,OAAO,UACJ;QACN,aAAa,EAAE,IAAI,CAAC;QACpB,oBAAoB,EAAE,oBAAoB,CAAC;KAC5C,kBACe,OAAO,GACtB,OAAO,CACR,KAAK,CAAC;QACJ,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;QAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CACH;;;QAe0B,MAAM;;;QAIX,MAAM;;;QAIJ,aAAa;;gBAlEY,CAAC;gBAEpD,CADA;;;gBAiBsC,CAAC;gBAE3B,CAAC;mBAA2B,CAAC;qBAErC,CADJ;;;gBAiCW,CAAC;;;;;;;;;;;mBAvCR,CAAA;;;;;;;YAeK,CAAC;;;mBAqBQ,CAAC;aAAqB,CAAC;cAClC,CAAC;YACF,CAAF;;;mBAeuD,CAAC;;;oBASG,CAAC;;;;;;;mBAAi7B,CAAC;;CADj/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-simple-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-simple-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"product-simple-types.js","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-simple-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,MAAM,CAAC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AM,CAAC;QAC9F,OAAO;YACL,YAAY;YACZ,mBAAmB;YACnB,mBAAmB;YACnB,kBAAkB;SACnB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-tokenized-types.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-tokenized-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK9C,eAAO,MAAM,gBAAgB;sCAGO,OAAO,GAAG,MAAM;4CAIV,OAAO,GAAG,4BAA4B;uCAS3C,OAAO,GAAG,uBAAuB;yBAK7D,OAAO,UACJ;QACN,aAAa,EAAE,IAAI,CAAC;KACrB,kBACe,OAAO,GACtB,OAAO,CACR,KAAK,CAAC;QACJ,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;QAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CACH;oBAaqB,OAAO,UAAU,KAAK,kBAAkB,OAAO;;
|
|
1
|
+
{"version":3,"file":"product-tokenized-types.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/type/product/product-tokenized-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK9C,eAAO,MAAM,gBAAgB;sCAGO,OAAO,GAAG,MAAM;4CAIV,OAAO,GAAG,4BAA4B;uCAS3C,OAAO,GAAG,uBAAuB;yBAK7D,OAAO,UACJ;QACN,aAAa,EAAE,IAAI,CAAC;KACrB,kBACe,OAAO,GACtB,OAAO,CACR,KAAK,CAAC;QACJ,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;QAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CACH;oBAaqB,OAAO,UAAU,KAAK,kBAAkB,OAAO;;gBAhDtE,CAAC;gBAAmB,CAAA;;;gBAesC,CAAC;gBAItD,CAAC;mBAA2B,CAAC;qBAA8B,CAAC;;;gBAgCpC,CAAC;;;;;;;;;;;mBArCzB,CAAL;;;;;;;YAcgB,CAAC;;;mBAqBD,CAAC;aAAqB,CAAC;cAAsB,CAAC;YAE3D,CAAD;;;mBAU8D,CAAC;;;oBAAsO,CAAC;;;;;;;mBAAi7B,CAAC;;CAL1tC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputTypes.d.ts","sourceRoot":"","sources":["../../src/schema/inputTypes.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"inputTypes.d.ts","sourceRoot":"","sources":["../../src/schema/inputTypes.ts"],"names":[],"mappings":";AAAA,wBAyQE"}
|
package/lib/schema/inputTypes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputTypes.js","sourceRoot":"","sources":["../../src/schema/inputTypes.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"inputTypes.js","sourceRoot":"","sources":["../../src/schema/inputTypes.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuQb;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/schema/types/dispatch.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/schema/types/dispatch.ts"],"names":[],"mappings":";AAAA,wBASE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../src/schema/types/dispatch.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../src/schema/types/dispatch.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,aAAa,CAAC;;;;;;;GAOb;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../src/schema/types/price.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../src/schema/types/price.ts"],"names":[],"mappings":";AAAA,wBAcE"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export default [
|
|
2
2
|
/* GraphQL */ `
|
|
3
3
|
type Price @cacheControl(maxAge: 60) {
|
|
4
|
-
_id: ID!
|
|
5
4
|
isTaxable: Boolean!
|
|
6
5
|
isNetPrice: Boolean!
|
|
7
6
|
amount: Int!
|
|
@@ -9,7 +8,6 @@ export default [
|
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
type PriceRange @cacheControl(maxAge: 60) {
|
|
12
|
-
_id: ID!
|
|
13
11
|
minPrice: Price!
|
|
14
12
|
maxPrice: Price!
|
|
15
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../../src/schema/types/price.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../../src/schema/types/price.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,aAAa,CAAC;;;;;;;;;;;;GAYb;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stock.d.ts","sourceRoot":"","sources":["../../../src/schema/types/stock.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"stock.d.ts","sourceRoot":"","sources":["../../../src/schema/types/stock.ts"],"names":[],"mappings":";AAAA,wBAQE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stock.js","sourceRoot":"","sources":["../../../src/schema/types/stock.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"stock.js","sourceRoot":"","sources":["../../../src/schema/types/stock.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,aAAa,CAAC;;;;;;GAMb;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/api",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-rc8",
|
|
4
4
|
"main": "lib/api-index.js",
|
|
5
5
|
"types": "lib/api-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@unchainedshop/core": "^3.0.0-
|
|
75
|
-
"@unchainedshop/events": "^3.0.0-
|
|
76
|
-
"@unchainedshop/logger": "^3.0.0-
|
|
77
|
-
"@unchainedshop/roles": "^3.0.0-
|
|
78
|
-
"@unchainedshop/utils": "^3.0.0-
|
|
74
|
+
"@unchainedshop/core": "^3.0.0-rc8",
|
|
75
|
+
"@unchainedshop/events": "^3.0.0-rc8",
|
|
76
|
+
"@unchainedshop/logger": "^3.0.0-rc8",
|
|
77
|
+
"@unchainedshop/roles": "^3.0.0-rc8",
|
|
78
|
+
"@unchainedshop/utils": "^3.0.0-rc8",
|
|
79
79
|
"accounting": "0.4.1",
|
|
80
80
|
"dataloader": "^2.2.3",
|
|
81
81
|
"expiry-map": "^2.0.0",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Context } from '../../context.js';
|
|
2
2
|
import { DeliveryProvider as DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
3
3
|
import { DeliveryDirector, DeliveryError, DeliveryPricingDirector } from '@unchainedshop/core';
|
|
4
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
5
4
|
|
|
6
5
|
export type HelperType<P, T> = (provider: DeliveryProviderType, params: P, context: Context) => T;
|
|
7
6
|
|
|
@@ -24,7 +23,6 @@ export interface DeliveryProviderHelperTypes {
|
|
|
24
23
|
context: any;
|
|
25
24
|
},
|
|
26
25
|
Promise<{
|
|
27
|
-
_id: string;
|
|
28
26
|
amount: number;
|
|
29
27
|
currencyCode: string;
|
|
30
28
|
countryCode: string;
|
|
@@ -84,7 +82,6 @@ export const DeliveryProvider: DeliveryProviderHelperTypes = {
|
|
|
84
82
|
};
|
|
85
83
|
|
|
86
84
|
return {
|
|
87
|
-
_id: await sha256([deliveryProvider._id, country, useNetPrice, order ? order._id : ''].join('')),
|
|
88
85
|
amount: orderPrice.amount,
|
|
89
86
|
currencyCode: orderPrice.currency,
|
|
90
87
|
countryCode: country,
|
|
@@ -12,7 +12,6 @@ import { Country } from './country-types.js';
|
|
|
12
12
|
import { Currency } from './currency-types.js';
|
|
13
13
|
import { DeliveryProvider } from './delivery-provider-types.js';
|
|
14
14
|
import { Dimensions } from './dimensions-types.js';
|
|
15
|
-
import { Dispatch } from './dispatch-types.js';
|
|
16
15
|
import { Enrollment } from './enrollment/enrollment-types.js';
|
|
17
16
|
import { EnrollmentDelivery } from './enrollment/enrollment-delivery-types.js';
|
|
18
17
|
import { EnrollmentPayment } from './enrollment/enrollment-payment-types.js';
|
|
@@ -57,7 +56,6 @@ import { Quotation } from './quotation-types.js';
|
|
|
57
56
|
import { Shop } from './shop-types.js';
|
|
58
57
|
import { SimpleProduct } from './product/product-simple-types.js';
|
|
59
58
|
import { TokenizedProduct } from './product/product-tokenized-types.js';
|
|
60
|
-
import { Stock } from './stock-types.js';
|
|
61
59
|
import { User } from './user-types.js';
|
|
62
60
|
import { WebAuthnCredentials } from './webauthn-credentials-types.js';
|
|
63
61
|
import { WarehousingProvider } from './warehousing-provider-types.js';
|
|
@@ -84,7 +82,6 @@ const types = {
|
|
|
84
82
|
Currency,
|
|
85
83
|
DeliveryProvider,
|
|
86
84
|
Dimensions,
|
|
87
|
-
Dispatch,
|
|
88
85
|
Enrollment,
|
|
89
86
|
EnrollmentDelivery,
|
|
90
87
|
EnrollmentPayment,
|
|
@@ -131,7 +128,6 @@ const types = {
|
|
|
131
128
|
SimpleProduct,
|
|
132
129
|
TokenizedProduct,
|
|
133
130
|
Token,
|
|
134
|
-
Stock,
|
|
135
131
|
User,
|
|
136
132
|
WebAuthnCredentials,
|
|
137
133
|
WarehousingProvider,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Context } from '../../../context.js';
|
|
2
2
|
import { OrderDeliveryDiscount as OrderDeliveryDiscountType } from '@unchainedshop/core-orders';
|
|
3
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
4
3
|
|
|
5
4
|
export const OrderDeliveryDiscount = {
|
|
6
5
|
_id(obj: OrderDeliveryDiscountType) {
|
|
@@ -13,9 +12,8 @@ export const OrderDeliveryDiscount = {
|
|
|
13
12
|
});
|
|
14
13
|
},
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
total(obj: OrderDeliveryDiscountType) {
|
|
17
16
|
return {
|
|
18
|
-
_id: await sha256([`${obj.item._id}:${obj.discountId}`, obj.amount, obj.currency].join('')),
|
|
19
17
|
amount: obj.amount,
|
|
20
18
|
currency: obj.currency,
|
|
21
19
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Order } from '@unchainedshop/core-orders';
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
|
-
import { Price
|
|
3
|
+
import { Price } from '@unchainedshop/utils';
|
|
4
4
|
|
|
5
5
|
export const OrderGlobalDiscount = {
|
|
6
6
|
_id(
|
|
@@ -25,14 +25,13 @@ export const OrderGlobalDiscount = {
|
|
|
25
25
|
});
|
|
26
26
|
},
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
total(
|
|
29
29
|
obj: Price & {
|
|
30
30
|
order: Order;
|
|
31
31
|
discountId: string;
|
|
32
32
|
},
|
|
33
33
|
) {
|
|
34
34
|
return {
|
|
35
|
-
_id: await sha256([`${obj.order._id}:${obj.discountId}`, obj.amount, obj.currency].join('')),
|
|
36
35
|
amount: obj.amount,
|
|
37
36
|
currency: obj.currency,
|
|
38
37
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
2
1
|
import { Context } from '../../../context.js';
|
|
3
2
|
import { OrderPositionDiscount } from '@unchainedshop/core-orders';
|
|
4
3
|
|
|
@@ -13,9 +12,8 @@ export const OrderItemDiscount = {
|
|
|
13
12
|
});
|
|
14
13
|
},
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
total(obj: OrderPositionDiscount) {
|
|
17
16
|
return {
|
|
18
|
-
_id: await sha256([`${obj.item._id}:${obj.discountId}`, obj.amount, obj.currency].join('')),
|
|
19
17
|
amount: obj.amount,
|
|
20
18
|
currency: obj.currency,
|
|
21
19
|
};
|
|
@@ -5,7 +5,7 @@ import { OrderPosition, OrderPositionDiscount } from '@unchainedshop/core-orders
|
|
|
5
5
|
import { Product } from '@unchainedshop/core-products';
|
|
6
6
|
import { Quotation } from '@unchainedshop/core-quotations';
|
|
7
7
|
import { TokenSurrogate, WarehousingProvider } from '@unchainedshop/core-warehousing';
|
|
8
|
-
import { Price
|
|
8
|
+
import { Price } from '@unchainedshop/utils';
|
|
9
9
|
import { ProductPricingSheet } from '@unchainedshop/core';
|
|
10
10
|
|
|
11
11
|
const getPricingSheet = async (orderPosition: OrderPosition, context: Context) => {
|
|
@@ -120,11 +120,7 @@ export const OrderItem = {
|
|
|
120
120
|
const pricing = await getPricingSheet(orderPosition, context);
|
|
121
121
|
|
|
122
122
|
if (pricing.isValid()) {
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
_id: await sha256([orderPosition._id, JSON.stringify(params), JSON.stringify(price)].join('')),
|
|
126
|
-
...price,
|
|
127
|
-
};
|
|
123
|
+
return pricing.total(params);
|
|
128
124
|
}
|
|
129
125
|
return null;
|
|
130
126
|
},
|
|
@@ -137,11 +133,7 @@ export const OrderItem = {
|
|
|
137
133
|
const pricing = await getPricingSheet(orderPosition, context);
|
|
138
134
|
|
|
139
135
|
if (pricing.isValid()) {
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
_id: await sha256([`${orderPosition._id}-unit`, price.amount, pricing.currency].join('')),
|
|
143
|
-
...price,
|
|
144
|
-
};
|
|
136
|
+
return pricing.unitPrice(params);
|
|
145
137
|
}
|
|
146
138
|
return null;
|
|
147
139
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from '../../../context.js';
|
|
2
2
|
import { OrderPayment } from '@unchainedshop/core-orders';
|
|
3
|
-
import { Price
|
|
3
|
+
import { Price } from '@unchainedshop/utils';
|
|
4
4
|
|
|
5
5
|
export const OrderPaymentDiscount = {
|
|
6
6
|
_id: (orderDelivery: Price & { discountId: string; item: OrderPayment }) =>
|
|
@@ -15,15 +15,8 @@ export const OrderPaymentDiscount = {
|
|
|
15
15
|
discountId: orderDelivery.discountId,
|
|
16
16
|
}),
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
total(orderDelivery: Price & { discountId: string; item: OrderPayment }) {
|
|
19
19
|
return {
|
|
20
|
-
_id: await sha256(
|
|
21
|
-
[
|
|
22
|
-
`${orderDelivery.item._id}-${orderDelivery.discountId}`,
|
|
23
|
-
orderDelivery.amount,
|
|
24
|
-
orderDelivery.currency,
|
|
25
|
-
].join(''),
|
|
26
|
-
),
|
|
27
20
|
amount: orderDelivery.amount,
|
|
28
21
|
currency: orderDelivery.currency,
|
|
29
22
|
};
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
OrderDelivery,
|
|
12
12
|
} from '@unchainedshop/core-orders';
|
|
13
13
|
import { User } from '@unchainedshop/core-users';
|
|
14
|
-
import { Price
|
|
14
|
+
import { Price } from '@unchainedshop/utils';
|
|
15
15
|
import { OrderPricingSheet } from '@unchainedshop/core';
|
|
16
16
|
|
|
17
17
|
export const Order = {
|
|
@@ -74,18 +74,14 @@ export const Order = {
|
|
|
74
74
|
return order.status;
|
|
75
75
|
},
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
total(order: OrderType, params: { category: string; useNetPrice: boolean }): Price {
|
|
78
78
|
const pricing = OrderPricingSheet({
|
|
79
79
|
calculation: order.calculation,
|
|
80
80
|
currency: order.currency,
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
if (pricing.isValid()) {
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
_id: await sha256([order._id, JSON.stringify(params), JSON.stringify(price)].join('')),
|
|
87
|
-
...price,
|
|
88
|
-
};
|
|
84
|
+
return pricing.total(params);
|
|
89
85
|
}
|
|
90
86
|
return null;
|
|
91
87
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Context } from '../../../context.js';
|
|
2
2
|
import { PaymentProvider as PaymentProviderType } from '@unchainedshop/core-payment';
|
|
3
3
|
import { PaymentDirector, PaymentPricingDirector } from '@unchainedshop/core';
|
|
4
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
5
4
|
|
|
6
5
|
export const PaymentProvider = {
|
|
7
6
|
interface(provider: PaymentProviderType) {
|
|
@@ -53,7 +52,6 @@ export const PaymentProvider = {
|
|
|
53
52
|
};
|
|
54
53
|
|
|
55
54
|
return {
|
|
56
|
-
_id: await sha256([paymentProvider._id, country, useNetPrice, order ? order._id : ''].join('')),
|
|
57
55
|
amount: orderPrice.amount,
|
|
58
56
|
currencyCode: orderPrice.currency,
|
|
59
57
|
countryCode: country,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from '@unchainedshop/core-products';
|
|
8
8
|
import { Context } from '../../../context.js';
|
|
9
9
|
import { Product } from './product-types.js';
|
|
10
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
11
10
|
|
|
12
11
|
export const ConfigurableProduct = {
|
|
13
12
|
...Product,
|
|
@@ -127,15 +126,6 @@ export const ConfigurableProduct = {
|
|
|
127
126
|
const unitPrice = pricing.unitPrice({ useNetPrice });
|
|
128
127
|
|
|
129
128
|
return {
|
|
130
|
-
_id: await sha256(
|
|
131
|
-
[
|
|
132
|
-
proxyProduct._id,
|
|
133
|
-
countryContext,
|
|
134
|
-
quantity,
|
|
135
|
-
useNetPrice,
|
|
136
|
-
requestContext.userId || 'ANONYMOUS',
|
|
137
|
-
].join(''),
|
|
138
|
-
),
|
|
139
129
|
...unitPrice,
|
|
140
130
|
isNetPrice: useNetPrice,
|
|
141
131
|
isTaxable: pricing.taxSum() > 0,
|
|
@@ -152,36 +142,9 @@ export const ConfigurableProduct = {
|
|
|
152
142
|
prices: filteredPrices,
|
|
153
143
|
});
|
|
154
144
|
|
|
155
|
-
const minPriceHash = await sha256(
|
|
156
|
-
[
|
|
157
|
-
product._id,
|
|
158
|
-
minPrice?.isTaxable,
|
|
159
|
-
minPrice?.isNetPrice,
|
|
160
|
-
minPrice?.amount,
|
|
161
|
-
minPrice?.currencyCode,
|
|
162
|
-
].join(''),
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
const maxPriceHash = await sha256(
|
|
166
|
-
[
|
|
167
|
-
product._id,
|
|
168
|
-
maxPrice?.isTaxable,
|
|
169
|
-
maxPrice?.isNetPrice,
|
|
170
|
-
maxPrice?.amount,
|
|
171
|
-
maxPrice?.currencyCode,
|
|
172
|
-
].join(''),
|
|
173
|
-
);
|
|
174
|
-
|
|
175
145
|
return {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
_id: minPriceHash,
|
|
179
|
-
...minPrice,
|
|
180
|
-
},
|
|
181
|
-
maxPrice: {
|
|
182
|
-
_id: maxPriceHash,
|
|
183
|
-
...maxPrice,
|
|
184
|
-
},
|
|
146
|
+
minPrice,
|
|
147
|
+
maxPrice,
|
|
185
148
|
};
|
|
186
149
|
},
|
|
187
150
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ProductDiscount as ProductDiscountType } from '@unchainedshop/core-products';
|
|
2
2
|
import { ProductDiscountDirector } from '@unchainedshop/core';
|
|
3
|
-
import { sha256 } from '@unchainedshop/utils';
|
|
4
3
|
|
|
5
4
|
export const ProductDiscount = {
|
|
6
5
|
interface: async (productDiscount: ProductDiscountType) => {
|
|
@@ -15,11 +14,10 @@ export const ProductDiscount = {
|
|
|
15
14
|
};
|
|
16
15
|
},
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
const { total
|
|
17
|
+
total(productDiscount: ProductDiscountType) {
|
|
18
|
+
const { total } = productDiscount;
|
|
20
19
|
if (productDiscount.total) {
|
|
21
20
|
return {
|
|
22
|
-
_id: await sha256([`${_id}`, total.amount, total.currency].join('')),
|
|
23
21
|
amount: total.amount,
|
|
24
22
|
currency: total.currency,
|
|
25
23
|
};
|