Skip to content

PRE-3361: Add get transaction tool#22

Merged
jhoaraupp merged 1 commit into
developfrom
feature/PRE-3361
Jul 3, 2026
Merged

PRE-3361: Add get transaction tool#22
jhoaraupp merged 1 commit into
developfrom
feature/PRE-3361

Conversation

@jhoaraupp

@jhoaraupp jhoaraupp commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

PRE-3361: Add get transaction tool

Related Issue

Ticket: PRE-3361

Type of Change

[ ] 🐛 Bug fix
[x] ✨ New feature
[ ] 💥 Breaking change
[ ] ♻️ Refactor
[ ] 🔧 Configuration / CI
[ ] 🚀 Release (release/* branch targeting master)
[ ] 📦 Dependency update
[ ] 🔒 Security fix
[ ] 📝 Documentation update


✅ Quality Checklist

Local Environment & Hooks

  • Local Git hooks (CaptainHook) are installed and executed cleanly.
  • Commit messages strictly follow the (PRE|SMP)-XXXX: description pattern.
  • Core configuration files (phpstan.neon / .php-cs-fixer.php) were generated successfully from .dist templates.

Testing & Code Quality

  • Coding style rules have been applied locally (composer cs:fix).
  • Static analysis checks pass with no new regressions (vendor/bin/phpstan).
  • I have added/updated unit or integration tests if applicable.
  • I have verified these changes locally on a native PrestaShop environment.

CI/CD Deployment Context

  • The CI pipeline passes fully on GitHub.
  • For Release Branches: If this is a release/* branch, I am targeting the correct base branch to allow the automated apply-release version bumping job to run.

Screenshots (if applicable)

Notes for Reviewer

Copilot AI review requested due to automatic review settings June 29, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “retrieve payment/transaction” capability to the MCP core (PaymentAction::retrieveAction()), backed by a new API wrapper method, and covered by unit + integration tests.

Changes:

  • Add PaymentAction::retrieveAction() to retrieve a payment by resource ID and return a PaymentOutputDTO.
  • Add Api::retrievePaymentResource() wrapper around Payplug\Payment::retrieve().
  • Add unit/integration tests for the new retrieve flow; update CaptainHook CS Fixer config reference.

1. What's Good

  • The new Api::retrievePaymentResource() mirrors the existing createPaymentResource() / refundPaymentResource() response shape, which keeps DTO hydration consistent.
  • Unit and integration coverage is added for both success and failure paths of the retrieve flow.
  • CaptainHook’s php-cs-fixer config now matches the Composer scripts’ --config=.php-cs-fixer.dist.php.

2. Summary table

Dimension Rating
Security ✅ Fine
Correctness ⚠️ Low (new stub file missing strict_types)
Performance ✅ Fine
Maintainability ⚠️ Medium (stub file appears unreferenced by tooling)

3. Closing one-liner

Add declare(strict_types=1); to the new stub and either wire the stub into PHPStan/tooling or remove it to avoid carrying unused files.


4. Individual findings (one section per issue)

Heading: Correctness ⚠️ Low

Subtitle (bold): Missing declare(strict_types=1) in new PHP file (stubs/PayplugPayment.stub:1)

Code block:

<?php

namespace Payplug\Resource;

Explanation paragraph: This repository consistently uses declare(strict_types=1); at the top of PHP files. Omitting it is a correctness inconsistency and can cause different coercion behavior if the file is ever executed/loaded (even if it’s “just a stub”).

Fix: Add declare(strict_types=1); after the opening tag.

<?php

declare(strict_types=1);

namespace Payplug\Resource;

Heading: Maintainability ⚠️ Medium

Subtitle (bold): Stub file likely unused (not referenced by PHPStan/autoload) (stubs/PayplugPayment.stub:1)

Code block:

<?php

namespace Payplug\Resource;

class Payment
{

Explanation paragraph: The new stub doesn’t appear to be referenced by Composer autoload/autoload-dev, and phpstan.neon doesn’t list it under parameters.stubFiles. As a result, it likely has no effect on static analysis/typing and becomes extra maintenance surface.

Fix: Either (a) wire it into the intended tool (e.g., PHPStan stubFiles), or (b) remove the stub if it’s not needed.

# phpstan.neon
parameters:
    stubFiles:
        - stubs/PayplugPayment.stub

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Units/Actions/PaymentAction/retrieveActionTest.php Adds unit coverage for PaymentAction::retrieveAction() behavior (load failure, retrieve failure, success).
tests/Integration/PaymentAction/retrieveActionTest.php Adds integration coverage around Payplug static retrieve() behavior (exception vs success).
stubs/PayplugPayment.stub Introduces a Payment resource stub (currently missing strict types + appears unreferenced).
src/Utilities/Services/Api.php Adds retrievePaymentResource() wrapper returning the standard response array shape.
src/Actions/PaymentAction.php Adds retrieveAction() public entry point returning PaymentOutputDTO.
captainhook.json Aligns php-cs-fixer hook config with .php-cs-fixer.dist.php.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread src/Validators/PaymentResourceValidator.php

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@jhoaraupp jhoaraupp merged commit dcb2453 into develop Jul 3, 2026
8 checks passed
@jhoaraupp jhoaraupp deleted the feature/PRE-3361 branch July 3, 2026 12:35
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.

4 participants