1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Stadem\VivaPayments\Enums; |
4
|
|
|
|
5
|
|
|
enum TransactionType: int |
6
|
|
|
{ |
7
|
|
|
case CardCapture = 0; |
8
|
|
|
case CardPreAuth = 1; |
9
|
|
|
case CardRefund = 4; |
10
|
|
|
case CardCharge = 5; |
11
|
|
|
case CardChargeInstallments = 6; |
12
|
|
|
case CardVoid = 7; |
13
|
|
|
case CardOriginalCredit = 8; |
14
|
|
|
case VivaWalletCharge = 9; |
15
|
|
|
case VivaWalletRefund = 11; |
16
|
|
|
case CardRefundClaimed = 13; |
17
|
|
|
case Dias = 15; |
18
|
|
|
case Cash = 16; |
19
|
|
|
case CashRefund = 17; |
20
|
|
|
case CardRefundInstallments = 18; |
21
|
|
|
case CardPayout = 19; |
22
|
|
|
case AlipayCharge = 20; |
23
|
|
|
case AlipayRefund = 21; |
24
|
|
|
case CardManualCashDisbursement = 22; |
25
|
|
|
case IdealCharge = 23; |
26
|
|
|
case IdealRefund = 24; |
27
|
|
|
case P24Charge = 25; |
28
|
|
|
case P24Refund = 26; |
29
|
|
|
case BlikCharge = 27; |
30
|
|
|
case BlikRefund = 28; |
31
|
|
|
case PayUCharge = 29; |
32
|
|
|
case PayURefund = 30; |
33
|
|
|
case CardWithdrawal = 31; |
34
|
|
|
case MultibancoCharge = 32; |
35
|
|
|
case GiropayCharge = 34; |
36
|
|
|
case GiropayRefund = 35; |
37
|
|
|
case SofortCharge = 36; |
38
|
|
|
case SofortRefund = 37; |
39
|
|
|
case EPSCharge = 38; |
40
|
|
|
case EPSRefund = 39; |
41
|
|
|
case WeChatPayCharge = 40; |
42
|
|
|
case WeChatPayRefund = 41; |
43
|
|
|
case BitPayCharge = 42; |
44
|
|
|
case SepaDirectDebitCharge = 44; |
45
|
|
|
case SepaDirectDebitRefund = 45; |
46
|
|
|
case PayPalCharge = 48; |
47
|
|
|
case PayPalRefund = 49; |
48
|
|
|
case TrustlyCharge = 50; |
49
|
|
|
case TrustlyRefund = 51; |
50
|
|
|
case KlarnaCharge = 52; |
51
|
|
|
case KlarnaRefund = 53; |
52
|
|
|
case PayconiqCharge = 58; |
53
|
|
|
case PayconiqRefund = 59; |
54
|
|
|
case IrisCharge = 60; |
55
|
|
|
case IrisRefund = 61; |
56
|
|
|
case OnlineBankingCharge = 62; |
57
|
|
|
case OnlineBankingRefund = 63; |
58
|
|
|
case TbiBankCharge = 66; |
59
|
|
|
case TbiBankRefund = 67; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Return value as string |
63
|
|
|
* Enums\PaymentMethods::fromName('Dias'); |
64
|
|
|
*/ |
65
|
|
|
|
66
|
|
|
|
67
|
|
|
public static function fromName(string $name): int |
68
|
|
|
{ |
69
|
|
|
foreach (self::cases() as $status) { |
70
|
|
|
if( $name === $status->name ){ |
|
|
|
|
71
|
|
|
return $status->value; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
throw new \ValueError("$name is not a valid backing value for enum " . self::class ); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
|
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Return value as string |
81
|
|
|
* Enums\PaymentMethods::fromValue(15); |
82
|
|
|
*/ |
83
|
|
|
|
84
|
|
|
public static function fromValue(int $value): string |
85
|
|
|
{ |
86
|
|
|
foreach (self::cases() as $status) { |
87
|
|
|
if( $value === $status->value ){ |
88
|
|
|
return $status->name; |
|
|
|
|
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
throw new \ValueError("$value is not a valid backing value for enum " . self::class ); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
|
95
|
|
|
|
96
|
|
|
} |