Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Exception when notify url accessed directly. #66

Open
erikdemarco opened this issue Feb 5, 2022 · 1 comment
Open

Uncaught Exception when notify url accessed directly. #66

erikdemarco opened this issue Feb 5, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@erikdemarco
Copy link

When you do something like this in notify url script:

namespace Midtrans;
require_once dirname(__FILE__) . '/../Midtrans.php';
Config::$isProduction = false;
Config::$serverKey = '<your serverkey>';
$notif = new Notification();

Then this notify url accessed directly or not contained the correct format it will cause error:
"Uncaught Exception: Midtrans API is returning API error. HTTP status code: 404 API response: .... in /midtrans-php/Midtrans/ApiRequestor.php on line 167"

Isn't the correct way of handling this is returning false or returning null to $notif? So developer can easily check wheter the notification returned the correct data.

@Xaxxis Xaxxis added the enhancement New feature or request label Feb 7, 2022
@Xaxxis Xaxxis self-assigned this Feb 7, 2022
@Xaxxis
Copy link
Contributor

Xaxxis commented Feb 7, 2022

Hi @erikdemarco thank you for asking. Notification class/function helper, and Expect to accepted HTTP request POST only. Then pass through transaction_id from a POST request to status function. You can also use status to build your own notification handling.

But your feedback is valid, will put this as our backlog and implement it in the next release.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants