-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCardBrand.php
More file actions
41 lines (35 loc) · 989 Bytes
/
CardBrand.php
File metadata and controls
41 lines (35 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace MatchBot\Domain;
use function Symfony\Component\String\s;
/**
* Brand of payment card. Cases include all currently supported brands for Stripe, as well as the special
* 'unknown' value for cards of other or unknown brands.
*
* Cases based on https://stripe.com/docs/api/errors#errors-payment_method-card-brand
*/
enum CardBrand: string
{
case amex = 'amex';
case diners = 'diners';
case discover = 'discover';
case eftpos_au = 'eftpos_au';
case jcb = 'jcb';
case mastercard = 'mastercard';
case unionpay = 'unionpay';
case visa = 'visa';
case unknow = 'unknown';
public static function fromNameOrNull(?string $brand): ?self
{
if ($brand === null) {
return null;
}
return self::from($brand);
}
/**
* Whether this is amex or not is important Amex is more expensive to process.
*/
public function isAmex(): bool
{
return $this === self::amex;
}
}