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
20 changes: 20 additions & 0 deletions src/Models/Payments/RefundOperation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Helloasso\Models\Payments;

use Helloasso\Models\Common\MetaModel;
use Helloasso\Models\HelloassoObject;

final readonly class RefundOperation implements HelloassoObject
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

took inspiration from Helloasso\Models\Payments\Refund to set that model final + readonly + public props, as I'm not sure if I should use getter/setter and/or move the class in another folder

{
public function __construct(
public int $id,
public int $amount,
public int $amountTip,
public RefundState $status,
public MetaModel $meta,
) {
}
}
24 changes: 24 additions & 0 deletions src/Models/Statistics/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Helloasso\Enums\PaymentType;
use Helloasso\Models\Common\MetaModel;
use Helloasso\Models\HelloassoObject;
use Helloasso\Models\Payments\RefundOperation;

class Payment implements HelloassoObject
{
Expand All @@ -36,6 +37,11 @@ class Payment implements HelloassoObject
private MetaModel $meta;
private PaymentOffLineMeansModel $paymentOffLineMean;

/**
* @var array<RefundOperation>
*/
private array $refundOperations;

public function getOrder(): OrderLight
{
return $this->order;
Expand Down Expand Up @@ -233,4 +239,22 @@ public function setPaymentOffLineMean(PaymentOffLineMeansModel $paymentOffLineMe

return $this;
}

/**
* @return RefundOperation[]
*/
public function getRefundOperations(): array
{
return $this->refundOperations;
}

/**
* @param RefundOperation[] $refundOperations
*/
public function setRefundOperations(array $refundOperations): self
{
$this->refundOperations = $refundOperations;

return $this;
}
}