|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Sebdesign\VivaPayments\Responses; |
|
4
|
|
|
|
|
5
|
|
|
use Sebdesign\VivaPayments\Enums\TransactionStatus; |
|
6
|
|
|
use Sebdesign\VivaPayments\Enums\TransactionType; |
|
7
|
|
|
|
|
8
|
|
|
class Transaction |
|
9
|
|
|
{ |
|
10
|
1 |
|
public function __construct( |
|
11
|
|
|
public readonly string $email, |
|
12
|
|
|
public readonly int $amount, |
|
13
|
|
|
public readonly string $orderCode, |
|
14
|
|
|
public readonly TransactionStatus $statusId, |
|
15
|
|
|
public readonly string $fullName, |
|
16
|
|
|
public readonly string $insDate, |
|
17
|
|
|
public readonly string $cardNumber, |
|
18
|
|
|
public readonly string $currencyCode, |
|
19
|
|
|
public readonly string $customerTrns, |
|
20
|
|
|
public readonly string $merchantTrns, |
|
21
|
|
|
public readonly TransactionType $transactionTypeId, |
|
22
|
|
|
public readonly bool $recurringSupport, |
|
23
|
|
|
public readonly int $totalInstallments, |
|
24
|
|
|
public readonly ?string $cardCountryCode, |
|
25
|
|
|
public readonly ?string $cardIssuingBank, |
|
26
|
|
|
public readonly int $currentInstallment, |
|
27
|
|
|
public readonly string $cardUniqueReference, |
|
28
|
|
|
public readonly int $cardTypeId, |
|
29
|
|
|
public readonly ?int $digitalWalletId = null, |
|
30
|
|
|
) { |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** @phpstan-param TransactionArray $attributes */ |
|
34
|
3 |
|
public static function create(array $attributes): self |
|
35
|
|
|
{ |
|
36
|
3 |
|
return new self(...[ |
|
|
|
|
|
|
37
|
|
|
...$attributes, |
|
38
|
3 |
|
'statusId' => TransactionStatus::from($attributes['statusId']), |
|
39
|
3 |
|
'transactionTypeId' => TransactionType::from($attributes['transactionTypeId']), |
|
40
|
|
|
]); |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|