vk-payments 0.2.7 → 0.2.9

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.
@@ -3439,6 +3439,204 @@
3439
3439
  return GoCuotasModule;
3440
3440
  }());
3441
3441
 
3442
+ /**
3443
+ * @fileoverview added by tsickle
3444
+ * Generated from: lib/modo/services/modo-api.service.ts
3445
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3446
+ */
3447
+ var ModoApiService = /** @class */ (function () {
3448
+ function ModoApiService(http) {
3449
+ this.http = http;
3450
+ }
3451
+ /**
3452
+ * @param {?} paymentRequest
3453
+ * @param {?} apiUrl
3454
+ * @return {?}
3455
+ */
3456
+ ModoApiService.prototype.createPayment = /**
3457
+ * @param {?} paymentRequest
3458
+ * @param {?} apiUrl
3459
+ * @return {?}
3460
+ */
3461
+ function (paymentRequest, apiUrl) {
3462
+ return this.http.post(apiUrl + "/create-payment", paymentRequest);
3463
+ };
3464
+ ModoApiService.decorators = [
3465
+ { type: core.Injectable, args: [{
3466
+ providedIn: 'root'
3467
+ },] }
3468
+ ];
3469
+ /** @nocollapse */
3470
+ ModoApiService.ctorParameters = function () { return [
3471
+ { type: http.HttpClient }
3472
+ ]; };
3473
+ /** @nocollapse */ ModoApiService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function ModoApiService_Factory() { return new ModoApiService(core.ɵɵinject(http.HttpClient)); }, token: ModoApiService, providedIn: "root" });
3474
+ return ModoApiService;
3475
+ }());
3476
+ if (false) {
3477
+ /**
3478
+ * @type {?}
3479
+ * @private
3480
+ */
3481
+ ModoApiService.prototype.http;
3482
+ }
3483
+
3484
+ /**
3485
+ * @fileoverview added by tsickle
3486
+ * Generated from: lib/modo/components/modo/modo.component.ts
3487
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3488
+ */
3489
+ // Declara el SDK de MODO
3490
+ var ModoComponent = /** @class */ (function () {
3491
+ function ModoComponent(modoApi) {
3492
+ this.modoApi = modoApi;
3493
+ this.statusPay = new core.EventEmitter();
3494
+ this.isLoading = false;
3495
+ }
3496
+ /**
3497
+ * @return {?}
3498
+ */
3499
+ ModoComponent.prototype.ngOnInit = /**
3500
+ * @return {?}
3501
+ */
3502
+ function () {
3503
+ this.loadModoScript();
3504
+ };
3505
+ /**
3506
+ * @return {?}
3507
+ */
3508
+ ModoComponent.prototype.payWithModo = /**
3509
+ * @return {?}
3510
+ */
3511
+ function () {
3512
+ var _this = this;
3513
+ this.isLoading = true;
3514
+ /** @type {?} */
3515
+ var paymentRequest = {
3516
+ amount: this.amount,
3517
+ orderId: this.orderId
3518
+ };
3519
+ this.modoApi.createPayment(paymentRequest, this.vkUrlApi).subscribe({
3520
+ next: (/**
3521
+ * @param {?} response
3522
+ * @return {?}
3523
+ */
3524
+ function (response) {
3525
+ _this.isLoading = false;
3526
+ if (response.success && response.data) {
3527
+ /** @type {?} */
3528
+ var modalObject = {
3529
+ qrString: response.data.qrString,
3530
+ checkoutId: response.data.internalPaymentId,
3531
+ onSuccess: (/**
3532
+ * @return {?}
3533
+ */
3534
+ function () { return _this.statusPay.emit({ success: true, paymentId: response.data.internalPaymentId }); }),
3535
+ onFailure: (/**
3536
+ * @return {?}
3537
+ */
3538
+ function () { return _this.statusPay.emit({ success: false, paymentId: response.data.internalPaymentId }); }),
3539
+ onClose: (/**
3540
+ * @return {?}
3541
+ */
3542
+ function () { return console.log('Modal de MODO cerrado.'); }),
3543
+ };
3544
+ ModoSDK.modoInitPayment(modalObject);
3545
+ }
3546
+ else {
3547
+ _this.statusPay.emit({ success: false, paymentId: '' });
3548
+ }
3549
+ }),
3550
+ error: (/**
3551
+ * @param {?} err
3552
+ * @return {?}
3553
+ */
3554
+ function (err) {
3555
+ _this.isLoading = false;
3556
+ _this.statusPay.emit({ success: false, paymentId: '' });
3557
+ })
3558
+ });
3559
+ };
3560
+ /**
3561
+ * @private
3562
+ * @return {?}
3563
+ */
3564
+ ModoComponent.prototype.loadModoScript = /**
3565
+ * @private
3566
+ * @return {?}
3567
+ */
3568
+ function () {
3569
+ /** @type {?} */
3570
+ var scriptUrl = 'https://ecommerce-modal.modo.com.ar/bundle.js';
3571
+ if (!document.querySelector("script[src=\"" + scriptUrl + "\"]")) {
3572
+ /** @type {?} */
3573
+ var script = document.createElement('script');
3574
+ script.src = scriptUrl;
3575
+ document.body.appendChild(script);
3576
+ }
3577
+ };
3578
+ ModoComponent.decorators = [
3579
+ { type: core.Component, args: [{
3580
+ selector: 'vk-modo-payment',
3581
+ template: "<button class=\"boton-pago-modo\" (click)=\"payWithModo()\" [disabled]=\"isLoading\">\n <span *ngIf=\"!isLoading\">Pagar con MODO</span>\n <span *ngIf=\"isLoading\">Procesando...</span>\n</button>",
3582
+ styles: [".boton-pago-modo{background-color:#00a5f0;color:#fff;border:none;padding:12px 20px;font-size:16px;font-weight:700;border-radius:8px;cursor:pointer;width:100%;margin-top:15px;display:flex;align-items:center;justify-content:center;transition:background-color .3s}.boton-pago-modo:disabled{background-color:#ccc;cursor:not-allowed}.boton-pago-modo:hover:not(:disabled){background-color:#0082be}"]
3583
+ }] }
3584
+ ];
3585
+ /** @nocollapse */
3586
+ ModoComponent.ctorParameters = function () { return [
3587
+ { type: ModoApiService }
3588
+ ]; };
3589
+ ModoComponent.propDecorators = {
3590
+ amount: [{ type: core.Input }],
3591
+ orderId: [{ type: core.Input }],
3592
+ vkUrlApi: [{ type: core.Input }],
3593
+ statusPay: [{ type: core.Output }]
3594
+ };
3595
+ return ModoComponent;
3596
+ }());
3597
+ if (false) {
3598
+ /** @type {?} */
3599
+ ModoComponent.prototype.amount;
3600
+ /** @type {?} */
3601
+ ModoComponent.prototype.orderId;
3602
+ /** @type {?} */
3603
+ ModoComponent.prototype.vkUrlApi;
3604
+ /** @type {?} */
3605
+ ModoComponent.prototype.statusPay;
3606
+ /** @type {?} */
3607
+ ModoComponent.prototype.isLoading;
3608
+ /**
3609
+ * @type {?}
3610
+ * @private
3611
+ */
3612
+ ModoComponent.prototype.modoApi;
3613
+ }
3614
+
3615
+ /**
3616
+ * @fileoverview added by tsickle
3617
+ * Generated from: lib/modo/modo.module.ts
3618
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3619
+ */
3620
+ var ModoModule = /** @class */ (function () {
3621
+ function ModoModule() {
3622
+ }
3623
+ ModoModule.decorators = [
3624
+ { type: core.NgModule, args: [{
3625
+ declarations: [
3626
+ ModoComponent
3627
+ ],
3628
+ imports: [
3629
+ common.CommonModule,
3630
+ http.HttpClientModule
3631
+ ],
3632
+ exports: [
3633
+ ModoComponent
3634
+ ]
3635
+ },] }
3636
+ ];
3637
+ return ModoModule;
3638
+ }());
3639
+
3442
3640
  /**
3443
3641
  * @fileoverview added by tsickle
3444
3642
  * Generated from: lib/vk-payments.module.ts
@@ -3449,7 +3647,8 @@
3449
3647
  MercadopagoModule,
3450
3648
  SpsDecidirModule,
3451
3649
  PaypalModule,
3452
- GoCuotasModule
3650
+ GoCuotasModule,
3651
+ ModoModule
3453
3652
  ];
3454
3653
  var VkPaymentsModule = /** @class */ (function () {
3455
3654
  function VkPaymentsModule() {
@@ -3477,6 +3676,9 @@
3477
3676
  exports.ɵk = GoCuotasComponent;
3478
3677
  exports.ɵl = ModalComponent;
3479
3678
  exports.ɵm = GoCuotasApiService;
3679
+ exports.ɵn = ModoModule;
3680
+ exports.ɵo = ModoComponent;
3681
+ exports.ɵp = ModoApiService;
3480
3682
 
3481
3683
  Object.defineProperty(exports, '__esModule', { value: true });
3482
3684