Skip to content

Commit

Permalink
[Billing] Add refund supermapped class
Browse files Browse the repository at this point in the history
  • Loading branch information
that-guy-iain committed Dec 27, 2024
1 parent 14eda6a commit 5d3e6ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Parthenon/Billing/Refund/RefundManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use Parthenon\Billing\Enum\RefundStatus;
use Parthenon\Billing\Event\RefundCreated;
use Parthenon\Billing\Exception\RefundLimitExceededException;
use Parthenon\Billing\Factory\EntityFactoryInterface;
use Parthenon\Billing\Repository\PaymentRepositoryInterface;
use Parthenon\Billing\Repository\RefundRepositoryInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand All @@ -45,6 +46,7 @@ public function __construct(
private PaymentRepositoryInterface $paymentRepository,
private RefundRepositoryInterface $refundRepository,
private EventDispatcherInterface $dispatcher,
private EntityFactoryInterface $entityFactory,
) {
}

Expand Down Expand Up @@ -118,7 +120,7 @@ protected function createEntityRecord(\Obol\Model\Refund $refund, ?BillingAdminI
$payment->setStatus(PaymentStatus::PARTIALLY_REFUNDED);
}
$this->paymentRepository->save($payment);
$refundEn = new Refund();
$refundEn = $this->entityFactory->getRefundEntity();
$refundEn->setAmount($refund->getAmount());
$refundEn->setCurrency(strtoupper($refund->getCurrency()));
$refundEn->setExternalReference($refund->getId());
Expand Down
1 change: 1 addition & 0 deletions src/Parthenon/Resources/config/services/billing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
<argument type="service" id="Parthenon\Billing\Repository\PaymentRepositoryInterface" />
<argument type="service" id="Parthenon\Billing\Repository\RefundRepositoryInterface" />
<argument type="service" id="Symfony\Component\EventDispatcher\EventDispatcherInterface" />
<argument type="service" id="Parthenon\Billing\Factory\EntityFactoryInterface" />
</service>
<service id="Parthenon\Billing\Refund\RefundManagerInterface" alias="Parthenon\Billing\Refund\RefundManager" />

Expand Down

0 comments on commit 5d3e6ec

Please sign in to comment.