addio-admin-sdk 1.7.169 → 1.7.170-canary-2
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/dist/Interfaces/Buylist/index.d.ts +19 -0
- package/dist/Interfaces/Buylist/index.js +3 -0
- package/dist/Interfaces/Buylist/index.js.map +1 -0
- package/dist/lib/Cart/index.js +34 -10
- package/dist/lib/Cart/index.js.map +1 -1
- package/dist/lib/Inventory/index.d.ts +20 -1
- package/dist/lib/Inventory/index.js +58 -3
- package/dist/lib/Inventory/index.js.map +1 -1
- package/dist/lib/TransferRequest/index.d.ts +12 -4
- package/dist/lib/TransferRequest/index.js +96 -16
- package/dist/lib/TransferRequest/index.js.map +1 -1
- package/dist/utils/cart.d.ts +5 -3
- package/dist/utils/cart.js +7 -5
- package/dist/utils/cart.js.map +1 -1
- package/package.json +3 -4
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import ITranslation from '../Translation';
|
|
2
|
+
export interface IBuylistItem {
|
|
3
|
+
readonly img: string;
|
|
4
|
+
readonly name: ITranslation[];
|
|
5
|
+
readonly slug: string;
|
|
6
|
+
readonly finish: string;
|
|
7
|
+
readonly buybackPrice: number;
|
|
8
|
+
readonly qty: number;
|
|
9
|
+
readonly sku: string;
|
|
10
|
+
readonly category_name?: ITranslation[];
|
|
11
|
+
readonly set_name?: ITranslation[];
|
|
12
|
+
}
|
|
13
|
+
export interface IBuylistCustomer {
|
|
14
|
+
firstname: string;
|
|
15
|
+
lastname: string;
|
|
16
|
+
email: string;
|
|
17
|
+
phone: string;
|
|
18
|
+
}
|
|
19
|
+
export type ConvoyOptions = 'ship' | 'in_person';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Interfaces/Buylist/index.ts"],"names":[],"mappings":""}
|
package/dist/lib/Cart/index.js
CHANGED
|
@@ -1998,7 +1998,7 @@ class Cart extends baseService_1.BaseServiceClass {
|
|
|
1998
1998
|
item: i,
|
|
1999
1999
|
qteToUpdate: i.qte,
|
|
2000
2000
|
inventoryItem: allInventoryItems.find((inv) => inv.sku == i.sku)
|
|
2001
|
-
})));
|
|
2001
|
+
})), space.options.get());
|
|
2002
2002
|
if (!!transfersWithItemsToUpdate) {
|
|
2003
2003
|
for (let updatesToDo of Object.entries(transfersWithItemsToUpdate)) {
|
|
2004
2004
|
const [transferID, specifics] = updatesToDo;
|
|
@@ -3350,6 +3350,7 @@ class Cart extends baseService_1.BaseServiceClass {
|
|
|
3350
3350
|
* @param banksUsedForCart Optionnal. Array of banks_used applied to cart
|
|
3351
3351
|
*/
|
|
3352
3352
|
this.updateWithPromiseToPurchasePrices = async (escompteItems, customPriceList = undefined, banksUsedForCart) => {
|
|
3353
|
+
var _b, _c, _d, _e;
|
|
3353
3354
|
if (!!!customPriceList || typeof customPriceList == 'string')
|
|
3354
3355
|
throw new Error('CustomPriceList is undefined!');
|
|
3355
3356
|
if (!!this.data().status &&
|
|
@@ -3373,21 +3374,44 @@ class Cart extends baseService_1.BaseServiceClass {
|
|
|
3373
3374
|
// for each item in the cart look for an associated discount item
|
|
3374
3375
|
for (let index = 0; index < updatedPriceProducts.length; index++) {
|
|
3375
3376
|
const item = updatedPriceProducts[index];
|
|
3376
|
-
//
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3377
|
+
// item isn't linked to any bank, so it can't get a PA discount
|
|
3378
|
+
if (!!!item.promise_to_purchase_association_ids || item.promise_to_purchase_association_ids.length == 0) {
|
|
3379
|
+
(0, logs_1.SystemLog)({
|
|
3380
|
+
clientName: 'sdk-admin | Cart | updateWithPromiseToPurchasePrices',
|
|
3381
|
+
clientToken: (_b = process.env.NEXT_PUBLIC_LOG_SYSTEM_KEY) !== null && _b !== void 0 ? _b : ''
|
|
3382
|
+
}, logs_1.LogType.INFO, `[PA-ESCOMPTE-DIAG] cart=${this._data.id} item=${item.sku} : escompte ignoré — aucune banque associée`);
|
|
3383
|
+
continue;
|
|
3384
|
+
}
|
|
3385
|
+
// item is linked to a bank but none of its banks are in banks_used
|
|
3386
|
+
if (!!banksUsedForCart &&
|
|
3387
|
+
banksUsedForCart.every((b) => !!!item.promise_to_purchase_association_ids.includes(b.bank_type_id))) {
|
|
3388
|
+
(0, logs_1.SystemLog)({
|
|
3389
|
+
clientName: 'sdk-admin | Cart | updateWithPromiseToPurchasePrices',
|
|
3390
|
+
clientToken: (_c = process.env.NEXT_PUBLIC_LOG_SYSTEM_KEY) !== null && _c !== void 0 ? _c : ''
|
|
3391
|
+
}, logs_1.LogType.WARNING, `[PA-ESCOMPTE-DIAG] cart=${this._data.id} item=${item.sku} : escompte ignoré — banque associée non utilisée. assoc=${item.promise_to_purchase_association_ids.join(',')} banksUsed=${banksUsedForCart.map((b) => b.bank_type_id).join(',')}`);
|
|
3383
3392
|
continue;
|
|
3384
3393
|
}
|
|
3385
3394
|
const associatedEscompte = (0, g2_1.getItemEscompteSupp)(customPriceList, item);
|
|
3386
|
-
if (!!!associatedEscompte)
|
|
3395
|
+
if (!!!associatedEscompte) {
|
|
3396
|
+
// item is eligible (bank linked + used) but no ESC<cat2> entry was found in the price list
|
|
3397
|
+
const diagCode2 = (0, object_1.recursiveCheckObject)(item, 'external_values.catégorie2');
|
|
3398
|
+
(0, logs_1.SystemLog)({
|
|
3399
|
+
clientName: 'sdk-admin | Cart | updateWithPromiseToPurchasePrices',
|
|
3400
|
+
clientToken: (_d = process.env.NEXT_PUBLIC_LOG_SYSTEM_KEY) !== null && _d !== void 0 ? _d : ''
|
|
3401
|
+
}, logs_1.LogType.WARNING, `[PA-ESCOMPTE-DIAG] cart=${this._data.id} item=${item.sku} cat2=${diagCode2} : escompte NON trouvé — recherche=ESC${diagCode2} presentDansListe=${!!customPriceList.find((p) => p.sku === 'ESC' + diagCode2)} tailleListe=${customPriceList.length}`);
|
|
3387
3402
|
continue;
|
|
3403
|
+
}
|
|
3388
3404
|
const escompteSuppCartItem = (0, g2_1.buildEscompteSuppCartItem)(escompteItems, customPriceList, associatedEscompte, item);
|
|
3389
|
-
if (!!!escompteSuppCartItem)
|
|
3405
|
+
if (!!!escompteSuppCartItem) {
|
|
3406
|
+
// the ESC<cat2> entry exists in the price list but the discount item couldn't be built
|
|
3407
|
+
const escSuppProduct = escompteItems[0];
|
|
3408
|
+
const escDecliPresent = !!escSuppProduct && escSuppProduct.data().declinations.some((d) => d.sku === associatedEscompte.sku);
|
|
3409
|
+
(0, logs_1.SystemLog)({
|
|
3410
|
+
clientName: 'sdk-admin | Cart | updateWithPromiseToPurchasePrices',
|
|
3411
|
+
clientToken: (_e = process.env.NEXT_PUBLIC_LOG_SYSTEM_KEY) !== null && _e !== void 0 ? _e : ''
|
|
3412
|
+
}, logs_1.LogType.WARNING, `[PA-ESCOMPTE-DIAG] cart=${this._data.id} item=${item.sku} : escompte NON construit — escSku=${associatedEscompte.sku} type=${associatedEscompte.type} price=${associatedEscompte.price} declinationEscSuppPaPresente=${escDecliPresent} nbEscompteItems=${escompteItems.length}`);
|
|
3390
3413
|
continue;
|
|
3414
|
+
}
|
|
3391
3415
|
associatedEscomptes.push(escompteSuppCartItem);
|
|
3392
3416
|
}
|
|
3393
3417
|
this._data = Object.assign(Object.assign({}, this._data), { items: [...updatedPriceProducts, ...associatedEscomptes] });
|