vk-payments 0.2.8 → 0.2.10
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.
- package/bundles/vk-payments.umd.js +271 -1
- package/bundles/vk-payments.umd.js.map +1 -1
- package/bundles/vk-payments.umd.min.js +1 -1
- package/bundles/vk-payments.umd.min.js.map +1 -1
- package/esm2015/lib/modo/components/modo/modo.component.js +166 -0
- package/esm2015/lib/modo/models/modo.models.js +28 -0
- package/esm2015/lib/modo/modo.module.js +26 -0
- package/esm2015/lib/modo/services/modo-api.service.js +43 -0
- package/esm2015/lib/vk-payments.module.js +4 -2
- package/esm2015/vk-payments.js +4 -1
- package/esm5/lib/modo/components/modo/modo.component.js +203 -0
- package/esm5/lib/modo/models/modo.models.js +28 -0
- package/esm5/lib/modo/modo.module.js +30 -0
- package/esm5/lib/modo/services/modo-api.service.js +47 -0
- package/esm5/lib/vk-payments.module.js +4 -2
- package/esm5/vk-payments.js +4 -1
- package/fesm2015/vk-payments.js +228 -2
- package/fesm2015/vk-payments.js.map +1 -1
- package/fesm5/vk-payments.js +270 -3
- package/fesm5/vk-payments.js.map +1 -1
- package/lib/modo/components/modo/modo.component.d.ts +24 -0
- package/lib/modo/models/modo.models.d.ts +13 -0
- package/lib/modo/modo.module.d.ts +2 -0
- package/lib/modo/services/modo-api.service.d.ts +8 -0
- package/package.json +1 -1
- package/vk-payments.d.ts +3 -0
- package/vk-payments.metadata.json +1 -1
|
@@ -3439,6 +3439,272 @@
|
|
|
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
|
+
var ModoComponent = /** @class */ (function () {
|
|
3490
|
+
function ModoComponent(modoApi) {
|
|
3491
|
+
this.modoApi = modoApi;
|
|
3492
|
+
this.statusPay = new core.EventEmitter();
|
|
3493
|
+
this.isLoading = false;
|
|
3494
|
+
}
|
|
3495
|
+
/**
|
|
3496
|
+
* @return {?}
|
|
3497
|
+
*/
|
|
3498
|
+
ModoComponent.prototype.ngOnInit = /**
|
|
3499
|
+
* @return {?}
|
|
3500
|
+
*/
|
|
3501
|
+
function () {
|
|
3502
|
+
this.loadModoScript();
|
|
3503
|
+
};
|
|
3504
|
+
/**
|
|
3505
|
+
* @return {?}
|
|
3506
|
+
*/
|
|
3507
|
+
ModoComponent.prototype.startModoPayment = /**
|
|
3508
|
+
* @return {?}
|
|
3509
|
+
*/
|
|
3510
|
+
function () {
|
|
3511
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3512
|
+
var initialData_1, modalObject, error_1;
|
|
3513
|
+
var _this = this;
|
|
3514
|
+
return __generator(this, function (_a) {
|
|
3515
|
+
switch (_a.label) {
|
|
3516
|
+
case 0:
|
|
3517
|
+
this.isLoading = true;
|
|
3518
|
+
_a.label = 1;
|
|
3519
|
+
case 1:
|
|
3520
|
+
_a.trys.push([1, 3, , 4]);
|
|
3521
|
+
return [4 /*yield*/, this.createModoPayment()];
|
|
3522
|
+
case 2:
|
|
3523
|
+
initialData_1 = _a.sent();
|
|
3524
|
+
this.isLoading = false;
|
|
3525
|
+
modalObject = {
|
|
3526
|
+
version: '2',
|
|
3527
|
+
qrString: initialData_1.qrString,
|
|
3528
|
+
checkoutId: initialData_1.checkoutId,
|
|
3529
|
+
deeplink: {
|
|
3530
|
+
url: initialData_1.deeplink,
|
|
3531
|
+
callbackURL: this.callbackUrl,
|
|
3532
|
+
callbackURLSuccess: this.callbackUrlSuccess
|
|
3533
|
+
},
|
|
3534
|
+
callbackURL: this.callbackUrl,
|
|
3535
|
+
refreshData: (/**
|
|
3536
|
+
* @return {?}
|
|
3537
|
+
*/
|
|
3538
|
+
function () { return _this.createModoPayment(); }),
|
|
3539
|
+
onSuccess: (/**
|
|
3540
|
+
* @return {?}
|
|
3541
|
+
*/
|
|
3542
|
+
function () {
|
|
3543
|
+
_this.statusPay.emit({ success: true, paymentId: initialData_1.checkoutId });
|
|
3544
|
+
}),
|
|
3545
|
+
onFailure: (/**
|
|
3546
|
+
* @return {?}
|
|
3547
|
+
*/
|
|
3548
|
+
function () {
|
|
3549
|
+
_this.statusPay.emit({ success: false, paymentId: initialData_1.checkoutId });
|
|
3550
|
+
}),
|
|
3551
|
+
onCancel: (/**
|
|
3552
|
+
* @return {?}
|
|
3553
|
+
*/
|
|
3554
|
+
function () {
|
|
3555
|
+
console.log('Pago cancelado por el usuario en el celular.');
|
|
3556
|
+
}),
|
|
3557
|
+
onClose: (/**
|
|
3558
|
+
* @return {?}
|
|
3559
|
+
*/
|
|
3560
|
+
function () {
|
|
3561
|
+
console.log('Modal de MODO cerrado.');
|
|
3562
|
+
}),
|
|
3563
|
+
};
|
|
3564
|
+
// 3. Inicia el SDK de MODO
|
|
3565
|
+
ModoSDK.modoInitPayment(modalObject);
|
|
3566
|
+
return [3 /*break*/, 4];
|
|
3567
|
+
case 3:
|
|
3568
|
+
error_1 = _a.sent();
|
|
3569
|
+
this.isLoading = false;
|
|
3570
|
+
this.statusPay.emit({ success: false, paymentId: '' });
|
|
3571
|
+
console.error("Error al iniciar el pago con MODO", error_1);
|
|
3572
|
+
return [3 /*break*/, 4];
|
|
3573
|
+
case 4: return [2 /*return*/];
|
|
3574
|
+
}
|
|
3575
|
+
});
|
|
3576
|
+
});
|
|
3577
|
+
};
|
|
3578
|
+
/**
|
|
3579
|
+
* Esta función se encarga de llamar a tu backend.
|
|
3580
|
+
* Se usa tanto para la carga inicial como para el refresco del SDK.
|
|
3581
|
+
*/
|
|
3582
|
+
/**
|
|
3583
|
+
* Esta función se encarga de llamar a tu backend.
|
|
3584
|
+
* Se usa tanto para la carga inicial como para el refresco del SDK.
|
|
3585
|
+
* @private
|
|
3586
|
+
* @return {?}
|
|
3587
|
+
*/
|
|
3588
|
+
ModoComponent.prototype.createModoPayment = /**
|
|
3589
|
+
* Esta función se encarga de llamar a tu backend.
|
|
3590
|
+
* Se usa tanto para la carga inicial como para el refresco del SDK.
|
|
3591
|
+
* @private
|
|
3592
|
+
* @return {?}
|
|
3593
|
+
*/
|
|
3594
|
+
function () {
|
|
3595
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3596
|
+
var paymentRequest, response;
|
|
3597
|
+
return __generator(this, function (_a) {
|
|
3598
|
+
switch (_a.label) {
|
|
3599
|
+
case 0:
|
|
3600
|
+
paymentRequest = {
|
|
3601
|
+
amount: this.amount,
|
|
3602
|
+
orderId: this.orderId,
|
|
3603
|
+
};
|
|
3604
|
+
return [4 /*yield*/, this.modoApi.createPayment(paymentRequest, this.vkUrlApi).toPromise()];
|
|
3605
|
+
case 1:
|
|
3606
|
+
response = _a.sent();
|
|
3607
|
+
if (response.success && response.data) {
|
|
3608
|
+
return [2 /*return*/, {
|
|
3609
|
+
qrString: response.data.qrString,
|
|
3610
|
+
checkoutId: response.data.internalPaymentId,
|
|
3611
|
+
deeplink: response.data.deeplink
|
|
3612
|
+
}];
|
|
3613
|
+
}
|
|
3614
|
+
else {
|
|
3615
|
+
throw new Error('La respuesta de la API no fue exitosa.');
|
|
3616
|
+
}
|
|
3617
|
+
return [2 /*return*/];
|
|
3618
|
+
}
|
|
3619
|
+
});
|
|
3620
|
+
});
|
|
3621
|
+
};
|
|
3622
|
+
/**
|
|
3623
|
+
* @private
|
|
3624
|
+
* @return {?}
|
|
3625
|
+
*/
|
|
3626
|
+
ModoComponent.prototype.loadModoScript = /**
|
|
3627
|
+
* @private
|
|
3628
|
+
* @return {?}
|
|
3629
|
+
*/
|
|
3630
|
+
function () {
|
|
3631
|
+
/** @type {?} */
|
|
3632
|
+
var scriptUrl = 'https://ecommerce-modal.modo.com.ar/bundle.js';
|
|
3633
|
+
if (!document.querySelector("script[src=\"" + scriptUrl + "\"]")) {
|
|
3634
|
+
/** @type {?} */
|
|
3635
|
+
var script = document.createElement('script');
|
|
3636
|
+
script.src = scriptUrl;
|
|
3637
|
+
document.body.appendChild(script);
|
|
3638
|
+
}
|
|
3639
|
+
};
|
|
3640
|
+
ModoComponent.decorators = [
|
|
3641
|
+
{ type: core.Component, args: [{
|
|
3642
|
+
selector: 'vk-modo-payment',
|
|
3643
|
+
template: "<button class=\"boton-pago-modo\" (click)=\"startModoPayment()\" [disabled]=\"isLoading\">\n <span *ngIf=\"!isLoading\">Pagar con MODO</span>\n <span *ngIf=\"isLoading\">Procesando...</span>\n</button>",
|
|
3644
|
+
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}"]
|
|
3645
|
+
}] }
|
|
3646
|
+
];
|
|
3647
|
+
/** @nocollapse */
|
|
3648
|
+
ModoComponent.ctorParameters = function () { return [
|
|
3649
|
+
{ type: ModoApiService }
|
|
3650
|
+
]; };
|
|
3651
|
+
ModoComponent.propDecorators = {
|
|
3652
|
+
amount: [{ type: core.Input }],
|
|
3653
|
+
orderId: [{ type: core.Input }],
|
|
3654
|
+
vkUrlApi: [{ type: core.Input }],
|
|
3655
|
+
callbackUrl: [{ type: core.Input }],
|
|
3656
|
+
callbackUrlSuccess: [{ type: core.Input }],
|
|
3657
|
+
statusPay: [{ type: core.Output }]
|
|
3658
|
+
};
|
|
3659
|
+
return ModoComponent;
|
|
3660
|
+
}());
|
|
3661
|
+
if (false) {
|
|
3662
|
+
/** @type {?} */
|
|
3663
|
+
ModoComponent.prototype.amount;
|
|
3664
|
+
/** @type {?} */
|
|
3665
|
+
ModoComponent.prototype.orderId;
|
|
3666
|
+
/** @type {?} */
|
|
3667
|
+
ModoComponent.prototype.vkUrlApi;
|
|
3668
|
+
/** @type {?} */
|
|
3669
|
+
ModoComponent.prototype.callbackUrl;
|
|
3670
|
+
/** @type {?} */
|
|
3671
|
+
ModoComponent.prototype.callbackUrlSuccess;
|
|
3672
|
+
/** @type {?} */
|
|
3673
|
+
ModoComponent.prototype.statusPay;
|
|
3674
|
+
/** @type {?} */
|
|
3675
|
+
ModoComponent.prototype.isLoading;
|
|
3676
|
+
/**
|
|
3677
|
+
* @type {?}
|
|
3678
|
+
* @private
|
|
3679
|
+
*/
|
|
3680
|
+
ModoComponent.prototype.modoApi;
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3683
|
+
/**
|
|
3684
|
+
* @fileoverview added by tsickle
|
|
3685
|
+
* Generated from: lib/modo/modo.module.ts
|
|
3686
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3687
|
+
*/
|
|
3688
|
+
var ModoModule = /** @class */ (function () {
|
|
3689
|
+
function ModoModule() {
|
|
3690
|
+
}
|
|
3691
|
+
ModoModule.decorators = [
|
|
3692
|
+
{ type: core.NgModule, args: [{
|
|
3693
|
+
declarations: [
|
|
3694
|
+
ModoComponent
|
|
3695
|
+
],
|
|
3696
|
+
imports: [
|
|
3697
|
+
common.CommonModule,
|
|
3698
|
+
http.HttpClientModule
|
|
3699
|
+
],
|
|
3700
|
+
exports: [
|
|
3701
|
+
ModoComponent
|
|
3702
|
+
]
|
|
3703
|
+
},] }
|
|
3704
|
+
];
|
|
3705
|
+
return ModoModule;
|
|
3706
|
+
}());
|
|
3707
|
+
|
|
3442
3708
|
/**
|
|
3443
3709
|
* @fileoverview added by tsickle
|
|
3444
3710
|
* Generated from: lib/vk-payments.module.ts
|
|
@@ -3449,7 +3715,8 @@
|
|
|
3449
3715
|
MercadopagoModule,
|
|
3450
3716
|
SpsDecidirModule,
|
|
3451
3717
|
PaypalModule,
|
|
3452
|
-
GoCuotasModule
|
|
3718
|
+
GoCuotasModule,
|
|
3719
|
+
ModoModule
|
|
3453
3720
|
];
|
|
3454
3721
|
var VkPaymentsModule = /** @class */ (function () {
|
|
3455
3722
|
function VkPaymentsModule() {
|
|
@@ -3477,6 +3744,9 @@
|
|
|
3477
3744
|
exports.ɵk = GoCuotasComponent;
|
|
3478
3745
|
exports.ɵl = ModalComponent;
|
|
3479
3746
|
exports.ɵm = GoCuotasApiService;
|
|
3747
|
+
exports.ɵn = ModoModule;
|
|
3748
|
+
exports.ɵo = ModoComponent;
|
|
3749
|
+
exports.ɵp = ModoApiService;
|
|
3480
3750
|
|
|
3481
3751
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3482
3752
|
|