1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This software may be modified and distributed under the terms |
7
|
|
|
* of the MIT license. See the LICENSE file for details. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Shapin\Stripe\Model\Transfer; |
11
|
|
|
|
12
|
|
|
use Money\Currency; |
13
|
|
|
use Money\Money; |
14
|
|
|
use Shapin\Stripe\Model\ContainsMetadata; |
15
|
|
|
use Shapin\Stripe\Model\CreatableFromArray; |
16
|
|
|
use Shapin\Stripe\Model\MetadataCollection; |
17
|
|
|
use Shapin\Stripe\Model\MetadataTrait; |
18
|
|
|
|
19
|
|
|
final class TransferReversal implements CreatableFromArray, ContainsMetadata |
20
|
|
|
{ |
21
|
|
|
use MetadataTrait; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
private $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var Money |
30
|
|
|
*/ |
31
|
|
|
private $amount; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
private $balanceTransaction; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var \DateTimeImmutable |
40
|
|
|
*/ |
41
|
|
|
private $createdAt; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var Currency |
45
|
|
|
*/ |
46
|
|
|
private $currency; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
private $destinationPaymentRefund; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string |
55
|
|
|
*/ |
56
|
|
|
private $sourceRefund; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var string |
60
|
|
|
*/ |
61
|
|
|
private $transfer; |
62
|
|
|
|
63
|
2 |
|
public static function createFromArray(array $data): self |
64
|
|
|
{ |
65
|
2 |
|
$currency = new Currency(strtoupper($data['currency'])); |
66
|
|
|
|
67
|
2 |
|
$model = new self(); |
68
|
2 |
|
$model->id = $data['id']; |
69
|
2 |
|
$model->amount = new Money($data['amount'], $currency); |
70
|
2 |
|
$model->balanceTransaction = $data['balance_transaction']; |
71
|
2 |
|
$model->createdAt = new \DateTimeImmutable('@'.$data['created']); |
72
|
2 |
|
$model->currency = $currency; |
73
|
2 |
|
$model->destinationPaymentRefund = $data['destination_payment_refund']; |
74
|
2 |
|
$model->metadata = MetadataCollection::createFromArray($data['metadata']); |
|
|
|
|
75
|
2 |
|
$model->sourceRefund = $data['source_refund']; |
76
|
2 |
|
$model->transfer = $data['transfer']; |
77
|
|
|
|
78
|
2 |
|
return $model; |
79
|
|
|
} |
80
|
|
|
|
81
|
1 |
|
public function getId(): string |
82
|
|
|
{ |
83
|
1 |
|
return $this->id; |
84
|
|
|
} |
85
|
|
|
|
86
|
1 |
|
public function getAmount(): Money |
87
|
|
|
{ |
88
|
1 |
|
return $this->amount; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function getBalanceTransaction(): ?string |
92
|
|
|
{ |
93
|
|
|
return $this->balanceTransaction; |
94
|
|
|
} |
95
|
|
|
|
96
|
1 |
|
public function getCreatedAt(): \DateTimeImmutable |
97
|
|
|
{ |
98
|
1 |
|
return $this->createdAt; |
99
|
|
|
} |
100
|
|
|
|
101
|
1 |
|
public function getCurrency(): Currency |
102
|
|
|
{ |
103
|
1 |
|
return $this->currency; |
104
|
|
|
} |
105
|
|
|
|
106
|
1 |
|
public function getDestinationPaymentRefund(): ?string |
107
|
|
|
{ |
108
|
1 |
|
return $this->destinationPaymentRefund; |
109
|
|
|
} |
110
|
|
|
|
111
|
1 |
|
public function getSourceRefund(): ?string |
112
|
|
|
{ |
113
|
1 |
|
return $this->sourceRefund; |
114
|
|
|
} |
115
|
|
|
|
116
|
1 |
|
public function getTransfer(): string |
117
|
|
|
{ |
118
|
1 |
|
return $this->transfer; |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..