Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/PaymentProcessing/RefundPaymentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use PayPlug\SyliusPayPlugPlugin\Gateway\BancontactGatewayFactory;
use PayPlug\SyliusPayPlugPlugin\Gateway\OneyGatewayFactory;
use PayPlug\SyliusPayPlugPlugin\Gateway\PayPlugGatewayFactory;
use PayPlug\SyliusPayPlugPlugin\Gateway\ScalapayGatewayFactory;
use PayPlug\SyliusPayPlugPlugin\Repository\RefundHistoryRepositoryInterface;
use Psr\Log\LoggerInterface;
use Sylius\Component\Core\Model\PaymentInterface;
Expand Down Expand Up @@ -124,6 +125,7 @@ private function prepare(PaymentInterface $payment): void
BancontactGatewayFactory::FACTORY_NAME,
ApplePayGatewayFactory::FACTORY_NAME,
AmericanExpressGatewayFactory::FACTORY_NAME,
ScalapayGatewayFactory::FACTORY_NAME,
], true)
) {
return;
Expand Down
19 changes: 19 additions & 0 deletions tests/PHPUnit/PaymentProcessing/RefundPaymentProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PayPlug\SyliusPayPlugPlugin\ApiClient\PayPlugApiClientInterface;
use PayPlug\SyliusPayPlugPlugin\Entity\RefundHistory;
use PayPlug\SyliusPayPlugPlugin\Gateway\PayPlugGatewayFactory;
use PayPlug\SyliusPayPlugPlugin\Gateway\ScalapayGatewayFactory;
use PayPlug\SyliusPayPlugPlugin\PaymentProcessing\RefundPaymentProcessor;
use PayPlug\SyliusPayPlugPlugin\Repository\RefundHistoryRepositoryInterface;
use PHPUnit\Framework\MockObject\MockObject;
Expand Down Expand Up @@ -81,6 +82,24 @@ public function testProcess_fullRefundSuccess_callsApiRefund(): void
$this->processor->process($payment);
}

// -------------------------------------------------------------------------
// process() — Scalapay gateway → refund is processed
// -------------------------------------------------------------------------

/**
* Calls process() with a Scalapay payment; verifies the API client factory is invoked
* and refundPayment() is called, confirming Scalapay is included in the supported gateway list.
*/
public function testProcess_scalapayGateway_callsApiRefund(): void
{
$payment = $this->buildPayment(ScalapayGatewayFactory::FACTORY_NAME, ['payment_id' => 'pay_scalapay']);

$this->apiClientFactory->expects(self::once())->method('createForPaymentMethod');
Comment thread
adumont-payplug marked this conversation as resolved.
$this->apiClient->expects(self::once())->method('refundPayment')->with('pay_scalapay');

$this->processor->process($payment);
}

// -------------------------------------------------------------------------
// process() — API exception → UpdateHandlingException
// -------------------------------------------------------------------------
Expand Down