1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Stadem\VivaPayments\Enums; |
4
|
|
|
|
5
|
|
|
enum WebhookEventType: int |
6
|
|
|
{ |
7
|
|
|
/** A customer’s payment has been successful */ |
8
|
|
|
case TransactionPaymentCreated = 1796; |
9
|
|
|
|
10
|
|
|
/** A customer’s payment failed (but the customer may retry and the customer’s payment may - eventually - be successful) */ |
11
|
|
|
case TransactionFailed = 1798; |
12
|
|
|
|
13
|
|
|
/** A commission payment has been withdrawn from your account by Viva Wallet */ |
14
|
|
|
case TransactionPriceCalculated = 1799; |
15
|
|
|
|
16
|
|
|
/** A customer refund has been successfully actioned */ |
17
|
|
|
case TransactionReversalCreated = 1797; |
18
|
|
|
|
19
|
|
|
/** A wallet account balance change */ |
20
|
|
|
case AccountTransactionCreated = 2054; |
21
|
|
|
|
22
|
|
|
/** A bank transfer to an external IBAN has been created but not executed yet (the money has not yet been transferred from your wallet) */ |
23
|
|
|
case CommandBankTransferCreated = 768; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* A bank transfer to an external IBAN has been executed. |
27
|
|
|
* |
28
|
|
|
* In case of instant bank account transfer, money has been transferred immediately from your wallet - which is linked with your IBAN - to the external IBAN. |
29
|
|
|
* In case of non-instant bank account transfer, money has been transferred from your wallet - which is linked with your IBAN - but not necessarily received yet to the external IBAN |
30
|
|
|
*/ |
31
|
|
|
case CommandBankTransferExecuted = 769; |
32
|
|
|
|
33
|
|
|
/** A marketplace obligation (e.g. refund request) has been successfully sent to a marketplace seller */ |
34
|
|
|
case ObligationCreated = 5632; |
35
|
|
|
|
36
|
|
|
/** A marketplace obligation (e.g. refund request) has been successfully paid by a marketplace seller */ |
37
|
|
|
case ObligationCaptured = 5633; |
38
|
|
|
|
39
|
|
|
/** The requested sale transactions are available to download */ |
40
|
|
|
case SaleTransactions = 0; |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
|
44
|
|
|
public static function fromName(string $name): int |
45
|
|
|
{ |
46
|
|
|
foreach (self::cases() as $status) { |
47
|
|
|
if( $name === $status->name ){ |
|
|
|
|
48
|
|
|
return $status->value; |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
throw new \ValueError("$name is not a valid backing value for enum " . self::class ); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Return value as string |
58
|
|
|
* Enums\PaymentMethods::fromValue(15); |
59
|
|
|
*/ |
60
|
|
|
|
61
|
|
|
public static function fromValue(int $value): string |
62
|
|
|
{ |
63
|
|
|
foreach (self::cases() as $status) { |
64
|
|
|
if( $value === $status->value ){ |
65
|
|
|
return $status->name; |
|
|
|
|
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
throw new \ValueError("$value is not a valid backing value for enum " . self::class ); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
|
72
|
|
|
|
73
|
|
|
|
74
|
|
|
|
75
|
|
|
} |