ng-easycommerce 0.0.638 → 0.0.640
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/README.md +5 -0
- package/bundles/ng-easycommerce.umd.js +68 -22
- package/bundles/ng-easycommerce.umd.js.map +1 -1
- package/bundles/ng-easycommerce.umd.min.js +1 -1
- package/bundles/ng-easycommerce.umd.min.js.map +1 -1
- package/esm2015/lib/ec-component/checkout-ec/success-ec/success-ec.component.js +7 -3
- package/esm2015/lib/ec-component/widgets-ec/place-to-pay-ec/place-to-pay-ec.component.js +23 -3
- package/esm2015/lib/ec-component/widgets-ec/redsys-catch-ec/redsys-catch-ec.component.js +10 -1
- package/esm2015/lib/services/products/product-detail.service.js +32 -19
- package/esm5/lib/ec-component/checkout-ec/success-ec/success-ec.component.js +7 -3
- package/esm5/lib/ec-component/widgets-ec/place-to-pay-ec/place-to-pay-ec.component.js +23 -3
- package/esm5/lib/ec-component/widgets-ec/redsys-catch-ec/redsys-catch-ec.component.js +10 -1
- package/esm5/lib/services/products/product-detail.service.js +32 -19
- package/fesm2015/ng-easycommerce.js +68 -22
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +68 -22
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/ec-component/widgets-ec/place-to-pay-ec/place-to-pay-ec.component.d.ts +4 -0
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -7583,7 +7583,7 @@ let SuccessEcComponent = class SuccessEcComponent extends ComponentHelper {
|
|
|
7583
7583
|
}
|
|
7584
7584
|
ngOnInit() {
|
|
7585
7585
|
this.checkoutService.order$.subscribe(res => {
|
|
7586
|
-
var _a, _b, _c, _d, _e
|
|
7586
|
+
var _a, _b, _c, _d, _e;
|
|
7587
7587
|
//console.log('LO QUE LLEGA EN ORDEN', res);
|
|
7588
7588
|
((_a = res) === null || _a === void 0 ? void 0 : _a.number) ? this.params = {
|
|
7589
7589
|
external_reference: res.number,
|
|
@@ -7591,7 +7591,11 @@ let SuccessEcComponent = class SuccessEcComponent extends ComponentHelper {
|
|
|
7591
7591
|
//this.payments = [{method:{code:'bank_transsfer'}}]
|
|
7592
7592
|
this.payments = ((_b = res) === null || _b === void 0 ? void 0 : _b.payments) ? res.payments : null;
|
|
7593
7593
|
if (((_e = (_d = (_c = this.payments) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.method) === null || _e === void 0 ? void 0 : _e.code) && this.isPlaceToPay(this.payments[0].method.code)) {
|
|
7594
|
-
|
|
7594
|
+
const stored = localStorage.getItem('total_amount');
|
|
7595
|
+
if (stored !== null) {
|
|
7596
|
+
this.totalAmount = parseFloat(stored);
|
|
7597
|
+
localStorage.removeItem('total_amount');
|
|
7598
|
+
}
|
|
7595
7599
|
const now = new Date();
|
|
7596
7600
|
this.paymentDate = now.toLocaleDateString('es-AR', {
|
|
7597
7601
|
day: '2-digit',
|
|
@@ -8924,16 +8928,19 @@ let ProductDetailService = class ProductDetailService {
|
|
|
8924
8928
|
options && options.forEach(option => Object.keys(option).forEach(key => this.setOption(key, option[key])));
|
|
8925
8929
|
};
|
|
8926
8930
|
this.generateAsociatedDataFromVariants = () => {
|
|
8927
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
8931
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
8928
8932
|
let asociated = {};
|
|
8929
8933
|
if (this.isReady()) {
|
|
8930
8934
|
asociated.stock = this.variants[0].stock;
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
asociated.
|
|
8935
|
+
// Precio: si viene taxLegendInfo usamos su price, si no el v.price
|
|
8936
|
+
const rawPrice = (_b = (_a = this.variants[0].taxLegendInfo) === null || _a === void 0 ? void 0 : _a.price, (_b !== null && _b !== void 0 ? _b : this.variants[0].price));
|
|
8937
|
+
asociated.price = rawPrice.toString();
|
|
8938
|
+
const rawSalePrice = (_d = (_c = this.variants[0].taxLegendInfo) === null || _c === void 0 ? void 0 : _c.saleprice, (_d !== null && _d !== void 0 ? _d : this.variants[0].saleprice));
|
|
8939
|
+
asociated.saleprice = rawSalePrice ? rawSalePrice.toString() : undefined;
|
|
8940
|
+
asociated.discount = ((_e = this.variants[0]) === null || _e === void 0 ? void 0 : _e.discount) || undefined;
|
|
8934
8941
|
asociated.properties = this.variants[0].properties ? this.beautifyProperties(this.variants[0].properties) : undefined;
|
|
8935
|
-
asociated.uniqueExternalCode = ((
|
|
8936
|
-
asociated.multipleQuantity = ((
|
|
8942
|
+
asociated.uniqueExternalCode = ((_f = this.variants[0]) === null || _f === void 0 ? void 0 : _f.uniqueExternalCode) || undefined;
|
|
8943
|
+
asociated.multipleQuantity = ((_g = this.variants[0]) === null || _g === void 0 ? void 0 : _g.multipleQuantity) || undefined;
|
|
8937
8944
|
}
|
|
8938
8945
|
else {
|
|
8939
8946
|
asociated.price = this.cratePrice();
|
|
@@ -8944,22 +8951,32 @@ let ProductDetailService = class ProductDetailService {
|
|
|
8944
8951
|
('images' in this.variants[0] && this.variants[0].images.length > 0)
|
|
8945
8952
|
? asociated.picture = this.variants[0].images[0]
|
|
8946
8953
|
: asociated.picture = (this.asociatedDataSubject.value.picture || this.productSubject.value.picturesdefault[0]);
|
|
8947
|
-
asociated.maximumAmount = ((
|
|
8948
|
-
asociated.minimumAmount = ((
|
|
8949
|
-
asociated.maximumItemsQuantity = ((
|
|
8950
|
-
asociated.minimumItemsQuantity = ((
|
|
8951
|
-
&& ((
|
|
8954
|
+
asociated.maximumAmount = ((_h = this.variants[0]) === null || _h === void 0 ? void 0 : _h.maximumAmount) || 0;
|
|
8955
|
+
asociated.minimumAmount = ((_j = this.variants[0]) === null || _j === void 0 ? void 0 : _j.minimumAmount) || 0;
|
|
8956
|
+
asociated.maximumItemsQuantity = ((_k = this.variants[0]) === null || _k === void 0 ? void 0 : _k.stock) > 0 && 'maximumItemsQuantity' in this.variants[0] ? (_l = this.variants[0]) === null || _l === void 0 ? void 0 : _l.maximumItemsQuantity : (_m = this.variants[0]) === null || _m === void 0 ? void 0 : _m.stock;
|
|
8957
|
+
asociated.minimumItemsQuantity = ((_o = this.variants[0]) === null || _o === void 0 ? void 0 : _o.stock) > 0 && 'minimumItemsQuantity' in this.variants[0]
|
|
8958
|
+
&& ((_p = this.variants[0]) === null || _p === void 0 ? void 0 : _p.minimumItemsQuantity) > 0 ? (_q = this.variants[0]) === null || _q === void 0 ? void 0 : _q.minimumItemsQuantity : (((_r = this.variants[0]) === null || _r === void 0 ? void 0 : _r.multipleQuantity) ? (_s = this.variants[0]) === null || _s === void 0 ? void 0 : _s.multipleQuantity : 1);
|
|
8952
8959
|
asociated.finalConsumer = {
|
|
8953
|
-
finalConsumerPrice: (
|
|
8954
|
-
originalFinalConsumerPrice: (
|
|
8960
|
+
finalConsumerPrice: (_t = this.variants[0]) === null || _t === void 0 ? void 0 : _t.final_consumer_price,
|
|
8961
|
+
originalFinalConsumerPrice: (_u = this.variants[0]) === null || _u === void 0 ? void 0 : _u.original_final_consumer_price,
|
|
8955
8962
|
};
|
|
8956
8963
|
asociated.taxes = {
|
|
8957
|
-
taxIncluded: (
|
|
8958
|
-
taxCategory: (
|
|
8964
|
+
taxIncluded: (_v = this.variants[0]) === null || _v === void 0 ? void 0 : _v.taxIncluded,
|
|
8965
|
+
taxCategory: (_w = this.variants[0]) === null || _w === void 0 ? void 0 : _w.taxCategory,
|
|
8959
8966
|
};
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8967
|
+
// Segun version del backend
|
|
8968
|
+
if ((_x = this.variants[0]) === null || _x === void 0 ? void 0 : _x.taxLegendInfo) {
|
|
8969
|
+
// Nuevo backend
|
|
8970
|
+
asociated.priceWithoutTaxes = (_y = this.variants[0]) === null || _y === void 0 ? void 0 : _y.taxLegendInfo.priceWithoutTaxes;
|
|
8971
|
+
asociated.taxeAmount = (_z = this.variants[0]) === null || _z === void 0 ? void 0 : _z.taxLegendInfo.taxes;
|
|
8972
|
+
asociated.taxRate = (_0 = this.variants[0]) === null || _0 === void 0 ? void 0 : _0.taxLegendInfo.taxRate;
|
|
8973
|
+
}
|
|
8974
|
+
else {
|
|
8975
|
+
// Backend antiguo
|
|
8976
|
+
asociated.priceWithoutTaxes = (_2 = (_1 = this.variants[0]) === null || _1 === void 0 ? void 0 : _1.priceWithoutTaxes, (_2 !== null && _2 !== void 0 ? _2 : undefined));
|
|
8977
|
+
asociated.taxeAmount = (_4 = (_3 = this.variants[0]) === null || _3 === void 0 ? void 0 : _3.taxes, (_4 !== null && _4 !== void 0 ? _4 : undefined));
|
|
8978
|
+
asociated.taxRate = (_6 = (_5 = this.variants[0]) === null || _5 === void 0 ? void 0 : _5.taxRate, (_6 !== null && _6 !== void 0 ? _6 : undefined));
|
|
8979
|
+
}
|
|
8963
8980
|
this.asociatedDataSubject.next(asociated);
|
|
8964
8981
|
};
|
|
8965
8982
|
/**
|
|
@@ -10601,15 +10618,24 @@ let RedsysCatchEcComponent = class RedsysCatchEcComponent extends ComponentHelpe
|
|
|
10601
10618
|
case '200':
|
|
10602
10619
|
state = 'success';
|
|
10603
10620
|
this.setStateInLocal('Su pago fue procesado con éxito.', state);
|
|
10621
|
+
if (queryParams.total_amount) {
|
|
10622
|
+
localStorage.setItem('total_amount', queryParams.total_amount);
|
|
10623
|
+
}
|
|
10604
10624
|
break;
|
|
10605
10625
|
case 'success':
|
|
10606
10626
|
this.setStateInLocal('Su pago fue procesado con éxito.', state);
|
|
10627
|
+
if (queryParams.total_amount) {
|
|
10628
|
+
localStorage.setItem('total_amount', queryParams.total_amount);
|
|
10629
|
+
}
|
|
10607
10630
|
break;
|
|
10608
10631
|
case 'pending':
|
|
10609
10632
|
this.setStateInLocal('Su pago fue procesado con éxito.', state);
|
|
10610
10633
|
break;
|
|
10611
10634
|
case 'failure':
|
|
10612
10635
|
this.setStateInLocal('Se ha cancelado el proceso de pago.', state);
|
|
10636
|
+
if (queryParams.total_amount) {
|
|
10637
|
+
localStorage.setItem('total_amount', queryParams.total_amount);
|
|
10638
|
+
}
|
|
10613
10639
|
break;
|
|
10614
10640
|
case 'cancel':
|
|
10615
10641
|
this.setStateInLocal('Se ha cancelado el proceso de pago.', state);
|
|
@@ -16291,6 +16317,10 @@ let PlaceToPayEcComponent = class PlaceToPayEcComponent extends ComponentHelper
|
|
|
16291
16317
|
this.ready = new EventEmitter();
|
|
16292
16318
|
this.loading = false;
|
|
16293
16319
|
this.closeModal = '';
|
|
16320
|
+
this.hasPreviousFailure = false;
|
|
16321
|
+
this.previousFailureAmount = null;
|
|
16322
|
+
this.previousFailureDate = null;
|
|
16323
|
+
this.buttonText = 'Pagar';
|
|
16294
16324
|
this.dataRedirect = () => this.consts.getUrlBase() + 'shop-api/' + this.consts.getChannel() + '/place-to-pay/' + this.cartService.cart_token + '/process-payment';
|
|
16295
16325
|
this.iniciar = () => {
|
|
16296
16326
|
this.closeModal = '';
|
|
@@ -16311,17 +16341,33 @@ let PlaceToPayEcComponent = class PlaceToPayEcComponent extends ComponentHelper
|
|
|
16311
16341
|
var _a, _b, _c, _d;
|
|
16312
16342
|
let state = this.closeModal !== '' ? this.closeModal : localStorage.getItem('state');
|
|
16313
16343
|
!state && ((_a = this.ventana) === null || _a === void 0 ? void 0 : _a.closed) && (state = 'cancel');
|
|
16344
|
+
this.hasPreviousFailure = false;
|
|
16314
16345
|
this.loading = true;
|
|
16315
16346
|
if (state) {
|
|
16316
|
-
this.loading = false;
|
|
16317
16347
|
localStorage.removeItem('state');
|
|
16318
16348
|
if (state === 'success' || state === 'pending') {
|
|
16319
16349
|
(_b = this.ventana) === null || _b === void 0 ? void 0 : _b.close();
|
|
16320
16350
|
this.ready.emit(true);
|
|
16321
16351
|
return;
|
|
16322
16352
|
}
|
|
16353
|
+
this.loading = false;
|
|
16323
16354
|
if (state === 'failure' || state === 'cancel') {
|
|
16324
16355
|
(_c = this.ventana) === null || _c === void 0 ? void 0 : _c.close();
|
|
16356
|
+
if (state === 'failure') {
|
|
16357
|
+
const amt = localStorage.getItem('total_amount');
|
|
16358
|
+
if (amt) {
|
|
16359
|
+
this.hasPreviousFailure = true;
|
|
16360
|
+
this.previousFailureAmount = parseFloat(amt);
|
|
16361
|
+
this.previousFailureDate = new Date().toLocaleDateString('es-AR', {
|
|
16362
|
+
day: '2-digit',
|
|
16363
|
+
month: '2-digit',
|
|
16364
|
+
year: 'numeric',
|
|
16365
|
+
});
|
|
16366
|
+
this.buttonText = 'Reintentar pago';
|
|
16367
|
+
localStorage.removeItem('total_amount');
|
|
16368
|
+
localStorage.removeItem('payment_date');
|
|
16369
|
+
}
|
|
16370
|
+
}
|
|
16325
16371
|
this.getPreference();
|
|
16326
16372
|
this.processError(state === 'cancel' ? 'Se canceló el pago con Place to Pay' : '');
|
|
16327
16373
|
return;
|
|
@@ -16384,7 +16430,7 @@ __decorate$20([
|
|
|
16384
16430
|
PlaceToPayEcComponent = __decorate$20([
|
|
16385
16431
|
Component({
|
|
16386
16432
|
selector: 'app-place-to-pay-ec',
|
|
16387
|
-
template: "<div class=\"text-center\">\n <ng-container *ngIf=\"url; else loadingUrl\">\n <ng-container *ngIf=\"!loading; else loadingTemp\">\n <button (click)=\"iniciar()\" class=\"btn btn-outline-secondary rounded-0 comprar mt-3\"
|
|
16433
|
+
template: "<div class=\"text-center\">\n <ng-container *ngIf=\"url; else loadingUrl\">\n <ng-container *ngIf=\"!loading; else loadingTemp\">\n <button (click)=\"iniciar()\" class=\"btn btn-outline-secondary rounded-0 comprar mt-3\">\n {{ buttonText }}\n </button>\n\n <!-- Mensaje de intento previo fallido -->\n <div *ngIf=\"hasPreviousFailure\" class=\"alert alert-danger mt-3\">\n El pago no se pudo realizar el {{ previousFailureDate }}\n por un monto de {{ previousFailureAmount | ecCurrencySymbol }}.\n </div>\n </ng-container>\n </ng-container>\n</div>\n\n<ng-template #loadingUrl>\n <div class=\"d-flex flex-column justify-content-center align-items-center mt-2\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n</ng-template>\n\n<ng-template #loadingTemp>\n <div class=\"d-flex flex-column justify-content-center align-items-center mt-2\">\n <h3>Procesando el pago por Place to Pay</h3>\n <h5>Recuerde hacer click en \"Volver al sitio\" desde Place to Pay para finalizar la compra.</h5>\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n <div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col-5\">\n <hr>\n </div>\n <div class=\"col-2 text-center\">\n <label>o</label>\n </div>\n <div class=\"col-5\">\n <hr>\n </div>\n </div>\n </div>\n <div class=\"d-flex flex-column justify-content-center align-items-center mt-2\">\n <button (click)=\"clickClose()\" class=\"btn btn-outline-secondary rounded-0 comprar\">Cancelar pago</button>\n </div>\n</ng-template>",
|
|
16388
16434
|
styles: [""]
|
|
16389
16435
|
})
|
|
16390
16436
|
], PlaceToPayEcComponent);
|