Unit tests + connected codebase fixes#14
Conversation
…hods wich call API's endpoints
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
There was a problem hiding this comment.
Pull request overview
Adds/updates unit tests while aligning gateway implementations and shared error handling to match real provider API formats and improve exception details surfaced to callers.
Changes:
- Update Stripe gateway to send form-encoded requests (and adjust tests accordingly), including capture method serialization.
- Improve cross-gateway error parsing in
AbstractGateway, and extend exceptions to carry structureddetails. - Adjust Robokassa request format/logging and add tests asserting richer error reporting; add sandbox-support annotations across gateways.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Gateways/YooKassaGatewayTest.php | Adds a basic create-customer test and aligns expected currency casing. |
| tests/Gateways/StripeGatewayTest.php | Verifies Stripe requests are form-encoded with expected fields/headers. |
| tests/Gateways/StripeGatewayCaptureMethodTest.php | Parses form body to assert capture_method without JSON decoding. |
| tests/Gateways/RobokassaGatewayTest.php | Strengthens assertions for request format and error detail propagation. |
| tests/Gateways/PayPalGatewayTest.php | Updates refund call shape to use params array. |
| src/Models/PaymentIntent.php | Normalizes capture_method parsing from string values into the model’s boolean representation. |
| src/Gateways/YooKassaGateway.php | Adds sandbox-support annotations; minor behavior documentation for unsupported ops. |
| src/Gateways/StripeGateway.php | Implements form-urlencoded request building and serializes capture method correctly for Stripe. |
| src/Gateways/RobokassaGateway.php | Sends JWT as JSON string, adds logging, improves error extraction, and adds sandbox-support annotations. |
| src/Gateways/PayPalGateway.php | Adds sandbox-support annotations and updates some method docs/formatting. |
| src/Gateways/AbstractGateway.php | Enhances error extraction and attaches raw response details to exceptions. |
| src/Exceptions/PaymentException.php | Adds a details payload to carry structured context. |
| src/Exceptions/InvalidRequestException.php | Plumbs details through to the base exception. |
Comments suppressed due to low confidence (1)
src/Gateways/RobokassaGateway.php:403
PaymentExceptionconstructor now includes?array $detailsbefore$code. Passing500as the 6th argument will cause aTypeError. Providedetails(ornull) as the 6th argument and move the HTTP status to the$codeparameter.
if ($this->password3 === null || $this->password3 === '') {
throw new PaymentException(
'Robokassa Refund API v2 requires Password#3 to be configured.',
'robokassa_password3_required',
'robokassa',
null,
null,
500
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.