vk-payments 0.2.24 → 0.2.25

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('@angular/common//http')) :
3
+ typeof define === 'function' && define.amd ? define('vk-payments', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/router', '@angular/common/http', 'sha256', '@angular/common//http'], 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.ng.common[''].http));
5
+ }(this, function (exports, core, common, forms, router, http, sha256, http$1) { 'use strict';
6
6
 
7
7
  sha256 = sha256 && sha256.hasOwnProperty('default') ? sha256['default'] : sha256;
8
8
 
@@ -3910,6 +3910,242 @@
3910
3910
  return ModoModule;
3911
3911
  }());
3912
3912
 
3913
+ /**
3914
+ * @fileoverview added by tsickle
3915
+ * Generated from: lib/bank-transfer/services/bank-transfer.api.service.ts
3916
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3917
+ */
3918
+ var BankTransferApiService = /** @class */ (function () {
3919
+ function BankTransferApiService(http) {
3920
+ this.http = http;
3921
+ }
3922
+ /**
3923
+ * @param {?} accessToken
3924
+ * @param {?} request
3925
+ * @param {?} vkApiUrl
3926
+ * @return {?}
3927
+ */
3928
+ BankTransferApiService.prototype.createPayment = /**
3929
+ * @param {?} accessToken
3930
+ * @param {?} request
3931
+ * @param {?} vkApiUrl
3932
+ * @return {?}
3933
+ */
3934
+ function (accessToken, request, vkApiUrl) {
3935
+ /** @type {?} */
3936
+ var headers = new http$1.HttpHeaders({
3937
+ 'Content-Type': 'application/json',
3938
+ Authorization: "Bearer " + accessToken
3939
+ });
3940
+ /** @type {?} */
3941
+ var url = vkApiUrl + "/payments/BankTransfer/create-payment";
3942
+ return this.http.post(url, request, { headers: headers });
3943
+ };
3944
+ BankTransferApiService.decorators = [
3945
+ { type: core.Injectable, args: [{
3946
+ providedIn: 'root'
3947
+ },] }
3948
+ ];
3949
+ /** @nocollapse */
3950
+ BankTransferApiService.ctorParameters = function () { return [
3951
+ { type: http$1.HttpClient }
3952
+ ]; };
3953
+ /** @nocollapse */ BankTransferApiService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function BankTransferApiService_Factory() { return new BankTransferApiService(core.ɵɵinject(http.HttpClient)); }, token: BankTransferApiService, providedIn: "root" });
3954
+ return BankTransferApiService;
3955
+ }());
3956
+ if (false) {
3957
+ /**
3958
+ * @type {?}
3959
+ * @private
3960
+ */
3961
+ BankTransferApiService.prototype.http;
3962
+ }
3963
+
3964
+ /**
3965
+ * @fileoverview added by tsickle
3966
+ * Generated from: lib/bank-transfer/components/bank-transfer.component.ts
3967
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3968
+ */
3969
+ var BankTransferComponent = /** @class */ (function () {
3970
+ function BankTransferComponent(bankTransferApi) {
3971
+ this.bankTransferApi = bankTransferApi;
3972
+ this.statusPay = new core.EventEmitter();
3973
+ this.isLoading = false;
3974
+ this.errorMessage = '';
3975
+ this.paymentForm = new forms.FormGroup({
3976
+ cuit: new forms.FormControl('', [
3977
+ forms.Validators.required,
3978
+ forms.Validators.minLength(11),
3979
+ forms.Validators.maxLength(11),
3980
+ forms.Validators.pattern('^[0-9]*$')
3981
+ ]),
3982
+ });
3983
+ }
3984
+ /**
3985
+ * @return {?}
3986
+ */
3987
+ BankTransferComponent.prototype.ngOnInit = /**
3988
+ * @return {?}
3989
+ */
3990
+ function () {
3991
+ };
3992
+ /**
3993
+ * @return {?}
3994
+ */
3995
+ BankTransferComponent.prototype.onSubmit = /**
3996
+ * @return {?}
3997
+ */
3998
+ function () {
3999
+ var _this = this;
4000
+ if (this.paymentForm.invalid) {
4001
+ this.paymentForm.markAllAsTouched();
4002
+ return;
4003
+ }
4004
+ this.isLoading = true;
4005
+ this.errorMessage = '';
4006
+ /** @type {?} */
4007
+ var cuitControl = this.paymentForm.get('cuit');
4008
+ /** @type {?} */
4009
+ var cuitValue = cuitControl ? cuitControl.value : '';
4010
+ /** @type {?} */
4011
+ var request = {
4012
+ cuit: cuitValue.toString(),
4013
+ checkoutId: this.checkoutId,
4014
+ storeName: this.storeName || 'Tienda VK',
4015
+ storeId: this.storeId
4016
+ };
4017
+ this.bankTransferApi.createPayment(this.accessToken, request, this.vkUrlApi).subscribe((/**
4018
+ * @param {?} response
4019
+ * @return {?}
4020
+ */
4021
+ function (response) {
4022
+ _this.isLoading = false;
4023
+ if (response && response.success) {
4024
+ // Exito!
4025
+ _this.statusPay.emit({
4026
+ success: true,
4027
+ paymentId: (response.data && response.data.bankTransferEcommId) ? response.data.bankTransferEcommId : '',
4028
+ integrator: 'BANK_TRANSFER'
4029
+ });
4030
+ }
4031
+ else {
4032
+ // El API respondió HTTP 200 pero success: false
4033
+ _this.errorMessage = (response.errorsMessages && response.errorsMessages.length > 0) ? response.errorsMessages[0] : 'Ocurrió un error al registrar la transferencia.';
4034
+ _this.statusPay.emit({
4035
+ success: false,
4036
+ paymentId: '',
4037
+ integrator: 'BANK_TRANSFER'
4038
+ });
4039
+ }
4040
+ }), (/**
4041
+ * @param {?} error
4042
+ * @return {?}
4043
+ */
4044
+ function (error) {
4045
+ // Error HTTP (500, 400, etc)
4046
+ _this.isLoading = false;
4047
+ _this.errorMessage = (error && error.error && error.error.errorsMessages && error.error.errorsMessages.length > 0) ? error.error.errorsMessages[0] : 'Ocurrió un error de conexión al registrar la transferencia.';
4048
+ _this.statusPay.emit({
4049
+ success: false,
4050
+ paymentId: '',
4051
+ integrator: 'BANK_TRANSFER'
4052
+ });
4053
+ console.error('Error BankTransferApiService:', error);
4054
+ }));
4055
+ };
4056
+ Object.defineProperty(BankTransferComponent.prototype, "cuitControl", {
4057
+ // Helper para validación visual en el template
4058
+ get:
4059
+ // Helper para validación visual en el template
4060
+ /**
4061
+ * @return {?}
4062
+ */
4063
+ function () {
4064
+ return this.paymentForm.get('cuit');
4065
+ },
4066
+ enumerable: true,
4067
+ configurable: true
4068
+ });
4069
+ BankTransferComponent.decorators = [
4070
+ { type: core.Component, args: [{
4071
+ selector: 'vk-bank-transfer',
4072
+ template: "<div class=\"bank-transfer-container\">\n \n <p class=\"description\">\n Complet\u00E1 tu CUIT/CUIL para registrar el pago por transferencia. \n Una vez confirmado, tu pedido quedar\u00E1 sujeto a la aprobaci\u00F3n del pago.\n </p>\n\n <form [formGroup]=\"paymentForm\" (ngSubmit)=\"onSubmit()\">\n \n <div class=\"form-group\">\n <label for=\"cuit\">CUIT / CUIL del titular de la cuenta origen *</label>\n <input \n type=\"text\" \n id=\"cuit\" \n formControlName=\"cuit\" \n placeholder=\"Ej: 20112223334 (Sin guiones)\" \n maxlength=\"11\"\n [ngClass]=\"{'is-invalid': cuitControl?.invalid && (cuitControl?.dirty || cuitControl?.touched)}\"\n >\n \n <div class=\"error-feedback\" *ngIf=\"cuitControl?.invalid && (cuitControl?.dirty || cuitControl?.touched)\">\n <span *ngIf=\"cuitControl?.errors?.required\">El CUIT/CUIL es obligatorio.</span>\n <span *ngIf=\"cuitControl?.errors?.pattern\">Debe contener solo n\u00FAmeros.</span>\n <span *ngIf=\"cuitControl?.errors?.minlength || cuitControl?.errors?.maxlength\">Debe tener exactamente 11 d\u00EDgitos.</span>\n </div>\n </div>\n\n <div class=\"summary-box\">\n <div class=\"summary-row total\">\n <span>Total a transferir:</span>\n <span class=\"amount\">${{ amount | number:'1.2-2' }}</span>\n </div>\n <small>* El 10% de descuento ya se encuentra aplicado a este total.</small>\n </div>\n\n <!-- Error devuelto por la API -->\n <div class=\"api-error\" *ngIf=\"errorMessage\">\n {{ errorMessage }}\n </div>\n\n <button type=\"submit\" class=\"btn-submit\" [disabled]=\"paymentForm.invalid || isLoading\">\n <span *ngIf=\"!isLoading\">Confirmar Pago por Transferencia</span>\n <span *ngIf=\"isLoading\" class=\"loader\">Procesando...</span>\n </button>\n\n </form>\n</div>\n",
4073
+ styles: [".bank-transfer-container{padding:10px 0}.bank-transfer-container .description{font-size:14px;color:#666;margin-bottom:20px;line-height:1.4}.bank-transfer-container .form-group{margin-bottom:20px}.bank-transfer-container .form-group label{display:block;font-weight:500;margin-bottom:8px;color:#333}.bank-transfer-container .form-group input{width:100%;padding:10px;border:1px solid #ccc;border-radius:4px;font-size:16px;transition:border-color .2s}.bank-transfer-container .form-group input:focus{outline:0;border-color:#f48024}.bank-transfer-container .form-group input.is-invalid{border-color:#d32f2f}.bank-transfer-container .form-group .error-feedback{color:#d32f2f;font-size:12px;margin-top:5px;display:block}.bank-transfer-container .summary-box{background:#f5f5f5;padding:15px;border-radius:4px;margin-bottom:20px;text-align:right}.bank-transfer-container .summary-box .summary-row{display:flex;justify-content:flex-end;align-items:center;font-size:18px}.bank-transfer-container .summary-box .summary-row span{margin-left:10px}.bank-transfer-container .summary-box .summary-row span.amount{font-weight:700;color:#2e7d32}.bank-transfer-container .summary-box small{display:block;color:#888;font-size:12px;margin-top:5px}.bank-transfer-container .api-error{background-color:#ffebee;color:#c62828;padding:10px;border-radius:4px;margin-bottom:15px;font-size:14px;text-align:center}.bank-transfer-container .btn-submit{width:100%;padding:12px;background-color:#111;color:#fff;border:none;border-radius:4px;font-size:16px;font-weight:600;cursor:pointer;transition:background-color .2s}.bank-transfer-container .btn-submit:hover{background-color:#333}.bank-transfer-container .btn-submit:disabled{background-color:#ccc;cursor:not-allowed}.bank-transfer-container .btn-submit .loader{display:inline-block;position:relative}"]
4074
+ }] }
4075
+ ];
4076
+ /** @nocollapse */
4077
+ BankTransferComponent.ctorParameters = function () { return [
4078
+ { type: BankTransferApiService }
4079
+ ]; };
4080
+ BankTransferComponent.propDecorators = {
4081
+ accessToken: [{ type: core.Input }],
4082
+ vkUrlApi: [{ type: core.Input }],
4083
+ amount: [{ type: core.Input }],
4084
+ storeId: [{ type: core.Input }],
4085
+ storeName: [{ type: core.Input }],
4086
+ checkoutId: [{ type: core.Input }],
4087
+ statusPay: [{ type: core.Output }]
4088
+ };
4089
+ return BankTransferComponent;
4090
+ }());
4091
+ if (false) {
4092
+ /** @type {?} */
4093
+ BankTransferComponent.prototype.accessToken;
4094
+ /** @type {?} */
4095
+ BankTransferComponent.prototype.vkUrlApi;
4096
+ /** @type {?} */
4097
+ BankTransferComponent.prototype.amount;
4098
+ /** @type {?} */
4099
+ BankTransferComponent.prototype.storeId;
4100
+ /** @type {?} */
4101
+ BankTransferComponent.prototype.storeName;
4102
+ /** @type {?} */
4103
+ BankTransferComponent.prototype.checkoutId;
4104
+ /** @type {?} */
4105
+ BankTransferComponent.prototype.statusPay;
4106
+ /** @type {?} */
4107
+ BankTransferComponent.prototype.paymentForm;
4108
+ /** @type {?} */
4109
+ BankTransferComponent.prototype.isLoading;
4110
+ /** @type {?} */
4111
+ BankTransferComponent.prototype.errorMessage;
4112
+ /**
4113
+ * @type {?}
4114
+ * @private
4115
+ */
4116
+ BankTransferComponent.prototype.bankTransferApi;
4117
+ }
4118
+
4119
+ /**
4120
+ * @fileoverview added by tsickle
4121
+ * Generated from: lib/bank-transfer/bank-transfer.module.ts
4122
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4123
+ */
4124
+ var BankTransferModule = /** @class */ (function () {
4125
+ function BankTransferModule() {
4126
+ }
4127
+ BankTransferModule.decorators = [
4128
+ { type: core.NgModule, args: [{
4129
+ declarations: [
4130
+ BankTransferComponent
4131
+ ],
4132
+ imports: [
4133
+ common.CommonModule,
4134
+ forms.FormsModule,
4135
+ forms.ReactiveFormsModule,
4136
+ http.HttpClientModule
4137
+ ],
4138
+ exports: [
4139
+ BankTransferComponent
4140
+ ],
4141
+ providers: [
4142
+ BankTransferApiService
4143
+ ]
4144
+ },] }
4145
+ ];
4146
+ return BankTransferModule;
4147
+ }());
4148
+
3913
4149
  /**
3914
4150
  * @fileoverview added by tsickle
3915
4151
  * Generated from: lib/vk-payments.module.ts
@@ -3921,7 +4157,8 @@
3921
4157
  SpsDecidirModule,
3922
4158
  PaypalModule,
3923
4159
  GoCuotasModule,
3924
- ModoModule
4160
+ ModoModule,
4161
+ BankTransferModule
3925
4162
  ];
3926
4163
  var VkPaymentsModule = /** @class */ (function () {
3927
4164
  function VkPaymentsModule() {
@@ -3952,6 +4189,9 @@
3952
4189
  exports.ɵn = ModoModule;
3953
4190
  exports.ɵo = ModoComponent;
3954
4191
  exports.ɵp = ModoApiService;
4192
+ exports.ɵq = BankTransferModule;
4193
+ exports.ɵr = BankTransferComponent;
4194
+ exports.ɵs = BankTransferApiService;
3955
4195
 
3956
4196
  Object.defineProperty(exports, '__esModule', { value: true });
3957
4197