paymentsds / mpesa-js-sdk

A JavaScript library aiming to help developers integrating their products with M-Pesa Platform
Apache License 2.0
62 stars 27 forks source link

TypeError: Cannot read property 'config' of undefined #38

Closed eltonlaice closed 4 years ago

eltonlaice commented 4 years ago

Code:

`import { Client } from '@paymentsds/mpesa'

const client = new Client({ apiKey: '', // API Key publicKey: '', // Public Key serviceProviderCode: '' // input_ServiceProviderCode });

const paymentData = { from: '841234567', // input_CustomerMSISDN reference: '11114', // input_ThirdPartyReference transation: 'T12344CC', // input_TransactionReference amount: '10' // input_Amount };

client.receive(paymentData).then(r => { // Handle success scenario }).catch(e =>{ // Handle success scenario });`

Error console:

 TypeError: Cannot read property 'config' of undefined
  at map (file:///home/elton/Documents/paymentsds/mpesa-js-sdk/src/service.js:110:53)
  at Service.fillOptionalProperties (file:///home/elton/Documents/paymentsds/mpesa-js-sdk/src/service.js:125:16)
  at Service.handleRequest (file:///home/elton/Documents/paymentsds/mpesa-js-sdk/src/service.js:54:23)
  at Service.handleSend (file:///home/elton/Documents/paymentsds/mpesa-js-sdk/src/service.js:38:17)
  at Client.send (file:///home/elton/Documents/paymentsds/mpesa-js-sdk/src/client.js:9:25)
  at Context.<anonymous> (file:///home/elton/Documents/paymentsds/mpesa-js-sdk/test/client.js:39:16)
  at processImmediate (internal/timers.js:458:21)
edsonmichaque commented 4 years ago

@eltonlaice, watch #39 pull request, there is a good interaction about this issue there