[Bug] Provider\RemainingTotalProvider meant to work by ShipmentRefund, but in practice works by shipment Adjustment #286
Labels
DX
Issues and PRs aimed at improving Developer eXperience.
Enhancement
Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Provider\RemainingTotalProvider
is used to get available amount for refund for bothOrderItemUnitRefund
andShipmentRefund
.That's the theory, in practice
Validator\RefundAmountValidator
expects to be working withModel\ShipmentRefund
, which is correct, but order refund page_shipping.html.twig
works with shipping Adjustments which is incorrect and source codes ofProvider\RemainingTotalProvider
were hacked for UI benefit.So problem is
public function getTotalLeftToRefund(int $id, RefundType $type): int
expects one kind of$id
and gets totally another and underling code was hacked to support adjustments usage.Maybe this was conscious decision due to shipment and adjustments not being related in prior 1.9, but it should have been handled explicitly in such case.
Solution is to refactor UI to work with shipments directly.
Personally I've encountered this at non-standard use-case, while loading historical data in DB, so there might be no active bugs with standard usage.
The text was updated successfully, but these errors were encountered: