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.
@@ -3601,7 +3601,10 @@ var CheckoutService = /** @class */ (function () {
3601
3601
  return [4 /*yield*/, this.completeOrder()];
3602
3602
  case 1:
3603
3603
  result = _a.sent();
3604
- if (result && result.error) {
3604
+ if (!result ||
3605
+ result.error ||
3606
+ result.code === 'insufficient_credit' ||
3607
+ result.code === 'error') {
3605
3608
  this.cartService.changeHaveToUpdate(false);
3606
3609
  this.loadingSubject.next(false);
3607
3610
  return [2 /*return*/, ({ ok: false, require_login: true, message: 'not-completed' })];
@@ -4774,8 +4777,9 @@ var CartService = /** @class */ (function () {
4774
4777
  };
4775
4778
  this.updateCartObj = function (cart, emitEvent) {
4776
4779
  if (emitEvent === void 0) { emitEvent = true; }
4780
+ var _a, _b, _c;
4777
4781
  _this.cartSubject.next(cart);
4778
- _this.updateBalanceAttributes(cart);
4782
+ _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);
4779
4783
  emitEvent && _this.analyticsService.callEvent('add_to_cart', cart);
4780
4784
  _this.promotionsSubject.next(_this.orderUtils.getPromotions(cart, true));
4781
4785
  cart.couponCode
@@ -4910,6 +4914,9 @@ var CartService = /** @class */ (function () {
4910
4914
  if (!balance || balance.creditAmount === null || balance.creditAmount === undefined) {
4911
4915
  return true;
4912
4916
  }
4917
+ if (balance.allowAnyPaymentMethod) {
4918
+ return true;
4919
+ }
4913
4920
  if (balance.remainingCredits === undefined) {
4914
4921
  return false;
4915
4922
  }
@@ -5187,21 +5194,21 @@ var CartService = /** @class */ (function () {
5187
5194
  return subtotal - total;
5188
5195
  }));
5189
5196
  };
5190
- CartService$1.prototype.updateBalanceAttributes = function (cartData) {
5191
- var _a, _b, _c;
5192
- var balance = (_a = cartData) === null || _a === void 0 ? void 0 : _a.balanceCustomer;
5197
+ CartService$1.prototype.updateBalanceAttributes = function (balance, total) {
5198
+ if (total === void 0) { total = null; }
5193
5199
  if (!balance) {
5194
5200
  this.balanceCustomerSubject.next(null);
5195
5201
  return;
5196
5202
  }
5203
+ var totalAmount = (total !== null && total !== void 0 ? total : 0);
5197
5204
  var balanceData = {
5198
5205
  allowAnyPaymentMethod: balance.allowAnyPaymentMethod,
5199
5206
  allowExceedBalance: balance.allowExceedBalance,
5200
5207
  creditAmount: balance.creditAmount,
5201
5208
  showMax: balance.showMax,
5202
5209
  showPrice: balance.showPrice,
5203
- 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
5204
- ? balance.creditAmount - cartData.totals.total
5210
+ remainingCredits: balance.creditAmount != null && totalAmount != null && balance.creditAmount >= totalAmount
5211
+ ? balance.creditAmount - totalAmount
5205
5212
  : 0,
5206
5213
  applyMaxOrders: balance.applyMaxOrders,
5207
5214
  maxOrders: balance.maxOrders
@@ -8684,6 +8691,8 @@ var PaymentEcComponent = /** @class */ (function (_super) {
8684
8691
  _this.method_data$ = _this.methodDataSubject.asObservable();
8685
8692
  _this.loading$ = _this.loadingSubject.asObservable();
8686
8693
  _this.allowAnyPaymentMethod = null;
8694
+ _this.balanceMethodRejected = false;
8695
+ _this.showMethodError = false;
8687
8696
  _this.allData = function () { return (__assign$k(__assign$k({}, _this.paymentService.getUserData().shippingAddress), _this.paymentService.getShipmentData())); };
8688
8697
  _this.setError = function (message) {
8689
8698
  _this.error = message;
@@ -8707,14 +8716,40 @@ var PaymentEcComponent = /** @class */ (function (_super) {
8707
8716
  setTimeout(function (r) { return _this.emitResult(); }, 1000);
8708
8717
  };
8709
8718
  _this.setMethod = function (method) { return __awaiter$b(_this, void 0, void 0, function () {
8710
- var result;
8711
- return __generator$b(this, function (_a) {
8712
- switch (_a.label) {
8719
+ var result, balanceCustomer, totals, isBalanceMethod, allowAny;
8720
+ var _a, _b, _c, _d;
8721
+ return __generator$b(this, function (_e) {
8722
+ switch (_e.label) {
8713
8723
  case 0:
8714
8724
  this.methodDataSubject.next(null);
8725
+ this.showMethodError = false;
8715
8726
  return [4 /*yield*/, this.paymentService.putPayment(method.code)];
8716
8727
  case 1:
8717
- result = _a.sent();
8728
+ result = _e.sent();
8729
+ balanceCustomer = (_a = result) === null || _a === void 0 ? void 0 : _a.balanceCustomer;
8730
+ totals = (_b = result) === null || _b === void 0 ? void 0 : _b.totals;
8731
+ this.cartService.updateBalanceAttributes(balanceCustomer, (_c = totals) === null || _c === void 0 ? void 0 : _c.total);
8732
+ isBalanceMethod = this.isBalanceInAccount(method.code);
8733
+ allowAny = (_d = balanceCustomer) === null || _d === void 0 ? void 0 : _d.allowAnyPaymentMethod;
8734
+ // Validaciones de error
8735
+ if ((balanceCustomer && allowAny === false && !isBalanceMethod) || // no permite otro método
8736
+ (isBalanceMethod && !balanceCustomer) // seleccionó cuenta corriente pero no hay balance
8737
+ ) {
8738
+ this.handleMethodError('this-payment-method-cannot-be-used', method);
8739
+ return [2 /*return*/];
8740
+ }
8741
+ // Validación de crédito insuficiente (si no se puede exceder)
8742
+ if (isBalanceMethod &&
8743
+ balanceCustomer &&
8744
+ totals &&
8745
+ balanceCustomer.allowExceedBalance === false &&
8746
+ balanceCustomer.creditAmount < totals.total) {
8747
+ this.toastr.show('insufficient_credit');
8748
+ this.balanceMethodRejected = true;
8749
+ }
8750
+ else if (isBalanceMethod) {
8751
+ this.balanceMethodRejected = false;
8752
+ }
8718
8753
  this.methodDataSubject.next(method);
8719
8754
  return [2 /*return*/];
8720
8755
  }
@@ -8764,6 +8799,11 @@ var PaymentEcComponent = /** @class */ (function (_super) {
8764
8799
  });
8765
8800
  this.ecOnInit();
8766
8801
  };
8802
+ PaymentEcComponent.prototype.handleMethodError = function (message, method) {
8803
+ this.showMethodError = true;
8804
+ this.toastr.show(message);
8805
+ this.methodDataSubject.next(method);
8806
+ };
8767
8807
  PaymentEcComponent.prototype.setActive = function (e) {
8768
8808
  var e_1, _a;
8769
8809
  var parent = e.target.parentElement.children;
@@ -8784,16 +8824,6 @@ var PaymentEcComponent = /** @class */ (function (_super) {
8784
8824
  }
8785
8825
  e.target.classList.add("active");
8786
8826
  };
8787
- // si cuenta corriente tiene la configuración allowAnyPaymentMethod en false, no se debe permitir otros metodos de pago.
8788
- PaymentEcComponent.prototype.shouldDisplayMethod = function (method) {
8789
- if (!method)
8790
- return false;
8791
- if (this.allowAnyPaymentMethod === null)
8792
- return true;
8793
- if (this.allowAnyPaymentMethod)
8794
- return true;
8795
- return this.isBalanceInAccount(method.code);
8796
- };
8797
8827
  PaymentEcComponent.ctorParameters = function () { return [
8798
8828
  { type: Renderer2 },
8799
8829
  { type: ToastService },
@@ -8810,7 +8840,7 @@ var PaymentEcComponent = /** @class */ (function (_super) {
8810
8840
  PaymentEcComponent = __decorate$S([
8811
8841
  Component({
8812
8842
  selector: 'app-payment-ec',
8813
- 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>",
8843
+ 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>",
8814
8844
  providers: [PaymentService],
8815
8845
  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}"]
8816
8846
  })
@@ -10474,6 +10504,7 @@ var ProductDetailService = /** @class */ (function () {
10474
10504
  this.product$ = this.productSubject.asObservable();
10475
10505
  this.options$ = this.optionsSubject.asObservable();
10476
10506
  this.asociatedData$ = this.asociatedDataSubject.asObservable();
10507
+ this.balanceCustomer = null;
10477
10508
  /**
10478
10509
  * @param code Identificador del producto
10479
10510
  * @param variant Indica si se está solicitando un producto por su codigo, o por el codigo correspondiente a una de sus variantes
@@ -10626,12 +10657,7 @@ var ProductDetailService = /** @class */ (function () {
10626
10657
  var asociated = {};
10627
10658
  if (_this.isReady()) {
10628
10659
  asociated.stock = _this.variants[0].stock;
10629
- if (_this.variants[0].priceWithoutTaxes) {
10630
- asociated.price = _this.variants[0].priceWithoutTaxes.toString();
10631
- }
10632
- else {
10633
- asociated.price = _this.variants[0].price.toString();
10634
- }
10660
+ asociated.price = _this.variants[0].price.toString();
10635
10661
  asociated.saleprice = _this.variants[0].saleprice && _this.variants[0].saleprice.toString() || undefined;
10636
10662
  asociated.discount = ((_a = _this.variants[0]) === null || _a === void 0 ? void 0 : _a.discount) || undefined;
10637
10663
  asociated.properties = _this.variants[0].properties ? _this.beautifyProperties(_this.variants[0].properties) : undefined;
@@ -10736,14 +10762,16 @@ var ProductDetailService = /** @class */ (function () {
10736
10762
  return true;
10737
10763
  };
10738
10764
  this.validatePriceAndCredits = function (price) {
10739
- if (_this.creditAmount === null) {
10740
- console.log('No hay configuración de créditos para este usuario.');
10765
+ if (_this.balanceCustomer === null) {
10741
10766
  return true;
10742
10767
  }
10743
- if (_this.remainingCredits === undefined) {
10768
+ if (_this.balanceCustomer.allowAnyPaymentMethod) {
10769
+ return true;
10770
+ }
10771
+ if (_this.balanceCustomer.remainingCredits === undefined) {
10744
10772
  return false;
10745
10773
  }
10746
- if (price > _this.remainingCredits) {
10774
+ if (price > _this.balanceCustomer.remainingCredits) {
10747
10775
  _this.toastrService.show('not-enough-credits');
10748
10776
  return false;
10749
10777
  }
@@ -10753,11 +10781,8 @@ var ProductDetailService = /** @class */ (function () {
10753
10781
  _this.cartService.getTotalAmount().subscribe(function (totalAmount) {
10754
10782
  _this.currentTotalAmount = totalAmount;
10755
10783
  });
10756
- _this.cartService.getCreditAmount().subscribe(function (creditAmount) {
10757
- _this.creditAmount = creditAmount;
10758
- });
10759
- _this.cartService.getRemainingCredits().subscribe(function (remainingCredits) {
10760
- _this.remainingCredits = remainingCredits;
10784
+ _this.cartService.balanceCustomer$.subscribe(function (balanceCustomer) {
10785
+ _this.balanceCustomer = balanceCustomer;
10761
10786
  });
10762
10787
  };
10763
10788
  // Cuando haya modelos de respuesta, validamos que no se intente cargar un producto incompleto