1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sebdesign\VivaPayments\Events; |
4
|
|
|
|
5
|
|
|
use Sebdesign\VivaPayments\Enums\TransactionStatus; |
6
|
|
|
use Sebdesign\VivaPayments\Enums\TransactionType; |
7
|
|
|
|
8
|
|
|
/** @see https://developer.vivawallet.com/webhooks-for-payments/transaction-failed/ */ |
9
|
|
|
class TransactionFailed |
10
|
|
|
{ |
11
|
1 |
|
public function __construct( |
12
|
|
|
public readonly bool $Moto, |
13
|
|
|
public readonly string $Email, |
14
|
|
|
public readonly string $Phone, |
15
|
|
|
public readonly string $BankId, |
16
|
|
|
public readonly bool $Systemic, |
17
|
|
|
public readonly bool $Switching, |
18
|
|
|
public readonly ?string $ParentId, |
19
|
|
|
public readonly float $Amount, |
20
|
|
|
public readonly string $ChannelId, |
21
|
|
|
public readonly int $TerminalId, |
22
|
|
|
public readonly string $MerchantId, |
23
|
|
|
public readonly string $OrderCode, |
24
|
|
|
public readonly ?string $ProductId, |
25
|
|
|
public readonly TransactionStatus $StatusId, |
26
|
|
|
public readonly string $FullName, |
27
|
|
|
public readonly ?string $ResellerId, |
28
|
|
|
public readonly string $InsDate, |
29
|
|
|
public readonly float $TotalFee, |
30
|
|
|
public readonly string $CardUniqueReference, |
31
|
|
|
public readonly string $CardToken, |
32
|
|
|
public readonly string $CardNumber, |
33
|
|
|
public readonly float $TipAmount, |
34
|
|
|
public readonly string $SourceCode, |
35
|
|
|
public readonly string $SourceName, |
36
|
|
|
public readonly ?float $Latitude, |
37
|
|
|
public readonly ?float $Longitude, |
38
|
|
|
public readonly string $CompanyName, |
39
|
|
|
public readonly string $TransactionId, |
40
|
|
|
public readonly string $CompanyTitle, |
41
|
|
|
public readonly string $PanEntryMode, |
42
|
|
|
public readonly int $ReferenceNumber, |
43
|
|
|
public readonly ?string $ResponseCode, |
44
|
|
|
public readonly string $CurrencyCode, |
45
|
|
|
public readonly string $OrderCulture, |
46
|
|
|
public readonly ?string $MerchantTrns, |
47
|
|
|
public readonly string $CustomerTrns, |
48
|
|
|
public readonly bool $IsManualRefund, |
49
|
|
|
public readonly ?string $TargetPersonId, |
50
|
|
|
public readonly ?string $TargetWalletId, |
51
|
|
|
public readonly bool $LoyaltyTriggered, |
52
|
|
|
public readonly TransactionType $TransactionTypeId, |
53
|
|
|
public readonly int $TotalInstallments, |
54
|
|
|
public readonly ?string $CardCountryCode, |
55
|
|
|
public readonly ?string $CardIssuingBank, |
56
|
|
|
public readonly int $RedeemedAmount, |
57
|
|
|
public readonly ?int $ClearanceDate, |
58
|
|
|
public readonly ?int $CurrentInstallment, |
59
|
|
|
/** @var string[] */ |
60
|
|
|
public readonly array $Tags, |
61
|
|
|
public readonly ?string $BillId, |
62
|
|
|
public readonly ?string $ResellerSourceCode, |
63
|
|
|
public readonly ?string $ResellerSourceName, |
64
|
|
|
public readonly ?string $ResellerCompanyName, |
65
|
|
|
public readonly ?string $ResellerSourceAddress, |
66
|
|
|
public readonly string $CardExpirationDate, |
67
|
|
|
public readonly ?string $RetrievalReferenceNumber, |
68
|
|
|
/** @var string[] */ |
69
|
|
|
public readonly array $AssignedMerchantUsers, |
70
|
|
|
/** @var string[] */ |
71
|
|
|
public readonly array $AssignedResellerUsers, |
72
|
|
|
public readonly int $CardTypeId, |
73
|
|
|
public readonly ?int $DigitalWalletId, |
74
|
|
|
public readonly ?string $ResponseEventId, |
75
|
|
|
public readonly ?string $ElectronicCommerceIndicator, |
76
|
|
|
) { |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** @phpstan-param TransactionFailedArray $attributes */ |
80
|
3 |
|
public static function create(array $attributes): self |
81
|
|
|
{ |
82
|
3 |
|
return new self( |
83
|
3 |
|
Moto: $attributes['Moto'], |
84
|
3 |
|
Email: $attributes['Email'], |
85
|
3 |
|
Phone: $attributes['Phone'], |
86
|
3 |
|
BankId: $attributes['BankId'], |
87
|
3 |
|
Systemic: $attributes['Systemic'], |
88
|
3 |
|
Switching: $attributes['Switching'], |
89
|
3 |
|
ParentId: $attributes['ParentId'] ?? null, |
90
|
3 |
|
Amount: $attributes['Amount'], |
91
|
3 |
|
ChannelId: $attributes['ChannelId'], |
92
|
3 |
|
TerminalId: $attributes['TerminalId'], |
93
|
3 |
|
MerchantId: $attributes['MerchantId'], |
94
|
3 |
|
OrderCode: $attributes['OrderCode'], |
95
|
3 |
|
ProductId: $attributes['ProductId'] ?? null, |
96
|
3 |
|
StatusId: TransactionStatus::from($attributes['StatusId']), |
97
|
3 |
|
FullName: $attributes['FullName'], |
98
|
3 |
|
ResellerId: $attributes['ResellerId'] ?? null, |
99
|
3 |
|
InsDate: $attributes['InsDate'], |
100
|
3 |
|
TotalFee: $attributes['TotalFee'], |
101
|
3 |
|
CardUniqueReference: $attributes['CardUniqueReference'], |
102
|
3 |
|
CardToken: $attributes['CardToken'], |
103
|
3 |
|
CardNumber: $attributes['CardNumber'], |
104
|
3 |
|
TipAmount: $attributes['TipAmount'], |
105
|
3 |
|
SourceCode: $attributes['SourceCode'], |
106
|
3 |
|
SourceName: $attributes['SourceName'], |
107
|
3 |
|
Latitude: $attributes['Latitude'] ?? null, |
108
|
3 |
|
Longitude: $attributes['Longitude'] ?? null, |
109
|
3 |
|
CompanyName: $attributes['CompanyName'], |
110
|
3 |
|
TransactionId: $attributes['TransactionId'], |
111
|
3 |
|
CompanyTitle: $attributes['CompanyTitle'], |
112
|
3 |
|
PanEntryMode: $attributes['PanEntryMode'], |
113
|
3 |
|
ReferenceNumber: $attributes['ReferenceNumber'], |
114
|
3 |
|
ResponseCode: $attributes['ResponseCode'] ?? null, |
115
|
3 |
|
CurrencyCode: $attributes['CurrencyCode'], |
116
|
3 |
|
OrderCulture: $attributes['OrderCulture'], |
117
|
3 |
|
MerchantTrns: $attributes['MerchantTrns'] ?? null, |
118
|
3 |
|
CustomerTrns: $attributes['CustomerTrns'], |
119
|
3 |
|
IsManualRefund: $attributes['IsManualRefund'], |
120
|
3 |
|
TargetPersonId: $attributes['TargetPersonId'] ?? null, |
121
|
3 |
|
TargetWalletId: $attributes['TargetWalletId'] ?? null, |
122
|
3 |
|
LoyaltyTriggered: $attributes['LoyaltyTriggered'], |
123
|
3 |
|
TransactionTypeId: TransactionType::from($attributes['TransactionTypeId']), |
124
|
3 |
|
TotalInstallments: $attributes['TotalInstallments'], |
125
|
3 |
|
CardCountryCode: $attributes['CardCountryCode'] ?? null, |
126
|
3 |
|
CardIssuingBank: $attributes['CardIssuingBank'] ?? null, |
127
|
3 |
|
RedeemedAmount: $attributes['RedeemedAmount'], |
128
|
3 |
|
ClearanceDate: $attributes['ClearanceDate'] ?? null, |
129
|
3 |
|
CurrentInstallment: $attributes['CurrentInstallment'] ?? null, |
130
|
3 |
|
Tags: $attributes['Tags'], |
131
|
3 |
|
BillId: $attributes['BillId'] ?? null, |
132
|
3 |
|
ResellerSourceCode: $attributes['ResellerSourceCode'] ?? null, |
133
|
3 |
|
ResellerSourceName: $attributes['ResellerSourceName'] ?? null, |
134
|
3 |
|
ResellerCompanyName: $attributes['ResellerCompanyName'] ?? null, |
135
|
3 |
|
ResellerSourceAddress: $attributes['ResellerSourceAddress'] ?? null, |
136
|
3 |
|
CardExpirationDate: $attributes['CardExpirationDate'], |
137
|
3 |
|
RetrievalReferenceNumber: $attributes['RetrievalReferenceNumber'] ?? null, |
138
|
3 |
|
AssignedMerchantUsers: $attributes['AssignedMerchantUsers'], |
139
|
3 |
|
AssignedResellerUsers: $attributes['AssignedResellerUsers'], |
140
|
3 |
|
CardTypeId: $attributes['CardTypeId'], |
141
|
3 |
|
DigitalWalletId: $attributes['DigitalWalletId'] ?? null, |
142
|
3 |
|
ResponseEventId: $attributes['ResponseEventId'] ?? null, |
143
|
3 |
|
ElectronicCommerceIndicator: $attributes['ElectronicCommerceIndicator'] ?? null, |
144
|
|
|
); |
145
|
|
|
} |
146
|
|
|
} |
147
|
|
|
|