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.
@@ -4116,6 +4116,7 @@ if (false) {
4116
4116
  var GaliciaComponent = /** @class */ (function () {
4117
4117
  function GaliciaComponent(galiciaApiService) {
4118
4118
  this.galiciaApiService = galiciaApiService;
4119
+ this.discountRate = 0.10;
4119
4120
  this.statusPay = new EventEmitter();
4120
4121
  this.qrImage = '';
4121
4122
  this.billNumber = '';
@@ -4169,6 +4170,32 @@ var GaliciaComponent = /** @class */ (function () {
4169
4170
  _this.startPaymentValidation();
4170
4171
  }));
4171
4172
  };
4173
+ Object.defineProperty(GaliciaComponent.prototype, "subtotalAmount", {
4174
+ get: /**
4175
+ * @return {?}
4176
+ */
4177
+ function () {
4178
+ if (this.discountAmountValue !== undefined && this.discountAmountValue !== null) {
4179
+ return this.amount + this.discountAmountValue;
4180
+ }
4181
+ return this.amount ? Math.round(this.amount / (1 - this.discountRate)) : 0;
4182
+ },
4183
+ enumerable: true,
4184
+ configurable: true
4185
+ });
4186
+ Object.defineProperty(GaliciaComponent.prototype, "discountAmount", {
4187
+ get: /**
4188
+ * @return {?}
4189
+ */
4190
+ function () {
4191
+ if (this.discountAmountValue !== undefined && this.discountAmountValue !== null) {
4192
+ return this.discountAmountValue;
4193
+ }
4194
+ return this.subtotalAmount - (this.amount || 0);
4195
+ },
4196
+ enumerable: true,
4197
+ configurable: true
4198
+ });
4172
4199
  /**
4173
4200
  * @return {?}
4174
4201
  */
@@ -4223,7 +4250,7 @@ var GaliciaComponent = /** @class */ (function () {
4223
4250
  this.isLoading = false;
4224
4251
  this.hasError = true;
4225
4252
  this.statusPay.emit(this.paymentResult);
4226
- this.errorMessage = response.errorsMessages[0] || 'Ocurrió un error al generar el código QR.';
4253
+ this.errorMessage = response.errorsMessages[0] || 'No se pudo generar el código QR.';
4227
4254
  return;
4228
4255
  }
4229
4256
  /** @type {?} */
@@ -4244,7 +4271,7 @@ var GaliciaComponent = /** @class */ (function () {
4244
4271
  function (error) {
4245
4272
  this.isLoading = false;
4246
4273
  this.hasError = true;
4247
- this.errorMessage = error.errorsMessages[0] || 'Ocurrió un error al generar el código QR.';
4274
+ this.errorMessage = error.errorsMessages[0] || 'No se pudo generar el código QR.';
4248
4275
  this.paymentResult.success = false;
4249
4276
  this.statusPay.emit(this.paymentResult);
4250
4277
  };
@@ -4317,6 +4344,8 @@ var GaliciaComponent = /** @class */ (function () {
4317
4344
  if (!response.success) {
4318
4345
  this.isLoading = false;
4319
4346
  this.statusPay.emit(this.paymentResult);
4347
+ this.errorMessage = 'No fue posible validar el pago correctamente.';
4348
+ this.hasError = true;
4320
4349
  return;
4321
4350
  }
4322
4351
  if (response.data.isPaid) {
@@ -4345,6 +4374,7 @@ var GaliciaComponent = /** @class */ (function () {
4345
4374
  */
4346
4375
  function (error) {
4347
4376
  clearInterval(this.validationInterval);
4377
+ this.errorMessage = 'No fue posible validar el pago correctamente.';
4348
4378
  this.hasError = true;
4349
4379
  };
4350
4380
  /**
@@ -4356,6 +4386,7 @@ var GaliciaComponent = /** @class */ (function () {
4356
4386
  function () {
4357
4387
  this.showQr = true;
4358
4388
  this.expired = false;
4389
+ this.hasError = false;
4359
4390
  this.startTimer();
4360
4391
  this.startPaymentValidation();
4361
4392
  };
@@ -4374,8 +4405,8 @@ var GaliciaComponent = /** @class */ (function () {
4374
4405
  GaliciaComponent.decorators = [
4375
4406
  { type: Component, args: [{
4376
4407
  selector: 'lib-galicia',
4377
- 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>",
4378
- 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)}}"]
4408
+ 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>",
4409
+ 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)}}"]
4379
4410
  }] }
4380
4411
  ];
4381
4412
  /** @nocollapse */
@@ -4392,6 +4423,9 @@ var GaliciaComponent = /** @class */ (function () {
4392
4423
  storeName: [{ type: Input }],
4393
4424
  sessionId: [{ type: Input }],
4394
4425
  checkoutId: [{ type: Input }],
4426
+ amount: [{ type: Input }],
4427
+ discountRate: [{ type: Input }],
4428
+ discountAmountValue: [{ type: Input }],
4395
4429
  data: [{ type: Input }],
4396
4430
  statusPay: [{ type: Output }]
4397
4431
  };
@@ -4417,6 +4451,12 @@ if (false) {
4417
4451
  /** @type {?} */
4418
4452
  GaliciaComponent.prototype.checkoutId;
4419
4453
  /** @type {?} */
4454
+ GaliciaComponent.prototype.amount;
4455
+ /** @type {?} */
4456
+ GaliciaComponent.prototype.discountRate;
4457
+ /** @type {?} */
4458
+ GaliciaComponent.prototype.discountAmountValue;
4459
+ /** @type {?} */
4420
4460
  GaliciaComponent.prototype.data;
4421
4461
  /** @type {?} */
4422
4462
  GaliciaComponent.prototype.statusPay;