1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Shoman4eg\Nalog\Model\Income; |
5
|
|
|
|
6
|
|
|
use Shoman4eg\Nalog\Model\CreatableFromArray; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @author Artem Dubinin <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
final class IncomeInfoType implements CreatableFromArray |
12
|
|
|
{ |
13
|
|
|
private string $approvedReceiptUuid; |
14
|
|
|
private string $name; |
15
|
|
|
private \DateTimeImmutable $operationTime; |
16
|
|
|
private \DateTimeImmutable $requestTime; |
17
|
|
|
private string $paymentType; |
18
|
|
|
private ?string $partnerCode; |
19
|
|
|
private float $totalAmount; |
20
|
|
|
private CancellationInfoType $cancellationInfo; |
21
|
|
|
private string $sourceDeviceId; |
22
|
|
|
|
23
|
|
|
private function __construct() {} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @throws \Exception |
27
|
|
|
*/ |
28
|
|
|
public static function createFromArray(array $data): self |
29
|
|
|
{ |
30
|
|
|
$model = new self(); |
31
|
|
|
$data = $data['incomeInfo']; |
32
|
|
|
|
33
|
|
|
$model->approvedReceiptUuid = $data['approvedReceiptUuid']; |
34
|
|
|
$model->name = $data['name']; |
35
|
|
|
$model->operationTime = new \DateTimeImmutable($data['operationTime']); |
36
|
|
|
$model->requestTime = new \DateTimeImmutable($data['requestTime']); |
37
|
|
|
$model->paymentType = $data['paymentType']; |
38
|
|
|
$model->partnerCode = $data['partnerCode']; |
39
|
|
|
$model->totalAmount = $data['totalAmount']; |
40
|
|
|
$model->cancellationInfo = CancellationInfoType::createFromArray($data['cancellationInfo']); |
41
|
|
|
$model->sourceDeviceId = $data['sourceDeviceId']; |
42
|
|
|
|
43
|
|
|
return $model; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getApprovedReceiptUuid(): string |
47
|
|
|
{ |
48
|
|
|
return $this->approvedReceiptUuid; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getName(): string |
52
|
|
|
{ |
53
|
|
|
return $this->name; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function getOperationTime(): \DateTimeImmutable |
57
|
|
|
{ |
58
|
|
|
return $this->operationTime; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getRequestTime(): \DateTimeImmutable |
62
|
|
|
{ |
63
|
|
|
return $this->requestTime; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function getPaymentType(): string |
67
|
|
|
{ |
68
|
|
|
return $this->paymentType; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function getPartnerCode(): ?string |
72
|
|
|
{ |
73
|
|
|
return $this->partnerCode; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function getTotalAmount(): float |
77
|
|
|
{ |
78
|
|
|
return $this->totalAmount; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function getCancellationInfo(): CancellationInfoType |
82
|
|
|
{ |
83
|
|
|
return $this->cancellationInfo; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function getSourceDeviceId(): string |
87
|
|
|
{ |
88
|
|
|
return $this->sourceDeviceId; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|