Skip to content

Integrate with Sylius/RefundPlugin for partial refunds #104

Description

@loevgaard

Answers the oldest ask in this tracker — #27 (2021) requested partial refunds — and the timing is finally right: payum-quickpay gained refund_amount/capture_amount support in 2.0.0-alpha.2.

The integration contract (standardized across gateway plugins)

Verified against RefundPlugin source and four real integrations (Sylius/AdyenPlugin, Sylius/MolliePlugin, payplug/SyliusPayPlugPlugin, hipay/hipay-payments-sylius):

  1. Whitelist the gateway: add quickpay to the sylius_refund.supported_gateways container parameter (defaults to offline only) — RefundPlugin's SupportedRefundPaymentMethodsProvider filters by gateway factory name, so without this the refund UI never offers Quickpay payment methods.
  2. Handle the event: a Messenger handler on Sylius\RefundPlugin\Event\RefundPaymentGenerated (carries the refunded amount, currencyCode, and the related paymentId) that guards for Quickpay methods and executes the gateway refund with that amount.
  3. Complete the RefundPayment: apply complete on the sylius_refund_refund_payment graph via RefundPaymentCompletedStateApplier. Quickpay refund operations are confirmed by callback, so completion should follow the Adyen model (complete when the gateway confirms) rather than Mollie's immediate auto-complete.

Details worth copying

  • Adyen's manual-complete guard: FilterManualRefundConfirmationSubscriber rejects the manual sylius_refund_refund_payment.complete transition for its methods, so only a gateway-confirmed refund completes — cheap correctness guarantee.
  • Mollie's optionality: sylius/refund-plugin in suggest (not require) with the whole integration behind a conditional config import (config/integration/refund-plugin/), so shops without RefundPlugin are unaffected.

Tasks

  • Optional-dependency wiring (suggest + conditional service registration when RefundPlugin is installed)
  • supported_gateways parameter, RefundPaymentGenerated handler, callback-driven completion
  • Reconcile with the existing full-refund path in PaymentProcessor (avoid double refunds when both mechanisms are active)
  • README section + note in UPGRADE-2.0.md; closes Partial refund (and capture) #27's ask on the refund half

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions