Repository navigation
PRE-3715: Allow Oney refunds based on the PayPlug API refund window - #336
Open
hdelaforce-payplug wants to merge 4 commits into
Open
hdelaforce-payplug wants to merge 4 commits into
hdelaforce-payplug wants to merge 4 commits into
Conversation
hdelaforce-payplug
force-pushed
the
feature/PRE-3715_remove-oney-48h-refund-delay
branch
from
October 8, 2026 15:52
e54438b to
a311322
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hdelaforce-payplug
force-pushed
the
feature/PRE-3715_remove-oney-48h-refund-delay
branch
from
October 8, 2026 16:09
a311322 to
d239231
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Oney refunds are no longer held back by a hardcoded 48h delay. The refund window returned by the PayPlug API (
refundable_after/refundable_until) is now the only rule, which matches the PrestaShop and WooCommerce plugins.RefundPaymentGeneratedHandlerblocked a refund for 48h after the last payment and after the last processed refund, so successive partial refunds were blocked too. The private checks, the now-unused$orderRepository/$translatorconstructor arguments andOneyGatewayFactory::REFUND_WAIT_TIME_IN_HOURSare gone.RefundUnitsCommandCreatorDecorator::canOneyRefundBeMade()is now the single local check, run on the admin refund form before the refund is dispatched:now < refundable_after, with "The Oney refund will only be possible from %date%."now > refundable_until, with "The Oney refund period ended on %date%…"nullbound means no restriction on that side. Before, it raised an undefined-property warning and showed the misleading 48h message. The PayPlug API stays the final authority and still rejects an out-of-window refund, with nothing recorded locally.%date%is formatted withIntlDateFormatter(medium date, short time) in the translator locale and the PHP default timezone.ui.oney_transaction_less_than_forty_eight_hoursis replaced byui.oney_refund_not_available_beforeandui.oney_refund_period_expired.HttpResponseProviderInterface::supports()/getResponse()fromRequestConfigurationtoRequest, soCaptureHttpResponseProviderfailed PHPStan and would fatal at class load on 2.3. The parameter is widened toRequest|RequestConfiguration, which is valid against both interface versions. Sylius 2.2 stays supported, the parameter is unused, and there is no behaviour change. The otherUPGRADE-2.3.mditems were checked and none of them affect the plugin.Motivation: merchants had to wait an arbitrary 48h before refunding an Oney order, and again 48h between two partial refunds, even when the API already allowed the refund.
composer.jsonallowssylius/sylius: ^2.0, so a merchant on Sylius 2.3 would also have hit the provider signature break.Related issue(s): PRE-3715. Possibly related to PRE-3710 (multi-line Oney refund error), but not claimed as fixed: see Notes for reviewer.
Type of Change
Checklist
Code Quality
Testing
sonarcloudCI jobSecurity & Ops
Notes for reviewer
Breaking changes. All of these are documented in the CHANGELOG
2.0.0"Breaking changes for anyone extending the plugin" table. 2.0.0 is still unreleased.OneyGatewayFactory::REFUND_WAIT_TIME_IN_HOURSis removed, not deprecated. The class isfinaland nothing reads the constant any more.ui.oney_transaction_less_than_forty_eight_hoursis removed. It is replaced by the two new keys, which take a%date%parameter.RefundPaymentGeneratedHandler::__construct()drops$orderRepositoryand$translator. The class isfinaland container-built.The behaviour change is intended: a refund that was blocked for less than 48h is now allowed whenever the API allows it.
Testing.
New tests:
tests/PHPUnit/Creator/RefundUnitsCommandCreatorDecoratorTest.php(16 tests) covers:refundable_afterboundary;tests/PHPUnit/MessageHandler/RefundPaymentGeneratedHandlerTest.php: an Oney refund on a just-created payment reaches the API, and an API refusal records nothing.CaptureHttpResponseProviderTestruns every case with both aRequest(2.3) and aRequestConfiguration(2.2), plus a reflection guard on the union type.Not run:
Lakion\Behat\MinkDebugExtensionnot found). The four 48h scenarios infeatures/admin/refunding_oney_payment.featurewere replaced by window-based ones, and the context, mocker andui.xmlwere updated, but they were never executed. The date assertions assume an English admin locale.refundable_afterafter a first partial refund. If it does, successive refunds stay blocked by the API, now with an accurate date. That is why PRE-3710 is not claimed as fixed.Unticked checklist items:
PayPlugApiClient::retrieve()(timeout, 404) in the decorator still surfaces as an admin 500, as before. It is out of scope for this story and a possible follow-up.Scope notes:
refundpayment transition and refunds made from the PayPlug portal never had a local Oney check, and that is unchanged.RefundHistoryRepositoryInterface::findLastProcessedRefundForPayment()no longer has a caller. It is kept on purpose because it is on a public interface.Request|RequestConfigurationunion is a bridge. Narrow it toRequestonce Sylius 2.2 support is dropped.Changelog:
CHANGELOG.md2.0.0, with entries under Changed, Removed and Fixed, plus three rows in the BC table.