Skip to content

Use verification exceptions for Zibal failures - #366

Merged
khanzadimahdi merged 2 commits into
shetabit:masterfrom
Mahmoodifar:fix/zibal-verification-exceptions
Sep 19, 2026
Merged

khanzadimahdi merged 2 commits into
shetabit:masterfrom
Mahmoodifar:fix/zibal-verification-exceptions

Conversation

@Mahmoodifar

Copy link
Copy Markdown
Contributor

Description

Throw InvalidPaymentException when Zibal verification receives a non-200 HTTP response or an unsuccessful gateway result. Preserve the existing error codes and translated messages.

Motivation and context

These paths currently throw PurchaseFailedException, so the InvalidPaymentException handler shown in the README cannot catch them. The change aligns verify() with its documented exception contract. Callers explicitly catching the old purchase exception for these verification failures will need to update their handler.

How has this been tested?

Updated the unsuccessful gateway-result regression and added an HTTP 503 regression, checking exception type, message and code. Both fail before the fix. Purchase failures and previously verified transactions retain their existing coverage.

composer ci passes on PHP 8.4.1: PHP_CodeSniffer, PHPStan and the full suite (603 tests, 2240 assertions). No live gateway requests were made.

Types of changes

  • Bug fix
  • New feature
  • Breaking change

Checklist

  • I have read the CONTRIBUTING document.
  • My pull request addresses exactly one patch/feature.
  • I have created a branch for this patch/feature.
  • Each individual commit in the pull request is meaningful.
  • I have added tests to cover my changes.
  • I have updated the changelog.

@codecov-commenter

codecov-commenter commented Sep 19, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@24c0478). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #366   +/-   ##
=========================================
  Coverage          ?   80.71%           
  Complexity        ?     1104           
=========================================
  Files             ?       66           
  Lines             ?     5662           
  Branches          ?        0           
=========================================
  Hits              ?     4570           
  Misses            ?     1092           
  Partials          ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@khanzadimahdi
khanzadimahdi merged commit 68ae732 into shetabit:master Sep 19, 2026
7 checks passed
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.

3 participants