Conversation
b85e74e to
7bb2972
Compare
| use Sylius\Component\Core\Model\PaymentMethodInterface; | ||
| use Sylius\RefundPlugin\Provider\RefundPaymentMethodsProviderInterface; | ||
|
|
||
| final class TpayAwareRefundPaymentMethodsProvider implements RefundPaymentMethodsProviderInterface |
There was a problem hiding this comment.
Why do we need this class?
There was a problem hiding this comment.
A 500 error occurs when a payment does not have a Tpay transaction ID in its details. For new, manually created Tpay orders, the refund works correctly. The class filters the refund options to only those that can be executed via Tpay. I asked about the expected behavior, and the Tpay refund option was supposed to be hidden.
| return array_values(array_filter($paymentMethods, function (PaymentMethodInterface $method): bool { | ||
| $factoryName = $method->getGatewayConfig()?->getFactoryName(); | ||
|
|
||
| return null !== $factoryName && 'tpay_redirect' !== $factoryName; |
There was a problem hiding this comment.
Why do we filter only tpay_redirect? Every Tpay payment method will cause an error here.
There was a problem hiding this comment.
Only this one gateway is added to the parameter sylius_refund.supported_gateways
AddSupportedRefundPaymentMethodPass:
/** @var array<string, mixed> $supportedGateways */
$supportedGateways = $container->getParameter(self::SUPPORTED_GATEWAYS_PARAM_NAME);
$supportedGateways[] = 'tpay_redirect';
$container->setParameter(self::SUPPORTED_GATEWAYS_PARAM_NAME, $supportedGateways);
I modified the condition to be more generic. Alternatively, I could try to use RefundDispatchEligibilityChecker here.
d2f79a3 to
52de016
Compare
52de016 to
fde0163
Compare
This PR fixes #224