vk-payments 0.2.34 → 0.2.36

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.
@@ -4312,6 +4312,7 @@
4312
4312
  var GaliciaComponent = /** @class */ (function () {
4313
4313
  function GaliciaComponent(galiciaApiService) {
4314
4314
  this.galiciaApiService = galiciaApiService;
4315
+ this.discountRate = 0.10;
4315
4316
  this.statusPay = new core.EventEmitter();
4316
4317
  this.qrImage = '';
4317
4318
  this.billNumber = '';
@@ -4365,6 +4366,32 @@
4365
4366
  _this.startPaymentValidation();
4366
4367
  }));
4367
4368
  };
4369
+ Object.defineProperty(GaliciaComponent.prototype, "subtotalAmount", {
4370
+ get: /**
4371
+ * @return {?}
4372
+ */
4373
+ function () {
4374
+ if (this.discountAmountValue !== undefined && this.discountAmountValue !== null) {
4375
+ return this.amount + this.discountAmountValue;
4376
+ }
4377
+ return this.amount ? Math.round(this.amount / (1 - this.discountRate)) : 0;
4378
+ },
4379
+ enumerable: true,
4380
+ configurable: true
4381
+ });
4382
+ Object.defineProperty(GaliciaComponent.prototype, "discountAmount", {
4383
+ get: /**
4384
+ * @return {?}
4385
+ */
4386
+ function () {
4387
+ if (this.discountAmountValue !== undefined && this.discountAmountValue !== null) {
4388
+ return this.discountAmountValue;
4389
+ }
4390
+ return this.subtotalAmount - (this.amount || 0);
4391
+ },
4392
+ enumerable: true,
4393
+ configurable: true
4394
+ });
4368
4395
  /**
4369
4396
  * @return {?}
4370
4397
  */
@@ -4419,7 +4446,7 @@
4419
4446
  this.isLoading = false;
4420
4447
  this.hasError = true;
4421
4448
  this.statusPay.emit(this.paymentResult);
4422
- this.errorMessage = response.errorsMessages[0] || 'Ocurrió un error al generar el código QR.';
4449
+ this.errorMessage = response.errorsMessages[0] || 'No se pudo generar el código QR.';
4423
4450
  return;
4424
4451
  }
4425
4452
  /** @type {?} */
@@ -4440,7 +4467,7 @@
4440
4467
  function (error) {
4441
4468
  this.isLoading = false;
4442
4469
  this.hasError = true;
4443
- this.errorMessage = error.errorsMessages[0] || 'Ocurrió un error al generar el código QR.';
4470
+ this.errorMessage = error.errorsMessages[0] || 'No se pudo generar el código QR.';
4444
4471
  this.paymentResult.success = false;
4445
4472
  this.statusPay.emit(this.paymentResult);
4446
4473
  };
@@ -4513,6 +4540,8 @@
4513
4540
  if (!response.success) {
4514
4541
  this.isLoading = false;
4515
4542
  this.statusPay.emit(this.paymentResult);
4543
+ this.errorMessage = 'No fue posible validar el pago correctamente.';
4544
+ this.hasError = true;
4516
4545
  return;
4517
4546
  }
4518
4547
  if (response.data.isPaid) {
@@ -4541,6 +4570,7 @@
4541
4570
  */
4542
4571
  function (error) {
4543
4572
  clearInterval(this.validationInterval);
4573
+ this.errorMessage = 'No fue posible validar el pago correctamente.';
4544
4574
  this.hasError = true;
4545
4575
  };
4546
4576
  /**
@@ -4552,6 +4582,7 @@
4552
4582
  function () {
4553
4583
  this.showQr = true;
4554
4584
  this.expired = false;
4585
+ this.hasError = false;
4555
4586
  this.startTimer();
4556
4587
  this.startPaymentValidation();
4557
4588
  };
@@ -4570,8 +4601,8 @@
4570
4601
  GaliciaComponent.decorators = [
4571
4602
  { type: core.Component, args: [{
4572
4603
  selector: 'lib-galicia',
4573
- template: "<div class=\"gc-payment\">\n <div class=\"formRow\">\n <p>\n Escane\u00E1 el c\u00F3digo QR con tu aplicaci\u00F3n bancaria para realizar el pago.\n </p>\n </div>\n\n <div *ngIf=\"isGeneratingQr && !hasError\" class=\"loading-container\">\n <div class=\"spinner\"></div>\n <p>Generando c\u00F3digo QR...</p>\n </div>\n\n <div *ngIf=\"showQr\">\n <div class=\"qr-container\">\n <img [src]=\"qrImage\" alt=\"QR Galicia\" />\n </div>\n\n <div class=\"timer\">\n Tiempo restante: {{ minutes }}:{{ seconds < 10 ? '0' + seconds : seconds }} \n </div>\n </div>\n\n <div *ngIf=\"hasError\" class=\"payment-error\">\n <div class=\"error-icon\">\n \u26A0\n </div>\n\n <div class=\"error-message\">\n <h3>No fue posible generar el c\u00F3digo QR</h3>\n\n <p>{{ errorMessage }}</p>\n </div>\n </div>\n\n <div *ngIf=\"paymentCompleted\" class=\"payment-success\">\n <div class=\"success-icon\">\n \u2713\n </div>\n\n <div class=\"success-message\">\n <h3>Pago realizado correctamente</h3>\n\n <p>\n ID de pago Galicia: <strong>{{ paymentId }}</strong>\n </p>\n </div>\n </div>\n\n <div *ngIf=\"expired\">\n <div class=\"pay-message info\">\n El c\u00F3digo QR expir\u00F3.\n </div>\n\n <button type=\"button\" (click)=\"showQrAgain()\">\n Regenerar c\u00F3digo QR\n </button>\n\n </div>\n</div>",
4574
- styles: [".gc-payment{display:flex;flex-direction:column;align-items:center;text-align:center}.formRow{width:100%;max-width:400px;margin-bottom:20px}.loading-container{text-align:center;padding:30px}.spinner{width:40px;height:40px;margin:0 auto 15px;border:4px solid #e0e0e0;border-top:4px solid #06c;border-radius:50%;-webkit-animation:1s linear infinite spin;animation:1s linear infinite spin}.qr-container{margin:20px 0}.qr-container img{max-width:300px;width:100%;height:auto}.timer{margin-top:10px;font-size:18px;font-weight:600}.payment-error{text-align:center;padding:30px;max-width:400px}.error-icon{width:80px;height:80px;margin:0 auto 15px;border-radius:50%;background:#fc2626;color:#fff;font-size:48px;font-weight:700;display:flex;align-items:center;justify-content:center}.error-message h3{color:#fc2626;margin-bottom:10px}.payment-success{text-align:center;padding:30px}.success-icon{width:80px;height:80px;margin:0 auto 15px;border-radius:50%;background:#28a745;color:#fff;font-size:48px;font-weight:700;display:flex;align-items:center;justify-content:center}.success-message h3{color:#28a745;margin-bottom:10px}@-webkit-keyframes spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}"]
4604
+ template: "<div class=\"gc-payment\">\n\n <div class=\"summary-box\">\n <div class=\"summary-row\">\n <span class=\"summary-label\">Subtotal</span>\n <span class=\"summary-value\">${{ subtotalAmount | number:'1.2-2' }}</span>\n </div>\n <div class=\"summary-row discount\">\n <span class=\"summary-label\">\n <i class=\"material-icons\">local_offer</i>\n Descuento ({{ discountRate * 100 | number:'1.0-0' }}%)\n </span>\n <span class=\"summary-value discount-value\">-${{ discountAmount | number:'1.2-2' }}</span>\n </div>\n <div class=\"summary-row total\">\n <span class=\"summary-label\">Total a abonar</span>\n <span class=\"summary-value total-value\">\n ${{ amount | number:'1.2-2' }} \n </span>\n </div>\n </div>\n\n <div class=\"formRow\">\n <p>\n Escane\u00E1 el c\u00F3digo QR con tu aplicaci\u00F3n bancaria para realizar el pago.\n </p>\n </div>\n\n <div *ngIf=\"isGeneratingQr && !hasError\" class=\"loading-container\">\n <div class=\"spinner\"></div>\n <p>Generando c\u00F3digo QR...</p>\n </div>\n\n <div *ngIf=\"showQr && !hasError\">\n <div class=\"qr-container\">\n <img [src]=\"qrImage\" alt=\"QR Galicia\" />\n </div>\n\n <div class=\"timer\">\n Tiempo restante: {{ minutes }}:{{ seconds < 10 ? '0' + seconds : seconds }} \n </div>\n </div>\n\n <div *ngIf=\"hasError\" class=\"payment-error\">\n <div class=\"error-icon\">\n \u26A0\n </div>\n\n <div class=\"error-message\">\n <h3>Ocurri\u00F3 un error:</h3>\n\n <p>{{ errorMessage }}</p>\n </div>\n </div>\n\n <div *ngIf=\"paymentCompleted\" class=\"payment-success\">\n <div class=\"success-icon\">\n \u2713\n </div>\n\n <div class=\"success-message\">\n <h3>Pago realizado correctamente</h3>\n\n <p>\n ID de pago Galicia: <strong>{{ paymentId }}</strong>\n </p>\n </div>\n </div>\n\n <div *ngIf=\"expired && !hasError\">\n <div class=\"pay-message info\">\n El c\u00F3digo QR expir\u00F3.\n </div>\n\n <button class=\"regen-button\" type=\"button\" (click)=\"showQrAgain()\">\n Regenerar c\u00F3digo QR\n </button>\n\n </div>\n</div>",
4605
+ styles: [".gc-payment{display:flex;flex-direction:column;align-items:center;text-align:center}.formRow{width:100%;max-width:400px;margin-bottom:20px}.loading-container{text-align:center;padding:30px}.spinner{width:40px;height:40px;margin:0 auto 15px;border:4px solid #e0e0e0;border-top:4px solid #06c;border-radius:50%;-webkit-animation:1s linear infinite spin;animation:1s linear infinite spin}.qr-container{margin:20px 0}.qr-container img{max-width:300px;width:100%;height:auto}.timer{margin-top:10px;font-size:18px;font-weight:600}.payment-error{text-align:center;padding:30px;max-width:400px}.error-icon{width:80px;height:80px;margin:0 auto 15px;border-radius:50%;background:#fc2626;color:#fff;font-size:48px;font-weight:700;display:flex;align-items:center;justify-content:center}.error-message h3{color:#fc2626;margin-bottom:10px}.payment-success{text-align:center;padding:30px}.success-icon{width:80px;height:80px;margin:0 auto 15px;border-radius:50%;background:#28a745;color:#fff;font-size:48px;font-weight:700;display:flex;align-items:center;justify-content:center}.success-message h3{color:#28a745;margin-bottom:10px}.summary-box{margin:20px 0;border:1px solid #e0e0e0;border-radius:8px;overflow:hidden;width:100%;min-width:250px;max-width:400px}.summary-box .summary-row{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;font-size:16px;background-color:#fff;border-bottom:1px solid #f0f0f0}.summary-box .summary-row:last-child{border-bottom:none}.summary-box .summary-row .summary-label{display:flex;align-items:center;gap:6px;color:#555}.summary-box .summary-row .summary-label i.material-icons{font-size:14px}.summary-box .summary-row .summary-value{font-weight:600;color:#1a1a1a;display:flex;align-items:center;margin-left:45px;gap:6px}.summary-box .summary-row.discount{background-color:#f0fdf4}.summary-box .summary-row.discount .summary-label{color:#16a34a;font-weight:500}.summary-box .summary-row.discount .summary-label i.material-icons{color:#16a34a}.summary-box .summary-row.discount .discount-value{color:#16a34a;font-weight:700}.summary-box .summary-row.total{background-color:#f8f9fa;border-top:2px solid #009ee3}.summary-box .summary-row.total .summary-label{font-size:17px;font-weight:700;color:#1a1a1a}.summary-box .summary-row.total .total-value{font-size:20px;font-weight:800;color:#009ee3}.regen-button{background-color:#009ee3;color:#fff;font-size:18px;text-align:center;padding:10px 0;width:100%;border:none;border-radius:20px;margin-top:20px;min-width:250px;max-width:400px;cursor:pointer}@-webkit-keyframes spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}"]
4575
4606
  }] }
4576
4607
  ];
4577
4608
  /** @nocollapse */
@@ -4588,6 +4619,9 @@
4588
4619
  storeName: [{ type: core.Input }],
4589
4620
  sessionId: [{ type: core.Input }],
4590
4621
  checkoutId: [{ type: core.Input }],
4622
+ amount: [{ type: core.Input }],
4623
+ discountRate: [{ type: core.Input }],
4624
+ discountAmountValue: [{ type: core.Input }],
4591
4625
  data: [{ type: core.Input }],
4592
4626
  statusPay: [{ type: core.Output }]
4593
4627
  };
@@ -4613,6 +4647,12 @@
4613
4647
  /** @type {?} */
4614
4648
  GaliciaComponent.prototype.checkoutId;
4615
4649
  /** @type {?} */
4650
+ GaliciaComponent.prototype.amount;
4651
+ /** @type {?} */
4652
+ GaliciaComponent.prototype.discountRate;
4653
+ /** @type {?} */
4654
+ GaliciaComponent.prototype.discountAmountValue;
4655
+ /** @type {?} */
4616
4656
  GaliciaComponent.prototype.data;
4617
4657
  /** @type {?} */
4618
4658
  GaliciaComponent.prototype.statusPay;