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
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# version 0.0.640
|
|
2
|
+
- `place-to-pay`: agregar manejo de pago rechazado
|
|
3
|
+
- `product-detail.service`: se toma el saleprice de `taxLegendInfo`
|
|
4
|
+
# version 0.0.639
|
|
5
|
+
- se actualizo la funcionalidad de impuestos nacionales, por cambios en el endpoint del backend.
|
|
1
6
|
# version 0.0.638
|
|
2
7
|
- evitar múltiples solicitudes al agregar productos al carrito
|
|
3
8
|
# version 0.0.637
|
|
@@ -9114,7 +9114,7 @@
|
|
|
9114
9114
|
SuccessEcComponent.prototype.ngOnInit = function () {
|
|
9115
9115
|
var _this = this;
|
|
9116
9116
|
this.checkoutService.order$.subscribe(function (res) {
|
|
9117
|
-
var _a, _b, _c, _d, _e
|
|
9117
|
+
var _a, _b, _c, _d, _e;
|
|
9118
9118
|
//console.log('LO QUE LLEGA EN ORDEN', res);
|
|
9119
9119
|
((_a = res) === null || _a === void 0 ? void 0 : _a.number) ? _this.params = {
|
|
9120
9120
|
external_reference: res.number,
|
|
@@ -9122,7 +9122,11 @@
|
|
|
9122
9122
|
//this.payments = [{method:{code:'bank_transsfer'}}]
|
|
9123
9123
|
_this.payments = ((_b = res) === null || _b === void 0 ? void 0 : _b.payments) ? res.payments : null;
|
|
9124
9124
|
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)) {
|
|
9125
|
-
|
|
9125
|
+
var stored = localStorage.getItem('total_amount');
|
|
9126
|
+
if (stored !== null) {
|
|
9127
|
+
_this.totalAmount = parseFloat(stored);
|
|
9128
|
+
localStorage.removeItem('total_amount');
|
|
9129
|
+
}
|
|
9126
9130
|
var now = new Date();
|
|
9127
9131
|
_this.paymentDate = now.toLocaleDateString('es-AR', {
|
|
9128
9132
|
day: '2-digit',
|
|
@@ -10792,16 +10796,19 @@
|
|
|
10792
10796
|
options && options.forEach(function (option) { return Object.keys(option).forEach(function (key) { return _this.setOption(key, option[key]); }); });
|
|
10793
10797
|
};
|
|
10794
10798
|
this.generateAsociatedDataFromVariants = function () {
|
|
10795
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
10799
|
+
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;
|
|
10796
10800
|
var asociated = {};
|
|
10797
10801
|
if (_this.isReady()) {
|
|
10798
10802
|
asociated.stock = _this.variants[0].stock;
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
asociated.
|
|
10803
|
+
// Precio: si viene taxLegendInfo usamos su price, si no el v.price
|
|
10804
|
+
var 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));
|
|
10805
|
+
asociated.price = rawPrice.toString();
|
|
10806
|
+
var 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));
|
|
10807
|
+
asociated.saleprice = rawSalePrice ? rawSalePrice.toString() : undefined;
|
|
10808
|
+
asociated.discount = ((_e = _this.variants[0]) === null || _e === void 0 ? void 0 : _e.discount) || undefined;
|
|
10802
10809
|
asociated.properties = _this.variants[0].properties ? _this.beautifyProperties(_this.variants[0].properties) : undefined;
|
|
10803
|
-
asociated.uniqueExternalCode = ((
|
|
10804
|
-
asociated.multipleQuantity = ((
|
|
10810
|
+
asociated.uniqueExternalCode = ((_f = _this.variants[0]) === null || _f === void 0 ? void 0 : _f.uniqueExternalCode) || undefined;
|
|
10811
|
+
asociated.multipleQuantity = ((_g = _this.variants[0]) === null || _g === void 0 ? void 0 : _g.multipleQuantity) || undefined;
|
|
10805
10812
|
}
|
|
10806
10813
|
else {
|
|
10807
10814
|
asociated.price = _this.cratePrice();
|
|
@@ -10812,22 +10819,32 @@
|
|
|
10812
10819
|
('images' in _this.variants[0] && _this.variants[0].images.length > 0)
|
|
10813
10820
|
? asociated.picture = _this.variants[0].images[0]
|
|
10814
10821
|
: asociated.picture = (_this.asociatedDataSubject.value.picture || _this.productSubject.value.picturesdefault[0]);
|
|
10815
|
-
asociated.maximumAmount = ((
|
|
10816
|
-
asociated.minimumAmount = ((
|
|
10817
|
-
asociated.maximumItemsQuantity = ((
|
|
10818
|
-
asociated.minimumItemsQuantity = ((
|
|
10819
|
-
&& ((
|
|
10822
|
+
asociated.maximumAmount = ((_h = _this.variants[0]) === null || _h === void 0 ? void 0 : _h.maximumAmount) || 0;
|
|
10823
|
+
asociated.minimumAmount = ((_j = _this.variants[0]) === null || _j === void 0 ? void 0 : _j.minimumAmount) || 0;
|
|
10824
|
+
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;
|
|
10825
|
+
asociated.minimumItemsQuantity = ((_o = _this.variants[0]) === null || _o === void 0 ? void 0 : _o.stock) > 0 && 'minimumItemsQuantity' in _this.variants[0]
|
|
10826
|
+
&& ((_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);
|
|
10820
10827
|
asociated.finalConsumer = {
|
|
10821
|
-
finalConsumerPrice: (
|
|
10822
|
-
originalFinalConsumerPrice: (
|
|
10828
|
+
finalConsumerPrice: (_t = _this.variants[0]) === null || _t === void 0 ? void 0 : _t.final_consumer_price,
|
|
10829
|
+
originalFinalConsumerPrice: (_u = _this.variants[0]) === null || _u === void 0 ? void 0 : _u.original_final_consumer_price,
|
|
10823
10830
|
};
|
|
10824
10831
|
asociated.taxes = {
|
|
10825
|
-
taxIncluded: (
|
|
10826
|
-
taxCategory: (
|
|
10832
|
+
taxIncluded: (_v = _this.variants[0]) === null || _v === void 0 ? void 0 : _v.taxIncluded,
|
|
10833
|
+
taxCategory: (_w = _this.variants[0]) === null || _w === void 0 ? void 0 : _w.taxCategory,
|
|
10827
10834
|
};
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10835
|
+
// Segun version del backend
|
|
10836
|
+
if ((_x = _this.variants[0]) === null || _x === void 0 ? void 0 : _x.taxLegendInfo) {
|
|
10837
|
+
// Nuevo backend
|
|
10838
|
+
asociated.priceWithoutTaxes = (_y = _this.variants[0]) === null || _y === void 0 ? void 0 : _y.taxLegendInfo.priceWithoutTaxes;
|
|
10839
|
+
asociated.taxeAmount = (_z = _this.variants[0]) === null || _z === void 0 ? void 0 : _z.taxLegendInfo.taxes;
|
|
10840
|
+
asociated.taxRate = (_0 = _this.variants[0]) === null || _0 === void 0 ? void 0 : _0.taxLegendInfo.taxRate;
|
|
10841
|
+
}
|
|
10842
|
+
else {
|
|
10843
|
+
// Backend antiguo
|
|
10844
|
+
asociated.priceWithoutTaxes = (_2 = (_1 = _this.variants[0]) === null || _1 === void 0 ? void 0 : _1.priceWithoutTaxes, (_2 !== null && _2 !== void 0 ? _2 : undefined));
|
|
10845
|
+
asociated.taxeAmount = (_4 = (_3 = _this.variants[0]) === null || _3 === void 0 ? void 0 : _3.taxes, (_4 !== null && _4 !== void 0 ? _4 : undefined));
|
|
10846
|
+
asociated.taxRate = (_6 = (_5 = _this.variants[0]) === null || _5 === void 0 ? void 0 : _5.taxRate, (_6 !== null && _6 !== void 0 ? _6 : undefined));
|
|
10847
|
+
}
|
|
10831
10848
|
_this.asociatedDataSubject.next(asociated);
|
|
10832
10849
|
};
|
|
10833
10850
|
/**
|
|
@@ -12731,15 +12748,24 @@
|
|
|
12731
12748
|
case '200':
|
|
12732
12749
|
state = 'success';
|
|
12733
12750
|
_this.setStateInLocal('Su pago fue procesado con éxito.', state);
|
|
12751
|
+
if (queryParams.total_amount) {
|
|
12752
|
+
localStorage.setItem('total_amount', queryParams.total_amount);
|
|
12753
|
+
}
|
|
12734
12754
|
break;
|
|
12735
12755
|
case 'success':
|
|
12736
12756
|
_this.setStateInLocal('Su pago fue procesado con éxito.', state);
|
|
12757
|
+
if (queryParams.total_amount) {
|
|
12758
|
+
localStorage.setItem('total_amount', queryParams.total_amount);
|
|
12759
|
+
}
|
|
12737
12760
|
break;
|
|
12738
12761
|
case 'pending':
|
|
12739
12762
|
_this.setStateInLocal('Su pago fue procesado con éxito.', state);
|
|
12740
12763
|
break;
|
|
12741
12764
|
case 'failure':
|
|
12742
12765
|
_this.setStateInLocal('Se ha cancelado el proceso de pago.', state);
|
|
12766
|
+
if (queryParams.total_amount) {
|
|
12767
|
+
localStorage.setItem('total_amount', queryParams.total_amount);
|
|
12768
|
+
}
|
|
12743
12769
|
break;
|
|
12744
12770
|
case 'cancel':
|
|
12745
12771
|
_this.setStateInLocal('Se ha cancelado el proceso de pago.', state);
|
|
@@ -19266,6 +19292,10 @@
|
|
|
19266
19292
|
_this.ready = new core.EventEmitter();
|
|
19267
19293
|
_this.loading = false;
|
|
19268
19294
|
_this.closeModal = '';
|
|
19295
|
+
_this.hasPreviousFailure = false;
|
|
19296
|
+
_this.previousFailureAmount = null;
|
|
19297
|
+
_this.previousFailureDate = null;
|
|
19298
|
+
_this.buttonText = 'Pagar';
|
|
19269
19299
|
_this.dataRedirect = function () {
|
|
19270
19300
|
return _this.consts.getUrlBase() + 'shop-api/' + _this.consts.getChannel() + '/place-to-pay/' + _this.cartService.cart_token + '/process-payment';
|
|
19271
19301
|
};
|
|
@@ -19288,17 +19318,33 @@
|
|
|
19288
19318
|
var _a, _b, _c, _d;
|
|
19289
19319
|
var state = _this.closeModal !== '' ? _this.closeModal : localStorage.getItem('state');
|
|
19290
19320
|
!state && ((_a = _this.ventana) === null || _a === void 0 ? void 0 : _a.closed) && (state = 'cancel');
|
|
19321
|
+
_this.hasPreviousFailure = false;
|
|
19291
19322
|
_this.loading = true;
|
|
19292
19323
|
if (state) {
|
|
19293
|
-
_this.loading = false;
|
|
19294
19324
|
localStorage.removeItem('state');
|
|
19295
19325
|
if (state === 'success' || state === 'pending') {
|
|
19296
19326
|
(_b = _this.ventana) === null || _b === void 0 ? void 0 : _b.close();
|
|
19297
19327
|
_this.ready.emit(true);
|
|
19298
19328
|
return;
|
|
19299
19329
|
}
|
|
19330
|
+
_this.loading = false;
|
|
19300
19331
|
if (state === 'failure' || state === 'cancel') {
|
|
19301
19332
|
(_c = _this.ventana) === null || _c === void 0 ? void 0 : _c.close();
|
|
19333
|
+
if (state === 'failure') {
|
|
19334
|
+
var amt = localStorage.getItem('total_amount');
|
|
19335
|
+
if (amt) {
|
|
19336
|
+
_this.hasPreviousFailure = true;
|
|
19337
|
+
_this.previousFailureAmount = parseFloat(amt);
|
|
19338
|
+
_this.previousFailureDate = new Date().toLocaleDateString('es-AR', {
|
|
19339
|
+
day: '2-digit',
|
|
19340
|
+
month: '2-digit',
|
|
19341
|
+
year: 'numeric',
|
|
19342
|
+
});
|
|
19343
|
+
_this.buttonText = 'Reintentar pago';
|
|
19344
|
+
localStorage.removeItem('total_amount');
|
|
19345
|
+
localStorage.removeItem('payment_date');
|
|
19346
|
+
}
|
|
19347
|
+
}
|
|
19302
19348
|
_this.getPreference();
|
|
19303
19349
|
_this.processError(state === 'cancel' ? 'Se canceló el pago con Place to Pay' : '');
|
|
19304
19350
|
return;
|
|
@@ -19361,7 +19407,7 @@
|
|
|
19361
19407
|
PlaceToPayEcComponent = __decorate$20([
|
|
19362
19408
|
core.Component({
|
|
19363
19409
|
selector: 'app-place-to-pay-ec',
|
|
19364
|
-
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\"
|
|
19410
|
+
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>",
|
|
19365
19411
|
styles: [""]
|
|
19366
19412
|
})
|
|
19367
19413
|
], PlaceToPayEcComponent);
|