Sylius / Sylius/RefundPlugin

Trigger "partially_refund" order payment transition on each partial refund

Open
#347 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
PHP
Stars
73
Forks
76
PR merge metrics
No merged PRs in 30d

Description

Hi,

According to code lines below, "partially_refund" transition is not triggered on order payment state if that state is already on "partially_refund".

https://github.com/Sylius/RefundPlugin/blob/518ba6ed962973e02a4c19964866a21e442516f9/src/StateResolver/OrderPartiallyRefundedStateResolver.php#L50-L56

I think it's a mistake.
sylius_order_payment state machine allow transition from "partially_refund" to "partially_refund". So why not playing transition on a new partial refund ?

Rather than checking current order payment state, you should use if( $stateMachine->can( OrderPaymentTransitions::TRANSITION_PARTIALLY_REFUND ) ) before applying.

What do you think about ?

Thanks a lot ;-)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/StateResolver/OrderPartiallyRefundedStateResolver.php lines 50-56 and inspect how the order payment state is checked before applying the transition. Confirm that a new partial refund triggers the partially_refund transition when the state machine permits it, including when the current state is already partially_refund.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
payments
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.