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

Refactor digipay gateway #228

Merged
merged 2 commits into from
Mar 9, 2024

Conversation

alissn
Copy link
Contributor

@alissn alissn commented Mar 5, 2024

Description

Hi,

This PR refactors the Digipay gateway to the new version of the API. It includes the following changes:

  • Changed apiPaymentUrl. Reference: 2.1. Address.
  • Deleted apiPaymentUrl. the purchase method to return redirectUrl, which the user should redirect to. Reference: 2.5. Response fields.
  • Fixed DocBlock of the client properties.
  • Changed the hard-coded key of Guzzle with a constant from the \GuzzleHttp\RequestOptions class.
  • In the verify method, pass type value from request to api url.
  • Added all returned data from the gateway to the Receipt class. Reference: purchase_verify.

If further description is needed, feel free to ask!

Documents

Official Document
Persian PDF version

@khanzadimahdi
Copy link
Member

@alissn have you tested these changes? I mean, you should have done a successful payment before merging this PR.

@alissn
Copy link
Contributor Author

alissn commented Mar 7, 2024

@alissn, have you tested these changes? I mean, you should have completed a successful payment before merging this PR.

In our project, we required the use this gateway but old version was not work. All responses returned the following error:

{
    "result": {
        "title": "FAILURE",
        "status": 1000,
        "message": "عملیات ناموفق بود لطفا مجددا تلاش کنید",
        "level": "BLOCKER"
    }
}

After discussing with the Digipay technical team, updating this driver became necessary.

For successful payment testing, we could only test on the staging service using this URL https://uatweb.mydigipay.info/. Obtaining a token, creating a ticket, and redirecting and verifying the purchase worked very well.

@khanzadimahdi khanzadimahdi merged commit 1d28087 into shetabit:master Mar 9, 2024
2 checks passed
]
);

$body = json_decode($response->getBody()->getContents(), true);
if ($response->getStatusCode() != 200) {
// error has happened
$message = $body['result']['message'] ?? 'خطا در هنگام درخواست برای پرداخت رخ داده است.';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

None yet

2 participants