ngx-mercadopago
ngx-mercadopago copied to clipboard
Undefined en inicializacion de Servicio
Gabriel. Antes que nada excelente trabajo con esta lib.
Tengo 2 problemas que te los reporto.
Problema 1) Si inicializo la lIb desde app.module y pasandole al constructor (private ngxMpService: NgxMercadopagoService) + en el NgOnInit this.ngxMpService.initialize() como tenes en la documentación, me da error de undefined.
FacturaPayComponent.html:1 ERROR TypeError: Cannot read property 'getPaymentMethod' of undefined at FacturaPayComponent.getPaymentMethod (factura-pay.component.ts?1483:190) at Object.eval [as handleEvent] (VM14255 FacturaPayComponent.ngfactory.js:866) at handleEvent (core.js?f18e:43993) at callWithDebugContext (core.js?f18e:45632) at Object.debugHandleEvent [as handleEvent] (core.js?f18e:45247) at dispatchEvent (core.js?f18e:29804) at eval (core.js?f18e:31837) at SafeSubscriber.schedulerFn.__isAsync [as _next] (core.js?f18e:35379) at SafeSubscriber.__tryOrUnsub (Subscriber.js?ee8f:183) at SafeSubscriber.next (Subscriber.js?ee8f:122)
El W/A que encontré es en el component en el constructor instancio e inicializo el service desde ahà pasandole el objecto NgxMercadopagoConfiguration
this.mercadoPagoConf.publishKey = 'TEST-XXXXXXXXXXXXXX';
this.mercadoPagoConf.pathSDK = 'https://secure.mlstatic.com/sdk/javascript/v1/mercadopago.js';
this.ngxMpService = new NgxMercadopagoService(this.mercadoPagoConf);
Problema 2)
No existe en ngx-mercadopago.service.d.ts el método que solicita MercadoPago getIssuers
function getIssuers(paymentMethodId) { window.Mercadopago.getIssuers( paymentMethodId, setIssuers ); }
Desde ya gracias por esta lib.
Abrazo