vk-payments 0.2.24 → 0.2.26

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.
@@ -3910,6 +3910,243 @@
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.HttpHeaders({
3937
+ 'Content-Type': 'application/json',
3938
+ Authorization: "Bearer " + accessToken
3939
+ });
3940
+ // Construimos la URL agregando la rute del Controller de BankTransfer
3941
+ /** @type {?} */
3942
+ var url = vkApiUrl + "/payments/BankTransfer/create-payment";
3943
+ return this.http.post(url, request, { headers: headers });
3944
+ };
3945
+ BankTransferApiService.decorators = [
3946
+ { type: core.Injectable, args: [{
3947
+ providedIn: 'root'
3948
+ },] }
3949
+ ];
3950
+ /** @nocollapse */
3951
+ BankTransferApiService.ctorParameters = function () { return [
3952
+ { type: http.HttpClient }
3953
+ ]; };
3954
+ /** @nocollapse */ BankTransferApiService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function BankTransferApiService_Factory() { return new BankTransferApiService(core.ɵɵinject(http.HttpClient)); }, token: BankTransferApiService, providedIn: "root" });
3955
+ return BankTransferApiService;
3956
+ }());
3957
+ if (false) {
3958
+ /**
3959
+ * @type {?}
3960
+ * @private
3961
+ */
3962
+ BankTransferApiService.prototype.http;
3963
+ }
3964
+
3965
+ /**
3966
+ * @fileoverview added by tsickle
3967
+ * Generated from: lib/bank-transfer/components/bank-transfer.component.ts
3968
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3969
+ */
3970
+ var BankTransferComponent = /** @class */ (function () {
3971
+ function BankTransferComponent(bankTransferApi) {
3972
+ this.bankTransferApi = bankTransferApi;
3973
+ this.statusPay = new core.EventEmitter();
3974
+ this.isLoading = false;
3975
+ this.errorMessage = '';
3976
+ this.paymentForm = new forms.FormGroup({
3977
+ cuit: new forms.FormControl('', [
3978
+ forms.Validators.required,
3979
+ forms.Validators.minLength(11),
3980
+ forms.Validators.maxLength(11),
3981
+ forms.Validators.pattern('^[0-9]*$')
3982
+ ]),
3983
+ });
3984
+ }
3985
+ /**
3986
+ * @return {?}
3987
+ */
3988
+ BankTransferComponent.prototype.ngOnInit = /**
3989
+ * @return {?}
3990
+ */
3991
+ function () {
3992
+ };
3993
+ /**
3994
+ * @return {?}
3995
+ */
3996
+ BankTransferComponent.prototype.onSubmit = /**
3997
+ * @return {?}
3998
+ */
3999
+ function () {
4000
+ var _this = this;
4001
+ if (this.paymentForm.invalid) {
4002
+ this.paymentForm.markAllAsTouched();
4003
+ return;
4004
+ }
4005
+ this.isLoading = true;
4006
+ this.errorMessage = '';
4007
+ /** @type {?} */
4008
+ var cuitControl = this.paymentForm.get('cuit');
4009
+ /** @type {?} */
4010
+ var cuitValue = cuitControl ? cuitControl.value : '';
4011
+ /** @type {?} */
4012
+ var request = {
4013
+ cuit: cuitValue.toString(),
4014
+ checkoutId: this.checkoutId,
4015
+ storeName: this.storeName || 'Tienda VK',
4016
+ storeId: this.storeId
4017
+ };
4018
+ this.bankTransferApi.createPayment(this.accessToken, request, this.vkUrlApi).subscribe((/**
4019
+ * @param {?} response
4020
+ * @return {?}
4021
+ */
4022
+ function (response) {
4023
+ _this.isLoading = false;
4024
+ if (response && response.success) {
4025
+ // Exito!
4026
+ _this.statusPay.emit({
4027
+ success: true,
4028
+ paymentId: (response.data && response.data.bankTransferEcommId) ? response.data.bankTransferEcommId : '',
4029
+ integrator: 'BANK_TRANSFER'
4030
+ });
4031
+ }
4032
+ else {
4033
+ // El API respondió HTTP 200 pero success: false
4034
+ _this.errorMessage = (response.errorsMessages && response.errorsMessages.length > 0) ? response.errorsMessages[0] : 'Ocurrió un error al registrar la transferencia.';
4035
+ _this.statusPay.emit({
4036
+ success: false,
4037
+ paymentId: '',
4038
+ integrator: 'BANK_TRANSFER'
4039
+ });
4040
+ }
4041
+ }), (/**
4042
+ * @param {?} error
4043
+ * @return {?}
4044
+ */
4045
+ function (error) {
4046
+ // Error HTTP (500, 400, etc)
4047
+ _this.isLoading = false;
4048
+ _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.';
4049
+ _this.statusPay.emit({
4050
+ success: false,
4051
+ paymentId: '',
4052
+ integrator: 'BANK_TRANSFER'
4053
+ });
4054
+ console.error('Error BankTransferApiService:', error);
4055
+ }));
4056
+ };
4057
+ Object.defineProperty(BankTransferComponent.prototype, "cuitControl", {
4058
+ // Helper para validación visual en el template
4059
+ get:
4060
+ // Helper para validación visual en el template
4061
+ /**
4062
+ * @return {?}
4063
+ */
4064
+ function () {
4065
+ return this.paymentForm.get('cuit');
4066
+ },
4067
+ enumerable: true,
4068
+ configurable: true
4069
+ });
4070
+ BankTransferComponent.decorators = [
4071
+ { type: core.Component, args: [{
4072
+ selector: 'vk-bank-transfer',
4073
+ 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",
4074
+ 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}"]
4075
+ }] }
4076
+ ];
4077
+ /** @nocollapse */
4078
+ BankTransferComponent.ctorParameters = function () { return [
4079
+ { type: BankTransferApiService }
4080
+ ]; };
4081
+ BankTransferComponent.propDecorators = {
4082
+ accessToken: [{ type: core.Input }],
4083
+ vkUrlApi: [{ type: core.Input }],
4084
+ amount: [{ type: core.Input }],
4085
+ storeId: [{ type: core.Input }],
4086
+ storeName: [{ type: core.Input }],
4087
+ checkoutId: [{ type: core.Input }],
4088
+ statusPay: [{ type: core.Output }]
4089
+ };
4090
+ return BankTransferComponent;
4091
+ }());
4092
+ if (false) {
4093
+ /** @type {?} */
4094
+ BankTransferComponent.prototype.accessToken;
4095
+ /** @type {?} */
4096
+ BankTransferComponent.prototype.vkUrlApi;
4097
+ /** @type {?} */
4098
+ BankTransferComponent.prototype.amount;
4099
+ /** @type {?} */
4100
+ BankTransferComponent.prototype.storeId;
4101
+ /** @type {?} */
4102
+ BankTransferComponent.prototype.storeName;
4103
+ /** @type {?} */
4104
+ BankTransferComponent.prototype.checkoutId;
4105
+ /** @type {?} */
4106
+ BankTransferComponent.prototype.statusPay;
4107
+ /** @type {?} */
4108
+ BankTransferComponent.prototype.paymentForm;
4109
+ /** @type {?} */
4110
+ BankTransferComponent.prototype.isLoading;
4111
+ /** @type {?} */
4112
+ BankTransferComponent.prototype.errorMessage;
4113
+ /**
4114
+ * @type {?}
4115
+ * @private
4116
+ */
4117
+ BankTransferComponent.prototype.bankTransferApi;
4118
+ }
4119
+
4120
+ /**
4121
+ * @fileoverview added by tsickle
4122
+ * Generated from: lib/bank-transfer/bank-transfer.module.ts
4123
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4124
+ */
4125
+ var BankTransferModule = /** @class */ (function () {
4126
+ function BankTransferModule() {
4127
+ }
4128
+ BankTransferModule.decorators = [
4129
+ { type: core.NgModule, args: [{
4130
+ declarations: [
4131
+ BankTransferComponent
4132
+ ],
4133
+ imports: [
4134
+ common.CommonModule,
4135
+ forms.FormsModule,
4136
+ forms.ReactiveFormsModule,
4137
+ http.HttpClientModule
4138
+ ],
4139
+ exports: [
4140
+ BankTransferComponent
4141
+ ],
4142
+ providers: [
4143
+ BankTransferApiService
4144
+ ]
4145
+ },] }
4146
+ ];
4147
+ return BankTransferModule;
4148
+ }());
4149
+
3913
4150
  /**
3914
4151
  * @fileoverview added by tsickle
3915
4152
  * Generated from: lib/vk-payments.module.ts
@@ -3921,7 +4158,8 @@
3921
4158
  SpsDecidirModule,
3922
4159
  PaypalModule,
3923
4160
  GoCuotasModule,
3924
- ModoModule
4161
+ ModoModule,
4162
+ BankTransferModule
3925
4163
  ];
3926
4164
  var VkPaymentsModule = /** @class */ (function () {
3927
4165
  function VkPaymentsModule() {
@@ -3952,6 +4190,9 @@
3952
4190
  exports.ɵn = ModoModule;
3953
4191
  exports.ɵo = ModoComponent;
3954
4192
  exports.ɵp = ModoApiService;
4193
+ exports.ɵq = BankTransferModule;
4194
+ exports.ɵr = BankTransferComponent;
4195
+ exports.ɵs = BankTransferApiService;
3955
4196
 
3956
4197
  Object.defineProperty(exports, '__esModule', { value: true });
3957
4198