vk-payments 0.2.31 → 0.2.33

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/router'), require('@angular/common/http'), require('sha256')) :
3
- typeof define === 'function' && define.amd ? define('vk-payments', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/router', '@angular/common/http', 'sha256'], factory) :
4
- (global = global || self, factory(global['vk-payments'] = {}, global.ng.core, global.ng.common, global.ng.forms, global.ng.router, global.ng.common.http, global.sha256));
5
- }(this, function (exports, core, common, forms, router, http, sha256) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/router'), require('@angular/common/http'), require('sha256'), require('qrcode')) :
3
+ typeof define === 'function' && define.amd ? define('vk-payments', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/router', '@angular/common/http', 'sha256', 'qrcode'], factory) :
4
+ (global = global || self, factory(global['vk-payments'] = {}, global.ng.core, global.ng.common, global.ng.forms, global.ng.router, global.ng.common.http, global.sha256, global.qrcode));
5
+ }(this, function (exports, core, common, forms, router, http, sha256, qrcode) { 'use strict';
6
6
 
7
7
  sha256 = sha256 && sha256.hasOwnProperty('default') ? sha256['default'] : sha256;
8
8
 
@@ -4222,6 +4222,476 @@
4222
4222
  return BankTransferModule;
4223
4223
  }());
4224
4224
 
4225
+ /**
4226
+ * @fileoverview added by tsickle
4227
+ * Generated from: lib/galicia/services/galicia.api.service.ts
4228
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4229
+ */
4230
+ var GaliciaApiService = /** @class */ (function () {
4231
+ function GaliciaApiService(httpClient) {
4232
+ this.httpClient = httpClient;
4233
+ }
4234
+ /**
4235
+ * @param {?} url
4236
+ * @return {?}
4237
+ */
4238
+ GaliciaApiService.prototype.normalizeUrl = /**
4239
+ * @param {?} url
4240
+ * @return {?}
4241
+ */
4242
+ function (url) {
4243
+ if (url.length > 0 && url.charAt(url.length - 1) == '/') {
4244
+ url = url.substr(0, url.length - 1);
4245
+ }
4246
+ return url;
4247
+ };
4248
+ /**
4249
+ * @param {?} url
4250
+ * @param {?} initPayment
4251
+ * @return {?}
4252
+ */
4253
+ GaliciaApiService.prototype.initPayment = /**
4254
+ * @param {?} url
4255
+ * @param {?} initPayment
4256
+ * @return {?}
4257
+ */
4258
+ function (url, initPayment) {
4259
+ /** @type {?} */
4260
+ var body = {
4261
+ storeId: initPayment.storeId,
4262
+ userId: initPayment.userId,
4263
+ sessionId: initPayment.sessionId,
4264
+ storeName: initPayment.storeName,
4265
+ checkoutId: initPayment.checkoutId
4266
+ };
4267
+ return this.httpClient.post(this.normalizeUrl(url) + '/init-payment', body);
4268
+ };
4269
+ /**
4270
+ * @param {?} url
4271
+ * @param {?} billNumber
4272
+ * @return {?}
4273
+ */
4274
+ GaliciaApiService.prototype.paymentStatus = /**
4275
+ * @param {?} url
4276
+ * @param {?} billNumber
4277
+ * @return {?}
4278
+ */
4279
+ function (url, billNumber) {
4280
+ return this.httpClient.get(this.normalizeUrl(url) + '/payment-status?billNumber=' + billNumber);
4281
+ };
4282
+ GaliciaApiService.decorators = [
4283
+ { type: core.Injectable, args: [{
4284
+ providedIn: 'root'
4285
+ },] }
4286
+ ];
4287
+ /** @nocollapse */
4288
+ GaliciaApiService.ctorParameters = function () { return [
4289
+ { type: http.HttpClient }
4290
+ ]; };
4291
+ /** @nocollapse */ GaliciaApiService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function GaliciaApiService_Factory() { return new GaliciaApiService(core.ɵɵinject(http.HttpClient)); }, token: GaliciaApiService, providedIn: "root" });
4292
+ return GaliciaApiService;
4293
+ }());
4294
+ if (false) {
4295
+ /**
4296
+ * @type {?}
4297
+ * @private
4298
+ */
4299
+ GaliciaApiService.prototype.authHeaders;
4300
+ /**
4301
+ * @type {?}
4302
+ * @private
4303
+ */
4304
+ GaliciaApiService.prototype.httpClient;
4305
+ }
4306
+
4307
+ /**
4308
+ * @fileoverview added by tsickle
4309
+ * Generated from: lib/galicia/components/galicia.component.ts
4310
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4311
+ */
4312
+ var GaliciaComponent = /** @class */ (function () {
4313
+ function GaliciaComponent(galiciaApiService) {
4314
+ this.galiciaApiService = galiciaApiService;
4315
+ this.statusPay = new core.EventEmitter();
4316
+ this.qrImage = '';
4317
+ this.billNumber = '';
4318
+ this.errorMessage = '';
4319
+ this.isGeneratingQr = true;
4320
+ this.paymentCompleted = false;
4321
+ this.paymentId = '';
4322
+ this.showQr = false;
4323
+ this.expired = false;
4324
+ this.isLoading = false;
4325
+ this.hasError = false;
4326
+ this.minutes = 0;
4327
+ this.seconds = 0;
4328
+ this.paymentResult = { success: false, paymentId: '', integrator: 'GALICIA' };
4329
+ }
4330
+ /**
4331
+ * @return {?}
4332
+ */
4333
+ GaliciaComponent.prototype.ngOnInit = /**
4334
+ * @return {?}
4335
+ */
4336
+ function () {
4337
+ this.createInitPayment();
4338
+ };
4339
+ /**
4340
+ * @param {?} datos
4341
+ * @return {?}
4342
+ */
4343
+ GaliciaComponent.prototype.generateQr = /**
4344
+ * @param {?} datos
4345
+ * @return {?}
4346
+ */
4347
+ function (datos) {
4348
+ var _this = this;
4349
+ /** @type {?} */
4350
+ var decoded = atob(datos);
4351
+ qrcode.toDataURL(decoded, {
4352
+ width: 300,
4353
+ margin: 2
4354
+ })
4355
+ .then((/**
4356
+ * @param {?} url
4357
+ * @return {?}
4358
+ */
4359
+ function (url) {
4360
+ _this.qrImage = url;
4361
+ _this.isGeneratingQr = false;
4362
+ _this.showQr = true;
4363
+ _this.expired = false;
4364
+ _this.startTimer();
4365
+ _this.startPaymentValidation();
4366
+ }));
4367
+ };
4368
+ /**
4369
+ * @return {?}
4370
+ */
4371
+ GaliciaComponent.prototype.createInitPayment = /**
4372
+ * @return {?}
4373
+ */
4374
+ function () {
4375
+ this.OinitPayment = {
4376
+ sessionId: '',
4377
+ userId: this.userId,
4378
+ storeId: this.storeId,
4379
+ storeName: this.storeName,
4380
+ checkoutId: this.checkoutId
4381
+ };
4382
+ this.initPayment();
4383
+ };
4384
+ /**
4385
+ * @return {?}
4386
+ */
4387
+ GaliciaComponent.prototype.initPayment = /**
4388
+ * @return {?}
4389
+ */
4390
+ function () {
4391
+ var _this = this;
4392
+ this.isGeneratingQr = true;
4393
+ this.galiciaApiService.initPayment(this.vkUrlApi, this.OinitPayment)
4394
+ .subscribe({
4395
+ next: (/**
4396
+ * @param {?} v
4397
+ * @return {?}
4398
+ */
4399
+ function (v) { return _this.initPaymentResponseHandler(v); }),
4400
+ error: (/**
4401
+ * @param {?} v
4402
+ * @return {?}
4403
+ */
4404
+ function (v) { return _this.initPaymentErrorHandler(v); })
4405
+ });
4406
+ };
4407
+ /**
4408
+ * @private
4409
+ * @param {?} response
4410
+ * @return {?}
4411
+ */
4412
+ GaliciaComponent.prototype.initPaymentResponseHandler = /**
4413
+ * @private
4414
+ * @param {?} response
4415
+ * @return {?}
4416
+ */
4417
+ function (response) {
4418
+ if (!response.success) {
4419
+ this.isLoading = false;
4420
+ this.hasError = true;
4421
+ this.statusPay.emit(this.paymentResult);
4422
+ this.errorMessage = response.errorsMessages[0] || 'Ocurrió un error al generar el código QR.';
4423
+ return;
4424
+ }
4425
+ /** @type {?} */
4426
+ var qrData = response.data.bills[0].qr.datos;
4427
+ this.billNumber = response.data.bills[0].nroBoleta;
4428
+ this.generateQr(qrData);
4429
+ };
4430
+ /**
4431
+ * @private
4432
+ * @param {?} error
4433
+ * @return {?}
4434
+ */
4435
+ GaliciaComponent.prototype.initPaymentErrorHandler = /**
4436
+ * @private
4437
+ * @param {?} error
4438
+ * @return {?}
4439
+ */
4440
+ function (error) {
4441
+ this.isLoading = false;
4442
+ this.hasError = true;
4443
+ this.errorMessage = error.errorsMessages[0] || 'Ocurrió un error al generar el código QR.';
4444
+ this.paymentResult.success = false;
4445
+ this.statusPay.emit(this.paymentResult);
4446
+ };
4447
+ /**
4448
+ * @return {?}
4449
+ */
4450
+ GaliciaComponent.prototype.startTimer = /**
4451
+ * @return {?}
4452
+ */
4453
+ function () {
4454
+ var _this = this;
4455
+ clearInterval(this.interval);
4456
+ this.minutes = 1;
4457
+ this.seconds = 0;
4458
+ this.interval = setInterval((/**
4459
+ * @return {?}
4460
+ */
4461
+ function () {
4462
+ if (_this.seconds === 0) {
4463
+ if (_this.minutes === 0) {
4464
+ _this.stopValidation();
4465
+ _this.showQr = false;
4466
+ _this.expired = true;
4467
+ return;
4468
+ }
4469
+ _this.minutes--;
4470
+ _this.seconds = 59;
4471
+ }
4472
+ else {
4473
+ _this.seconds--;
4474
+ }
4475
+ }), 1000);
4476
+ };
4477
+ /**
4478
+ * @return {?}
4479
+ */
4480
+ GaliciaComponent.prototype.startPaymentValidation = /**
4481
+ * @return {?}
4482
+ */
4483
+ function () {
4484
+ var _this = this;
4485
+ this.validationInterval = setInterval((/**
4486
+ * @return {?}
4487
+ */
4488
+ function () {
4489
+ _this.galiciaApiService.paymentStatus(_this.vkUrlApi, _this.billNumber)
4490
+ .subscribe({
4491
+ next: (/**
4492
+ * @param {?} v
4493
+ * @return {?}
4494
+ */
4495
+ function (v) { return _this.paymentStatusResponseHandler(v); }),
4496
+ error: (/**
4497
+ * @param {?} v
4498
+ * @return {?}
4499
+ */
4500
+ function (v) { return _this.paymentStatusErrorHandler(v); })
4501
+ });
4502
+ }), 5000);
4503
+ };
4504
+ /**
4505
+ * @param {?} response
4506
+ * @return {?}
4507
+ */
4508
+ GaliciaComponent.prototype.paymentStatusResponseHandler = /**
4509
+ * @param {?} response
4510
+ * @return {?}
4511
+ */
4512
+ function (response) {
4513
+ if (!response.success) {
4514
+ this.isLoading = false;
4515
+ this.statusPay.emit(this.paymentResult);
4516
+ return;
4517
+ }
4518
+ if (response.data.isPaid) {
4519
+ this.stopValidation();
4520
+ this.showQr = false;
4521
+ this.expired = false;
4522
+ this.paymentCompleted = true;
4523
+ this.paymentId = response.data.paymentId;
4524
+ this.paymentResult = {
4525
+ success: true,
4526
+ paymentId: this.paymentId,
4527
+ integrator: 'GALICIA'
4528
+ };
4529
+ this.statusPay.emit(this.paymentResult);
4530
+ }
4531
+ };
4532
+ /**
4533
+ * @private
4534
+ * @param {?} error
4535
+ * @return {?}
4536
+ */
4537
+ GaliciaComponent.prototype.paymentStatusErrorHandler = /**
4538
+ * @private
4539
+ * @param {?} error
4540
+ * @return {?}
4541
+ */
4542
+ function (error) {
4543
+ clearInterval(this.validationInterval);
4544
+ this.hasError = true;
4545
+ };
4546
+ /**
4547
+ * @return {?}
4548
+ */
4549
+ GaliciaComponent.prototype.showQrAgain = /**
4550
+ * @return {?}
4551
+ */
4552
+ function () {
4553
+ this.showQr = true;
4554
+ this.expired = false;
4555
+ this.startTimer();
4556
+ this.startPaymentValidation();
4557
+ };
4558
+ /**
4559
+ * @private
4560
+ * @return {?}
4561
+ */
4562
+ GaliciaComponent.prototype.stopValidation = /**
4563
+ * @private
4564
+ * @return {?}
4565
+ */
4566
+ function () {
4567
+ clearInterval(this.validationInterval);
4568
+ clearInterval(this.interval);
4569
+ };
4570
+ GaliciaComponent.decorators = [
4571
+ { type: core.Component, args: [{
4572
+ 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)}}"]
4575
+ }] }
4576
+ ];
4577
+ /** @nocollapse */
4578
+ GaliciaComponent.ctorParameters = function () { return [
4579
+ { type: GaliciaApiService }
4580
+ ]; };
4581
+ GaliciaComponent.propDecorators = {
4582
+ accessToken: [{ type: core.Input }],
4583
+ gaUrlApi: [{ type: core.Input }],
4584
+ vkUrlApi: [{ type: core.Input }],
4585
+ userId: [{ type: core.Input }],
4586
+ logoGa: [{ type: core.Input }],
4587
+ storeId: [{ type: core.Input }],
4588
+ storeName: [{ type: core.Input }],
4589
+ sessionId: [{ type: core.Input }],
4590
+ checkoutId: [{ type: core.Input }],
4591
+ data: [{ type: core.Input }],
4592
+ statusPay: [{ type: core.Output }]
4593
+ };
4594
+ return GaliciaComponent;
4595
+ }());
4596
+ if (false) {
4597
+ /** @type {?} */
4598
+ GaliciaComponent.prototype.accessToken;
4599
+ /** @type {?} */
4600
+ GaliciaComponent.prototype.gaUrlApi;
4601
+ /** @type {?} */
4602
+ GaliciaComponent.prototype.vkUrlApi;
4603
+ /** @type {?} */
4604
+ GaliciaComponent.prototype.userId;
4605
+ /** @type {?} */
4606
+ GaliciaComponent.prototype.logoGa;
4607
+ /** @type {?} */
4608
+ GaliciaComponent.prototype.storeId;
4609
+ /** @type {?} */
4610
+ GaliciaComponent.prototype.storeName;
4611
+ /** @type {?} */
4612
+ GaliciaComponent.prototype.sessionId;
4613
+ /** @type {?} */
4614
+ GaliciaComponent.prototype.checkoutId;
4615
+ /** @type {?} */
4616
+ GaliciaComponent.prototype.data;
4617
+ /** @type {?} */
4618
+ GaliciaComponent.prototype.statusPay;
4619
+ /** @type {?} */
4620
+ GaliciaComponent.prototype.qrImage;
4621
+ /** @type {?} */
4622
+ GaliciaComponent.prototype.billNumber;
4623
+ /** @type {?} */
4624
+ GaliciaComponent.prototype.errorMessage;
4625
+ /** @type {?} */
4626
+ GaliciaComponent.prototype.OinitPayment;
4627
+ /** @type {?} */
4628
+ GaliciaComponent.prototype.isGeneratingQr;
4629
+ /** @type {?} */
4630
+ GaliciaComponent.prototype.paymentCompleted;
4631
+ /** @type {?} */
4632
+ GaliciaComponent.prototype.paymentId;
4633
+ /** @type {?} */
4634
+ GaliciaComponent.prototype.showQr;
4635
+ /** @type {?} */
4636
+ GaliciaComponent.prototype.expired;
4637
+ /** @type {?} */
4638
+ GaliciaComponent.prototype.isLoading;
4639
+ /** @type {?} */
4640
+ GaliciaComponent.prototype.hasError;
4641
+ /** @type {?} */
4642
+ GaliciaComponent.prototype.minutes;
4643
+ /** @type {?} */
4644
+ GaliciaComponent.prototype.seconds;
4645
+ /**
4646
+ * @type {?}
4647
+ * @private
4648
+ */
4649
+ GaliciaComponent.prototype.interval;
4650
+ /** @type {?} */
4651
+ GaliciaComponent.prototype.validationInterval;
4652
+ /** @type {?} */
4653
+ GaliciaComponent.prototype.paymentResult;
4654
+ /**
4655
+ * @type {?}
4656
+ * @private
4657
+ */
4658
+ GaliciaComponent.prototype.galiciaApiService;
4659
+ }
4660
+
4661
+ /**
4662
+ * @fileoverview added by tsickle
4663
+ * Generated from: lib/galicia/galicia.module.ts
4664
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4665
+ */
4666
+ /** @type {?} */
4667
+ var COMPONENTS$2 = [
4668
+ GaliciaComponent
4669
+ ];
4670
+ var GaliciaModule = /** @class */ (function () {
4671
+ function GaliciaModule() {
4672
+ }
4673
+ GaliciaModule.decorators = [
4674
+ { type: core.NgModule, args: [{
4675
+ declarations: [
4676
+ COMPONENTS$2
4677
+ ],
4678
+ exports: [
4679
+ COMPONENTS$2
4680
+ ],
4681
+ imports: [
4682
+ common.CommonModule,
4683
+ forms.FormsModule,
4684
+ forms.ReactiveFormsModule,
4685
+ router.RouterModule,
4686
+ ],
4687
+ providers: [
4688
+ GaliciaApiService
4689
+ ]
4690
+ },] }
4691
+ ];
4692
+ return GaliciaModule;
4693
+ }());
4694
+
4225
4695
  /**
4226
4696
  * @fileoverview added by tsickle
4227
4697
  * Generated from: lib/vk-payments.module.ts
@@ -4233,8 +4703,9 @@
4233
4703
  SpsDecidirModule,
4234
4704
  PaypalModule,
4235
4705
  GoCuotasModule,
4706
+ BankTransferModule,
4236
4707
  ModoModule,
4237
- BankTransferModule
4708
+ GaliciaModule
4238
4709
  ];
4239
4710
  var VkPaymentsModule = /** @class */ (function () {
4240
4711
  function VkPaymentsModule() {
@@ -4242,7 +4713,8 @@
4242
4713
  VkPaymentsModule.decorators = [
4243
4714
  { type: core.NgModule, args: [{
4244
4715
  imports: LIB_MODULES,
4245
- exports: LIB_MODULES
4716
+ exports: LIB_MODULES,
4717
+ declarations: []
4246
4718
  },] }
4247
4719
  ];
4248
4720
  return VkPaymentsModule;
@@ -4262,12 +4734,15 @@
4262
4734
  exports.ɵk = GoCuotasComponent;
4263
4735
  exports.ɵl = ModalComponent;
4264
4736
  exports.ɵm = GoCuotasApiService;
4265
- exports.ɵn = ModoModule;
4266
- exports.ɵo = ModoComponent;
4267
- exports.ɵp = ModoApiService;
4268
- exports.ɵq = BankTransferModule;
4269
- exports.ɵr = BankTransferComponent;
4270
- exports.ɵs = BankTransferApiService;
4737
+ exports.ɵn = BankTransferModule;
4738
+ exports.ɵo = BankTransferComponent;
4739
+ exports.ɵp = BankTransferApiService;
4740
+ exports.ɵq = ModoModule;
4741
+ exports.ɵr = ModoComponent;
4742
+ exports.ɵs = ModoApiService;
4743
+ exports.ɵt = GaliciaModule;
4744
+ exports.ɵu = GaliciaComponent;
4745
+ exports.ɵv = GaliciaApiService;
4271
4746
 
4272
4747
  Object.defineProperty(exports, '__esModule', { value: true });
4273
4748