Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion spec/Event/RefundPaymentGeneratedSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ final class RefundPaymentGeneratedSpec extends ObjectBehavior
{
function it_represents_an_immutable_fact_that_refund_payment_has_been_generated(): void
{
$this->beConstructedWith(1, '000222', 10000, 'GBP', 2);
$this->beConstructedWith(1, '000222', 10000, 'GBP', 2, 3);

$this->id()->shouldReturn(1);
$this->orderNumber()->shouldReturn('000222');
$this->amount()->shouldReturn(10000);
$this->currencyCode()->shouldReturn('GBP');
$this->paymentMethodId()->shouldReturn(2);
$this->paymentId()->shouldReturn(3);
}
}
19 changes: 17 additions & 2 deletions src/Event/RefundPaymentGenerated.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ final class RefundPaymentGenerated
/** @var int */
private $paymentMethodId;

public function __construct(int $id, string $orderNumber, int $amount, string $currencyCode, int $paymentMethodId)
{
/** @var int */
private $paymentId;

public function __construct(
int $id,
string $orderNumber,
int $amount,
string $currencyCode,
int $paymentMethodId,
int $paymentId
) {
$this->id = $id;
$this->orderNumber = $orderNumber;
$this->amount = $amount;
$this->currencyCode = $currencyCode;
$this->paymentMethodId = $paymentMethodId;
$this->paymentId = $paymentId;
}

public function id(): int
Expand All @@ -54,4 +64,9 @@ public function paymentMethodId(): int
{
return $this->paymentMethodId;
}

public function paymentId(): int
{
return $this->paymentId;
}
}
3 changes: 2 additions & 1 deletion src/ProcessManager/RefundPaymentProcessManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public function __invoke(UnitsRefunded $event): void
$event->orderNumber(),
$event->amount(),
$event->currencyCode(),
$event->paymentMethodId()
$event->paymentMethodId(),
1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is currently hardcoded like this to support single-payment orders?

));

$this->orderFullyRefundedStateResolver->resolve($event->orderNumber());
Expand Down