* Use of this software is governed by the Business Source License included in the LICENSE file and at https://getparthenon.com/docs/next/license.
9
*
10
* Change Date: TBD ( 3 years after 2.2.0 release )
11
*
12
* On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file.
13
*/
14
15
namespace Parthenon\Billing\Enum;
16
17
enum ChargeBackReason: string
18
{
19
case BANK_CANNOT_PROCESS = 'bank_cannot_process';
20
case CHECK_RETURNED = 'check_returned';
21
case CREDIT_NOT_PROCESSED = 'credit_not_processed';
22
case CUSTOMER_INITIATED = 'customer_initiated';
23
case DEBIT_NOT_AUTHORISED = 'debit_not_authorised';
24
case DUPLICATE = 'duplicate';
25
case FRAUDULENT = 'fraudulent';
26
case GENERAL = 'general';
27
case INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details';
28
case INSUFFICIENT_FUNDS = 'insufficient_funds';
29
case PRODUCT_NOT_RECEIVED = 'product_not_received';
30
case PRODUCT_UNACCEPTABLE = 'product_unacceptable';
31
case SUBSCRIPTION_CANCELED = 'subscription_canceled';
32
case UNRECOGNIZED = 'unrecognized';
33
34
public static function fromName(string $name): self
35
{
36
foreach (self::cases() as $status) {
37
if ($name === $status->value) {
38
return $status;
39
}
40
}
41
throw new \ValueError("$name is not a valid backing value for enum ".self::class);