allansifuna / Flask-Mpesa

Flask-Mpesa provides a simple intergration for flask Applications with Mpesa Daraja API.
https://developer.safaricom.co.ke/docs
MIT License
16 stars 10 forks source link

Bug in serializing encoded password (business_shortcode+ passcode+ time) in Mpesa Express stk_push #2

Closed GrishonNganga closed 4 years ago

GrishonNganga commented 4 years ago

First of all. Good stuff with this library. It is very well written and documented.

So. I encountered this problem where I had passed everything as expected to use the Mpesa express stkpush. But I kept getting this error.

stk

After a very long time I discovered that the encoded password was a byte and could not be serialized so as to be passed in the requested body.

This is a screenshot of a segment of the class before I refactored it.

stk_before

And after.

stk_after

Decoding the password to a string worked for me and everything else was seamless.

I am not sure if it is an isolated case for me or for others as well, so I thought I'd raise this issue.

allansifuna commented 4 years ago

Thank you Mr.Gitonga for reaching out, am sure to fix the bug as soon as possible.

On Thu, Oct 15, 2020, 18:40 Grishon Nganga notifications@github.com wrote:

First of all. Good stuff with this library. It is very well written and documented.

So. I encountered this problem where I had passed everything as expected to use the Mpesa express stkpush. But I kept getting this error.

[image: stk] https://user-images.githubusercontent.com/52824774/96151796-7fa1ba00-0f14-11eb-9ea2-ecdbb22453f1.PNG

After a very long time I discovered that the encoded password was a byte and could not be serialized so as to be passed in the requested body.

This is a screenshot of a segment of the class before I refactored it.

[image: stk_before] https://user-images.githubusercontent.com/52824774/96152462-3e5dda00-0f15-11eb-8e01-f1b6fb62a69c.PNG

And after.

[image: stk_after] https://user-images.githubusercontent.com/52824774/96152506-4a499c00-0f15-11eb-8829-b1d52ec094c5.PNG

Decoding the password to a string worked for me and everything else was seamless.

I am not sure if it is an isolated case for me or for others as well, so I thought I'd raise this issue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/allansifuna/Flask-Mpesa/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMY5JT4Y2UMVPE5DICK5FDSK4JWHANCNFSM4SSFEVMQ .