Neurotech-HQ / pypesa

Python wrapper on Mpesa public API for mobile Payment Integration
https://kalebu.github.io/python-pesa/
MIT License
32 stars 10 forks source link

Payment Reversal raise MpesaConnectionError #2

Closed Kalebu closed 2 years ago

Kalebu commented 3 years ago

When try to reverse a transaction or a particular TransactionID, connection to the openapi portal timeout and raises the Mpesa Connection Error

Here is the sample of the error message;

    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='openapi.m-pesa.com', port=433): Max retries exceeded with url: /sandbox/ipg/v2/vodacomTZN/reversal/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f51f410f2e0>: Failed to establish a new connection: [Errno 111] Connection refused'))
SentinelWarren commented 2 years ago

@Kalebu, this error occurs due to the incorrect port number (port=433), it should be (port=443).

PS: i have fixed the issue in the pull request i sent. In the service_urls module, i have refactored the DRY violation, where all url instances for both Sandbox & Production classes now have a base_url instance.

Kalebu commented 2 years ago

Hi @SentinelWarren

Thank you again, for taking your time to contribute I highly appreciate

I can now close the issue

Best regards Kalebu