ng-easycommerce 0.0.619 → 0.0.621

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 CHANGED
@@ -1,3 +1,11 @@
1
+ # version 0.0.621
2
+ - Se agregan traducciones
3
+ # version 0.0.620
4
+ - Se mejora la validación de métodos de pago cuando el cliente tiene cuenta corriente:
5
+ - Si `allowAnyPaymentMethod` es `false`, se bloquean otros métodos que no sean cuenta corriente.
6
+ - Se valida correctamente el crédito disponible solo si `allowExceedBalance` es `false`.
7
+ - Se elimina el método `shouldDisplayMethod` y se centraliza la lógica en `setMethod`.
8
+ - Se muestra u oculta el mensaje de error mediante una variable (`showMethodError`) y `*ngIf`.
1
9
  # version 0.0.618
2
10
  - Se añade if para comprobar si existe priceWithouTaxes
3
11
  # version 0.0.618
@@ -287,10 +287,12 @@
287
287
  "repeat-order": "Repetir comanda",
288
288
  "no-products-to-add": "No hi ha productes per afegir",
289
289
  "not-enough-credits": "No té prou crèdits per comprar aquest producte",
290
+ "not-enough-credits-to-complete": "Ho sentim, no pots completar la teva compra perquè no tens prou crèdit disponible.",
290
291
  "max-orders-reached": "Has assolit el nombre màxim de comandes",
291
292
  "order_limit_reached": "Límit de comandes assolit",
292
293
  "insufficient_credit": "Crèdit insuficient",
293
294
  "national-taxes": "Impostos nacionals",
294
295
  "taxes": "Impostos",
295
- "price-without-national-taxes": "Preu sense impostos nacionals"
296
+ "price-without-national-taxes": "Preu sense impostos nacionals",
297
+ "this-payment-method-cannot-be-used": "Aquest mètode de pagament no es pot utilitzar"
296
298
  }
@@ -390,6 +390,7 @@
390
390
  "repeat-order": "Repeat order",
391
391
  "no-products-to-add": "You have no products to add",
392
392
  "not-enough-credits": "You do not have enough credits to make this purchase.",
393
+ "not-enough-credits-to-complete": "Sorry, you cannot complete your purchase because you do not have enough available credit.",
393
394
  "thanks-send-review": "Thank you for leaving a review.",
394
395
  "authenticated-for-comment": "Please log in to leave a review.",
395
396
  "max-orders-reached": "You have reached the maximum number of orders allowed.",
@@ -402,6 +403,6 @@
402
403
  "auth.login_prompt": "Enter your email and password to continue.",
403
404
  "auth.forgot_password": "Forgot your password?",
404
405
  "clientTaxes": "Taxes per customer",
405
- "email_already_registered": "The email entered is already registered."
406
-
406
+ "email_already_registered": "The email entered is already registered.",
407
+ "this-payment-method-cannot-be-used": "This payment method cannot be used"
407
408
  }
@@ -395,6 +395,7 @@
395
395
  "repeat-order": "Repetir pedido",
396
396
  "no-products-to-add": "No hay productos para agregar",
397
397
  "not-enough-credits": "No tiene suficientes créditos para comprar este producto",
398
+ "not-enough-credits-to-complete": "Lo sentimos, no puedes completar tu compra debido a que no tienes suficiente crédito disponible.",
398
399
  "thanks-send-review": "Gracias por dejar una reseña.",
399
400
  "authenticated-for-comment": "Inicia sesión para dejar una reseña.",
400
401
  "max-orders-reached": "Has alcanzado el número máximo de pedidos",
@@ -403,11 +404,13 @@
403
404
  "all-products-out-of-stock": "Los productos seleccionados no tienen stock",
404
405
  "some-products-out-of-stock": "Algunos productos seleccionados no tienen stock",
405
406
  "unable-get-orders": "No fue posible obtener las ordenes. Vuelva a intentarlo más tarde",
406
- "get-into": "Ingresar",
407
+ "get-into": "Parece que ya tienes una cuenta.",
408
+ "get-into2": "Ingresar",
407
409
  "auth.login_prompt": "Si ya estás registrado. Ingresa en tu cuenta con tu email y la contraseña adecuada.",
408
410
  "auth.forgot_password": "¿Olvidó su contraseña?",
409
411
  "clientTaxes": "Impuesto por cliente",
410
412
  "email_already_registered": "El email ingresado ya se encuentra registrado.",
411
- "quantity-not-exceeded": "Debe realizar un pedido con un monto mínimo de {{ amount }} para finalizar su compra."
413
+ "quantity-not-exceeded": "Debe realizar un pedido con un monto mínimo de {{ amount }} para finalizar su compra.",
414
+ "this-payment-method-cannot-be-used": "Este método de pago no puede ser utilizado"
412
415
 
413
416
  }
@@ -279,10 +279,12 @@
279
279
  "repeat-order": "Répéter la commande",
280
280
  "no-products-to-add": "Aucun produit à ajouter",
281
281
  "not-enough-credits": "Vous n'avez pas assez de crédits pour acheter ce produit",
282
+ "not-enough-credits-to-complete": "Désolé, vous ne pouvez pas finaliser votre achat car vous n'avez pas assez de crédit disponible.",
282
283
  "max-orders-reached": "Vous avez atteint le nombre maximum de commandes.",
283
284
  "order_limit_reached": "Limite de commandes atteinte",
284
285
  "insufficient_credit": "Crédit insuffisant",
285
286
  "national-taxes": "Taxes nationales",
286
287
  "taxes": "Taxes",
287
- "price-without-national-taxes": "Prix sans taxes nationales"
288
+ "price-without-national-taxes": "Prix sans taxes nationales",
289
+ "this-payment-method-cannot-be-used": "Ce mode de paiement ne peut pas être utilisé"
288
290
  }
@@ -287,10 +287,12 @@
287
287
  "repeat-order": "Repetir pedido",
288
288
  "no-products-to-add": "Non hai produtos para engadir",
289
289
  "not-enough-credits": "Non ten suficientes créditos para realizar a compra",
290
+ "not-enough-credits-to-complete": "Sentímolo, non podes completar a túa compra porque non tes crédito dispoñible suficiente.",
290
291
  "max-orders-reached": "Acadaches o número máximo de pedidos",
291
292
  "order_limit_reached": "Límite de pedidos acadado",
292
293
  "insufficient_credit": "Crédito insuficiente",
293
294
  "national-taxes": "Impostos nacionais",
294
295
  "taxes": "Impostos",
295
- "price-without-national-taxes": "Prezo sen impostos nacionais"
296
+ "price-without-national-taxes": "Prezo sen impostos nacionais",
297
+ "this-payment-method-cannot-be-used": "Este método de pago non pode ser usado"
296
298
  }
@@ -287,10 +287,12 @@
287
287
  "repeat-order": "Repetir pedido",
288
288
  "no-products-to-add": "Não há produtos para adicionar",
289
289
  "not-enough-credits": "Você não tem créditos suficientes para fazer essa compra",
290
+ "not-enough-credits-to-complete": "Lamentamos, não pode concluir a sua compra porque não tem crédito disponível suficiente.",
290
291
  "max-orders-reached": "Você atingiu o número máximo de pedidos",
291
292
  "order_limit_reached": "Limite de pedidos atingido",
292
293
  "insufficient_credit": "Crédito insuficiente",
293
294
  "national-taxes": "Impostos nacionais",
294
295
  "taxes": "Impostos",
295
- "price-without-national-taxes": "Preço sem impostos nacionais"
296
+ "price-without-national-taxes": "Preço sem impostos nacionais",
297
+ "this-payment-method-cannot-be-used": "Este método de pagamento não pode ser utilizado"
296
298
  }
@@ -3587,7 +3587,10 @@
3587
3587
  return [4 /*yield*/, this.completeOrder()];
3588
3588
  case 1:
3589
3589
  result = _a.sent();
3590
- if (result && result.error) {
3590
+ if (!result ||
3591
+ result.error ||
3592
+ result.code === 'insufficient_credit' ||
3593
+ result.code === 'error') {
3591
3594
  this.cartService.changeHaveToUpdate(false);
3592
3595
  this.loadingSubject.next(false);
3593
3596
  return [2 /*return*/, ({ ok: false, require_login: true, message: 'not-completed' })];
@@ -4760,8 +4763,9 @@
4760
4763
  };
4761
4764
  this.updateCartObj = function (cart, emitEvent) {
4762
4765
  if (emitEvent === void 0) { emitEvent = true; }
4766
+ var _a, _b, _c;
4763
4767
  _this.cartSubject.next(cart);
4764
- _this.updateBalanceAttributes(cart);
4768
+ _this.updateBalanceAttributes((_a = cart) === null || _a === void 0 ? void 0 : _a.balanceCustomer, (_c = (_b = cart) === null || _b === void 0 ? void 0 : _b.totals) === null || _c === void 0 ? void 0 : _c.total);
4765
4769
  emitEvent && _this.analyticsService.callEvent('add_to_cart', cart);
4766
4770
  _this.promotionsSubject.next(_this.orderUtils.getPromotions(cart, true));
4767
4771
  cart.couponCode
@@ -4896,6 +4900,9 @@
4896
4900
  if (!balance || balance.creditAmount === null || balance.creditAmount === undefined) {
4897
4901
  return true;
4898
4902
  }
4903
+ if (balance.allowAnyPaymentMethod) {
4904
+ return true;
4905
+ }
4899
4906
  if (balance.remainingCredits === undefined) {
4900
4907
  return false;
4901
4908
  }
@@ -5173,21 +5180,21 @@
5173
5180
  return subtotal - total;
5174
5181
  }));
5175
5182
  };
5176
- CartService$1.prototype.updateBalanceAttributes = function (cartData) {
5177
- var _a, _b, _c;
5178
- var balance = (_a = cartData) === null || _a === void 0 ? void 0 : _a.balanceCustomer;
5183
+ CartService$1.prototype.updateBalanceAttributes = function (balance, total) {
5184
+ if (total === void 0) { total = null; }
5179
5185
  if (!balance) {
5180
5186
  this.balanceCustomerSubject.next(null);
5181
5187
  return;
5182
5188
  }
5189
+ var totalAmount = (total !== null && total !== void 0 ? total : 0);
5183
5190
  var balanceData = {
5184
5191
  allowAnyPaymentMethod: balance.allowAnyPaymentMethod,
5185
5192
  allowExceedBalance: balance.allowExceedBalance,
5186
5193
  creditAmount: balance.creditAmount,
5187
5194
  showMax: balance.showMax,
5188
5195
  showPrice: balance.showPrice,
5189
- remainingCredits: balance.creditAmount && ((_c = (_b = cartData) === null || _b === void 0 ? void 0 : _b.totals) === null || _c === void 0 ? void 0 : _c.total) && balance.creditAmount >= cartData.totals.total
5190
- ? balance.creditAmount - cartData.totals.total
5196
+ remainingCredits: balance.creditAmount != null && totalAmount != null && balance.creditAmount >= totalAmount
5197
+ ? balance.creditAmount - totalAmount
5191
5198
  : 0,
5192
5199
  applyMaxOrders: balance.applyMaxOrders,
5193
5200
  maxOrders: balance.maxOrders
@@ -8670,6 +8677,8 @@
8670
8677
  _this.method_data$ = _this.methodDataSubject.asObservable();
8671
8678
  _this.loading$ = _this.loadingSubject.asObservable();
8672
8679
  _this.allowAnyPaymentMethod = null;
8680
+ _this.balanceMethodRejected = false;
8681
+ _this.showMethodError = false;
8673
8682
  _this.allData = function () { return (__assign$k(__assign$k({}, _this.paymentService.getUserData().shippingAddress), _this.paymentService.getShipmentData())); };
8674
8683
  _this.setError = function (message) {
8675
8684
  _this.error = message;
@@ -8693,14 +8702,40 @@
8693
8702
  setTimeout(function (r) { return _this.emitResult(); }, 1000);
8694
8703
  };
8695
8704
  _this.setMethod = function (method) { return __awaiter$b(_this, void 0, void 0, function () {
8696
- var result;
8697
- return __generator$b(this, function (_a) {
8698
- switch (_a.label) {
8705
+ var result, balanceCustomer, totals, isBalanceMethod, allowAny;
8706
+ var _a, _b, _c, _d;
8707
+ return __generator$b(this, function (_e) {
8708
+ switch (_e.label) {
8699
8709
  case 0:
8700
8710
  this.methodDataSubject.next(null);
8711
+ this.showMethodError = false;
8701
8712
  return [4 /*yield*/, this.paymentService.putPayment(method.code)];
8702
8713
  case 1:
8703
- result = _a.sent();
8714
+ result = _e.sent();
8715
+ balanceCustomer = (_a = result) === null || _a === void 0 ? void 0 : _a.balanceCustomer;
8716
+ totals = (_b = result) === null || _b === void 0 ? void 0 : _b.totals;
8717
+ this.cartService.updateBalanceAttributes(balanceCustomer, (_c = totals) === null || _c === void 0 ? void 0 : _c.total);
8718
+ isBalanceMethod = this.isBalanceInAccount(method.code);
8719
+ allowAny = (_d = balanceCustomer) === null || _d === void 0 ? void 0 : _d.allowAnyPaymentMethod;
8720
+ // Validaciones de error
8721
+ if ((balanceCustomer && allowAny === false && !isBalanceMethod) || // no permite otro método
8722
+ (isBalanceMethod && !balanceCustomer) // seleccionó cuenta corriente pero no hay balance
8723
+ ) {
8724
+ this.handleMethodError('this-payment-method-cannot-be-used', method);
8725
+ return [2 /*return*/];
8726
+ }
8727
+ // Validación de crédito insuficiente (si no se puede exceder)
8728
+ if (isBalanceMethod &&
8729
+ balanceCustomer &&
8730
+ totals &&
8731
+ balanceCustomer.allowExceedBalance === false &&
8732
+ balanceCustomer.creditAmount < totals.total) {
8733
+ this.toastr.show('insufficient_credit');
8734
+ this.balanceMethodRejected = true;
8735
+ }
8736
+ else if (isBalanceMethod) {
8737
+ this.balanceMethodRejected = false;
8738
+ }
8704
8739
  this.methodDataSubject.next(method);
8705
8740
  return [2 /*return*/];
8706
8741
  }
@@ -8750,6 +8785,11 @@
8750
8785
  });
8751
8786
  this.ecOnInit();
8752
8787
  };
8788
+ PaymentEcComponent.prototype.handleMethodError = function (message, method) {
8789
+ this.showMethodError = true;
8790
+ this.toastr.show(message);
8791
+ this.methodDataSubject.next(method);
8792
+ };
8753
8793
  PaymentEcComponent.prototype.setActive = function (e) {
8754
8794
  var e_1, _a;
8755
8795
  var parent = e.target.parentElement.children;
@@ -8770,16 +8810,6 @@
8770
8810
  }
8771
8811
  e.target.classList.add("active");
8772
8812
  };
8773
- // si cuenta corriente tiene la configuración allowAnyPaymentMethod en false, no se debe permitir otros metodos de pago.
8774
- PaymentEcComponent.prototype.shouldDisplayMethod = function (method) {
8775
- if (!method)
8776
- return false;
8777
- if (this.allowAnyPaymentMethod === null)
8778
- return true;
8779
- if (this.allowAnyPaymentMethod)
8780
- return true;
8781
- return this.isBalanceInAccount(method.code);
8782
- };
8783
8813
  PaymentEcComponent.ctorParameters = function () { return [
8784
8814
  { type: core.Renderer2 },
8785
8815
  { type: ToastService },
@@ -8796,7 +8826,7 @@
8796
8826
  PaymentEcComponent = __decorate$S([
8797
8827
  core.Component({
8798
8828
  selector: 'app-payment-ec',
8799
- template: "<div class=\"container-fluid\" *ngIf=\"(paymentService.methods$ | async) as methods\">\r\n\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <div class=\"card \">\r\n <div class=\"card-header text-dark text-center\">\r\n <h4>{{ 'select-method' | translate }}</h4>\r\n <div class=\"btn-toolbar justify-content-center\" role=\"toolbar\" aria-label=\"Envios toolbar\">\r\n <div class=\"\" role=\"group\" aria-label=\"Grupo botones envio\">\r\n <div class=\"d-flex align-content-start justify-content-center flex-wrap\">\r\n <button type=\"button\" class=\"btn btn-outline-secondary mx-1 mb-1\"\r\n *ngFor=\"let method of methods; let x = index\"\r\n (click)=\"setMethod(method) ; setActive($event)\">\r\n {{ method.name | translate }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"card-body text-center\">\r\n <div class=\"row justify-content-center\" *ngIf=\"(method_data$ | async) as method\">\r\n <ng-container *ngIf=\"!loading_internal ; else loading\">\r\n <!-- cuenta corriente tiene una configuari\u00F3n de permitir o no otros metodos de pago -->\r\n <ng-container *ngIf=\"method && shouldDisplayMethod(method)\">\r\n <div class=\"method-container text-dark\" *ngIf=\"isMP(method.code)\">\r\n <p id=\"faqs\" class=\"qt px-5 \">{{ method.description }}</p>\r\n <p class=\"px-5\">{{ method.instructions }}</p>\r\n <app-mp-redirect-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [paymentServiceInst]=\"paymentService\"\r\n [allData]=\"allData()\"></app-mp-redirect-ec>\r\n </div>\r\n <div class=\"method-container text-dark text-left\"\r\n *ngIf=\"isMPTarjetaDeCredito(method.code)\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <p id=\"faqs\" class=\"qt px-5 \">{{ method.description }}</p>\r\n <p class=\"px-5\">{{ method.instructions }}</p>\r\n <div app-mp-credit-ec (ready)=\"verifyValidate()\"\r\n [public_key]=\"getPK(method)\" [user_data]=\"allData()\"\r\n [total_amount]=\"total_amount\">\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\"\r\n *ngIf=\"isRedirectRedsys(method.code)\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <ng-container\r\n *ngIf=\"!method.code.includes('bizum') && !method.code.includes('_out_')\">\r\n <app-redsys-redirect-ec (ready)=\"verifyValidate($event)\"\r\n [method]=\"method\" [user_data]=\"allData()\">\r\n </app-redsys-redirect-ec>\r\n </ng-container>\r\n <ng-container\r\n *ngIf=\"method.code.includes('bizum') || method.code.includes('_out_')\">\r\n <app-redsys-redirect-out-ec (ready)=\"verifyValidate($event)\"\r\n [method]=\"method\" [user_data]=\"allData()\">\r\n </app-redsys-redirect-out-ec>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\"\r\n *ngIf=\"isRedirectCecaBank(method.code)\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <app-ceca-redirect-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\">\r\n </app-ceca-redirect-ec>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isPeyPalExpress(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-paypal-express-ec (ready)=\"verifyValidate($event)\"\r\n [method]=\"method\" [user_data]=\"allData()\"\r\n [total_amount]=\"total_amount\">\r\n </app-paypal-express-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isMobbex(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-mobbex-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\">\r\n </app-mobbex-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isBancard(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-bancard-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\">\r\n </app-bancard-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isDecidir(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-decidir-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\">\r\n </app-decidir-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark\" *ngIf=\"isMethodOffline(method.code)\">\r\n <p id=\"faqs\" class=\"qt px-5\">{{ method.description }}</p>\r\n <p class=\"px-5\">{{ method.instructions }}</p>\r\n <div class=\"end-button\">\r\n <button class=\"btn comprar\" (click)=\"setLoading() && verifyValidate()\">{{\r\n ('pay-with-offline'| translate) }}</button>\r\n </div>\r\n <ng-container *ngIf=\"(loading$ | async) as load\">\r\n <div class=\"mt-2\" *ngIf=\"load\">\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isCulqi(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <!-- <app-mobbex-ec (ready)=\"verifyValidate($event)\" [method]=\"method\" [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\">\r\n </app-mobbex-ec> -->\r\n <app-culqi-ec [apiKey]=\"getPKCulqi(method)\" [method]=\"method\"\r\n [amount]=\"total_amount\" [customStyle]=\"true\"\r\n (ready)=\"verifyValidate()\"></app-culqi-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isCatastro(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-bancard-catastro-ec (ready)=\"verifyValidate($event)\"\r\n [method]=\"method\" [user_data]=\"allData()\"\r\n [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\"></app-bancard-catastro-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isBamboo(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-bamboo-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\"></app-bamboo-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark\" *ngIf=\"isBankTransfer(method.code)\">\r\n <div class=\"row px-0 description-cont\">\r\n <ng-container\r\n *ngFor=\"let line of method.description.split('\\r\\n'); let i=index\">\r\n <p [id]=\"'faqs-'+i\" [class]=\"'qt px-5 m-0 line-'+i\">{{ line }}</p>\r\n </ng-container>\r\n </div>\r\n <hr *ngIf=\"method.instructions\">\r\n <div *ngIf=\"method.instructions\" class=\"row px-0 instructions-cont mb-1\">\r\n <h5 class=\"instructions-title\">{{ ('instructions' | translate) }}</h5>\r\n <ng-container\r\n *ngFor=\"let line of method.instructions.split('\\r\\n'); let i=index\">\r\n <p [class]=\"'px-5 m-0 instructions-text line-'+i \">{{ line }}</p>\r\n </ng-container>\r\n </div>\r\n\r\n <div class=\"end-button\">\r\n <button class=\"btn comprar\" (click)=\"setLoading() && verifyValidate()\">{{\r\n ('pay-with-transfer'\r\n | translate) }}</button>\r\n </div>\r\n <ng-container *ngIf=\"(loading$ | async) as load\">\r\n <div class=\"mt-2\" *ngIf=\"load\">\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"method-container text-dark\" *ngIf=\"isPlaceToPay(method.code)\">\r\n <p id=\"faqs\" *ngIf=\"method.description\" class=\"qt px-5 \">{{ method.description }}\r\n </p>\r\n <p class=\"px-5\" *ngIf=\"method.instructions\">{{ method.instructions }}</p>\r\n <app-place-to-pay-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [paymentServiceInst]=\"paymentService\" [allData]=\"allData()\">\r\n </app-place-to-pay-ec>\r\n </div>\r\n </ng-container>\r\n <div class=\"method-container text-dark\" *ngIf=\"isBalanceInAccount(method.code)\">\r\n <div class=\"row px-0 description-cont\" *ngIf=\"method.description\">\r\n <ng-container *ngFor=\"let line of method.description.split('\\r\\n'); let i = index\">\r\n <p [id]=\"'cc-desc-'+i\" [class]=\"'qt px-5 m-0 line-'+i\">{{ line }}</p>\r\n </ng-container>\r\n </div>\r\n\r\n <hr *ngIf=\"method.instructions\">\r\n\r\n <div *ngIf=\"method.instructions\" class=\"row px-0 instructions-cont mb-1\">\r\n <h5 class=\"instructions-title\">{{ ('instructions' | translate) }}</h5>\r\n <ng-container *ngFor=\"let line of method.instructions.split('\\r\\n'); let i = index\">\r\n <p [class]=\"'px-5 m-0 instructions-text line-'+i \">{{ line }}</p>\r\n </ng-container>\r\n </div>\r\n\r\n <div class=\"end-button\">\r\n <button class=\"btn comprar\" (click)=\"setLoading() && verifyValidate()\">\r\n {{ 'pay-with' | translate }} {{ method.name }}\r\n </button>\r\n </div>\r\n <ng-container *ngIf=\"(loading$ | async) as load\">\r\n <div class=\"mt-2\" *ngIf=\"load\">\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #mercadoPago>\r\n <div class=\"row \">\r\n <div class=\"col-12 text-center\">\r\n <app-loading-inline-ec *ngIf=\"loading_internal_mp\"></app-loading-inline-ec>\r\n <form action=\"javascript:void(0)\" #formContainer></form>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #loading>\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n</ng-template>",
8829
+ template: "<div class=\"container-fluid\" *ngIf=\"(paymentService.methods$ | async) as methods\">\r\n\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <div class=\"card \">\r\n <div class=\"card-header text-dark text-center\">\r\n <h4>{{ 'select-method' | translate }}</h4>\r\n <div class=\"btn-toolbar justify-content-center\" role=\"toolbar\" aria-label=\"Envios toolbar\">\r\n <div class=\"\" role=\"group\" aria-label=\"Grupo botones envio\">\r\n <div class=\"d-flex align-content-start justify-content-center flex-wrap\">\r\n <button type=\"button\" class=\"btn btn-outline-secondary mx-1 mb-1\"\r\n *ngFor=\"let method of methods; let x = index\"\r\n (click)=\"setMethod(method) ; setActive($event)\">\r\n {{ method.name | translate }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"card-body text-center\">\r\n <div class=\"row justify-content-center\" *ngIf=\"(method_data$ | async) as method\">\r\n <ng-container *ngIf=\"!loading_internal ; else loading\">\r\n <!-- cuenta corriente tiene una configuari\u00F3n de permitir o no otros metodos de pago -->\r\n <ng-container *ngIf=\"method && !showMethodError\">\r\n <div class=\"method-container text-dark\" *ngIf=\"isMP(method.code)\">\r\n <p id=\"faqs\" class=\"qt px-5 \">{{ method.description }}</p>\r\n <p class=\"px-5\">{{ method.instructions }}</p>\r\n <app-mp-redirect-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [paymentServiceInst]=\"paymentService\"\r\n [allData]=\"allData()\"></app-mp-redirect-ec>\r\n </div>\r\n <div class=\"method-container text-dark text-left\"\r\n *ngIf=\"isMPTarjetaDeCredito(method.code)\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <p id=\"faqs\" class=\"qt px-5 \">{{ method.description }}</p>\r\n <p class=\"px-5\">{{ method.instructions }}</p>\r\n <div app-mp-credit-ec (ready)=\"verifyValidate()\"\r\n [public_key]=\"getPK(method)\" [user_data]=\"allData()\"\r\n [total_amount]=\"total_amount\">\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\"\r\n *ngIf=\"isRedirectRedsys(method.code)\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <ng-container\r\n *ngIf=\"!method.code.includes('bizum') && !method.code.includes('_out_')\">\r\n <app-redsys-redirect-ec (ready)=\"verifyValidate($event)\"\r\n [method]=\"method\" [user_data]=\"allData()\">\r\n </app-redsys-redirect-ec>\r\n </ng-container>\r\n <ng-container\r\n *ngIf=\"method.code.includes('bizum') || method.code.includes('_out_')\">\r\n <app-redsys-redirect-out-ec (ready)=\"verifyValidate($event)\"\r\n [method]=\"method\" [user_data]=\"allData()\">\r\n </app-redsys-redirect-out-ec>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\"\r\n *ngIf=\"isRedirectCecaBank(method.code)\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <app-ceca-redirect-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\">\r\n </app-ceca-redirect-ec>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isPeyPalExpress(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-paypal-express-ec (ready)=\"verifyValidate($event)\"\r\n [method]=\"method\" [user_data]=\"allData()\"\r\n [total_amount]=\"total_amount\">\r\n </app-paypal-express-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isMobbex(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-mobbex-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\">\r\n </app-mobbex-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isBancard(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-bancard-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\">\r\n </app-bancard-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isDecidir(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-decidir-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\">\r\n </app-decidir-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark\" *ngIf=\"isMethodOffline(method.code)\">\r\n <p id=\"faqs\" class=\"qt px-5\">{{ method.description }}</p>\r\n <p class=\"px-5\">{{ method.instructions }}</p>\r\n <div class=\"end-button\">\r\n <button class=\"btn comprar\" (click)=\"setLoading() && verifyValidate()\">{{\r\n ('pay-with-offline'| translate) }}</button>\r\n </div>\r\n <ng-container *ngIf=\"(loading$ | async) as load\">\r\n <div class=\"mt-2\" *ngIf=\"load\">\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isCulqi(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <!-- <app-mobbex-ec (ready)=\"verifyValidate($event)\" [method]=\"method\" [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\">\r\n </app-mobbex-ec> -->\r\n <app-culqi-ec [apiKey]=\"getPKCulqi(method)\" [method]=\"method\"\r\n [amount]=\"total_amount\" [customStyle]=\"true\"\r\n (ready)=\"verifyValidate()\"></app-culqi-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isCatastro(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-bancard-catastro-ec (ready)=\"verifyValidate($event)\"\r\n [method]=\"method\" [user_data]=\"allData()\"\r\n [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\"></app-bancard-catastro-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark text-start\" *ngIf=\"isBamboo(method.code)\">\r\n <div class=\"container\">\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12\">\r\n <app-bamboo-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [user_data]=\"allData()\" [paymentServiceInst]=\"paymentService\"\r\n [total_amount]=\"total_amount\"></app-bamboo-ec>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"method-container text-dark\" *ngIf=\"isBankTransfer(method.code)\">\r\n <div class=\"row px-0 description-cont\">\r\n <ng-container\r\n *ngFor=\"let line of method.description.split('\\r\\n'); let i=index\">\r\n <p [id]=\"'faqs-'+i\" [class]=\"'qt px-5 m-0 line-'+i\">{{ line }}</p>\r\n </ng-container>\r\n </div>\r\n <hr *ngIf=\"method.instructions\">\r\n <div *ngIf=\"method.instructions\" class=\"row px-0 instructions-cont mb-1\">\r\n <h5 class=\"instructions-title\">{{ ('instructions' | translate) }}</h5>\r\n <ng-container\r\n *ngFor=\"let line of method.instructions.split('\\r\\n'); let i=index\">\r\n <p [class]=\"'px-5 m-0 instructions-text line-'+i \">{{ line }}</p>\r\n </ng-container>\r\n </div>\r\n\r\n <div class=\"end-button\">\r\n <button class=\"btn comprar\" (click)=\"setLoading() && verifyValidate()\">{{\r\n ('pay-with-transfer'\r\n | translate) }}</button>\r\n </div>\r\n <ng-container *ngIf=\"(loading$ | async) as load\">\r\n <div class=\"mt-2\" *ngIf=\"load\">\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"method-container text-dark\" *ngIf=\"isPlaceToPay(method.code)\">\r\n <p id=\"faqs\" *ngIf=\"method.description\" class=\"qt px-5 \">{{ method.description }}\r\n </p>\r\n <p class=\"px-5\" *ngIf=\"method.instructions\">{{ method.instructions }}</p>\r\n <app-place-to-pay-ec (ready)=\"verifyValidate($event)\" [method]=\"method\"\r\n [paymentServiceInst]=\"paymentService\" [allData]=\"allData()\">\r\n </app-place-to-pay-ec>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"showMethodError\">\r\n <div class=\"text-danger mt-2 px-3 fw-bold\">\r\n {{ 'this-payment-method-cannot-be-used' | translate }}\r\n </div>\r\n </ng-container>\r\n <div class=\"method-container text-dark\"\r\n *ngIf=\"isBalanceInAccount(method.code) && !showMethodError\">\r\n <div class=\"row px-0 description-cont\" *ngIf=\"method.description\">\r\n <ng-container *ngFor=\"let line of method.description.split('\\r\\n'); let i = index\">\r\n <p [id]=\"'cc-desc-'+i\" [class]=\"'qt px-5 m-0 line-'+i\">{{ line }}</p>\r\n </ng-container>\r\n </div>\r\n\r\n <hr *ngIf=\"method.instructions\">\r\n\r\n <div *ngIf=\"method.instructions\" class=\"row px-0 instructions-cont mb-1\">\r\n <h5 class=\"instructions-title\">{{ ('instructions' | translate) }}</h5>\r\n <ng-container *ngFor=\"let line of method.instructions.split('\\r\\n'); let i = index\">\r\n <p [class]=\"'px-5 m-0 instructions-text line-'+i \">{{ line }}</p>\r\n </ng-container>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!balanceMethodRejected; else showCreditError\">\r\n <div class=\"end-button\">\r\n <button class=\"btn comprar\" (click)=\"setLoading() && verifyValidate()\">\r\n {{ 'pay-with' | translate }} {{ method.name }}\r\n </button>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-template #showCreditError>\r\n <div class=\"text-danger mt-2 px-3 fw-bold\">\r\n {{ 'not-enough-credits-to-complete' | translate }}\r\n </div>\r\n </ng-template>\r\n\r\n <ng-container *ngIf=\"(loading$ | async) as load\">\r\n <div class=\"mt-2\" *ngIf=\"load\">\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #mercadoPago>\r\n <div class=\"row \">\r\n <div class=\"col-12 text-center\">\r\n <app-loading-inline-ec *ngIf=\"loading_internal_mp\"></app-loading-inline-ec>\r\n <form action=\"javascript:void(0)\" #formContainer></form>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #loading>\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n</ng-template>",
8800
8830
  providers: [PaymentService],
8801
8831
  styles: ["div.col-12 form{text-align:center}.option-container>div{margin-bottom:15px}@media only screen and (min-width:600px){.option-container{display:flex;justify-content:space-between;margin-top:20px}}.method-container{width:100%}.active{background-color:#000!important;color:#fff!important}.comprar{background:#000;color:#fff;display:inline-block;font-size:18px;font-weight:600;padding:10px 25px;text-decoration:none;text-transform:uppercase}"]
8802
8832
  })
@@ -10460,6 +10490,7 @@
10460
10490
  this.product$ = this.productSubject.asObservable();
10461
10491
  this.options$ = this.optionsSubject.asObservable();
10462
10492
  this.asociatedData$ = this.asociatedDataSubject.asObservable();
10493
+ this.balanceCustomer = null;
10463
10494
  /**
10464
10495
  * @param code Identificador del producto
10465
10496
  * @param variant Indica si se está solicitando un producto por su codigo, o por el codigo correspondiente a una de sus variantes
@@ -10612,12 +10643,7 @@
10612
10643
  var asociated = {};
10613
10644
  if (_this.isReady()) {
10614
10645
  asociated.stock = _this.variants[0].stock;
10615
- if (_this.variants[0].priceWithoutTaxes) {
10616
- asociated.price = _this.variants[0].priceWithoutTaxes.toString();
10617
- }
10618
- else {
10619
- asociated.price = _this.variants[0].price.toString();
10620
- }
10646
+ asociated.price = _this.variants[0].price.toString();
10621
10647
  asociated.saleprice = _this.variants[0].saleprice && _this.variants[0].saleprice.toString() || undefined;
10622
10648
  asociated.discount = ((_a = _this.variants[0]) === null || _a === void 0 ? void 0 : _a.discount) || undefined;
10623
10649
  asociated.properties = _this.variants[0].properties ? _this.beautifyProperties(_this.variants[0].properties) : undefined;
@@ -10722,14 +10748,16 @@
10722
10748
  return true;
10723
10749
  };
10724
10750
  this.validatePriceAndCredits = function (price) {
10725
- if (_this.creditAmount === null) {
10726
- console.log('No hay configuración de créditos para este usuario.');
10751
+ if (_this.balanceCustomer === null) {
10727
10752
  return true;
10728
10753
  }
10729
- if (_this.remainingCredits === undefined) {
10754
+ if (_this.balanceCustomer.allowAnyPaymentMethod) {
10755
+ return true;
10756
+ }
10757
+ if (_this.balanceCustomer.remainingCredits === undefined) {
10730
10758
  return false;
10731
10759
  }
10732
- if (price > _this.remainingCredits) {
10760
+ if (price > _this.balanceCustomer.remainingCredits) {
10733
10761
  _this.toastrService.show('not-enough-credits');
10734
10762
  return false;
10735
10763
  }
@@ -10739,11 +10767,8 @@
10739
10767
  _this.cartService.getTotalAmount().subscribe(function (totalAmount) {
10740
10768
  _this.currentTotalAmount = totalAmount;
10741
10769
  });
10742
- _this.cartService.getCreditAmount().subscribe(function (creditAmount) {
10743
- _this.creditAmount = creditAmount;
10744
- });
10745
- _this.cartService.getRemainingCredits().subscribe(function (remainingCredits) {
10746
- _this.remainingCredits = remainingCredits;
10770
+ _this.cartService.balanceCustomer$.subscribe(function (balanceCustomer) {
10771
+ _this.balanceCustomer = balanceCustomer;
10747
10772
  });
10748
10773
  };
10749
10774
  // Cuando haya modelos de respuesta, validamos que no se intente cargar un producto incompleto