composer package updates
[openemr.git] / vendor / stripe / stripe-php / lib / Card.php
blob686080ee8c1b677cd9e5b56f191a56ffa6d1a0f5
1 <?php
3 namespace Stripe;
5 /**
6 * Class Card
8 * @property string $id
9 * @property string $object
10 * @property string $account
11 * @property string $address_city
12 * @property string $address_country
13 * @property string $address_line1
14 * @property string $address_line1_check
15 * @property string $address_line2
16 * @property string $address_state
17 * @property string $address_zip
18 * @property string $address_zip_check
19 * @property array $available_payout_methods
20 * @property string $brand
21 * @property string $country
22 * @property string $currency
23 * @property string $customer
24 * @property string $cvc_check
25 * @property bool $default_for_currency
26 * @property string $dynamic_last4
27 * @property int $exp_month
28 * @property int $exp_year
29 * @property string $fingerprint
30 * @property string $funding
31 * @property string $last4
32 * @property StripeObject $metadata
33 * @property string $name
34 * @property string $recipient
35 * @property string $tokenization_method
37 * @package Stripe
39 class Card extends ApiResource
42 const OBJECT_NAME = "card";
44 use ApiOperations\Delete;
45 use ApiOperations\Update;
47 /**
48 * @return string The instance URL for this resource. It needs to be special
49 * cased because cards are nested resources that may belong to different
50 * top-level resources.
52 public function instanceUrl()
54 if ($this['customer']) {
55 $base = Customer::classUrl();
56 $parent = $this['customer'];
57 $path = 'sources';
58 } elseif ($this['account']) {
59 $base = Account::classUrl();
60 $parent = $this['account'];
61 $path = 'external_accounts';
62 } elseif ($this['recipient']) {
63 $base = Recipient::classUrl();
64 $parent = $this['recipient'];
65 $path = 'cards';
66 } else {
67 $msg = "Cards cannot be accessed without a customer ID, account ID or recipient ID.";
68 throw new Error\InvalidRequest($msg, null);
70 $parentExtn = urlencode(Util\Util::utf8($parent));
71 $extn = urlencode(Util\Util::utf8($this['id']));
72 return "$base/$parentExtn/$path/$extn";
75 /**
76 * @param array|string $_id
77 * @param array|string|null $_opts
79 * @throws \Stripe\Error\InvalidRequest
81 public static function retrieve($_id, $_opts = null)
83 $msg = "Cards cannot be accessed without a customer, recipient or account ID. " .
84 "Retrieve a card using \$customer->sources->retrieve('card_id'), " .
85 "\$recipient->cards->retrieve('card_id'), or";
86 "\$account->external_accounts->retrieve('card_id') instead.";
87 throw new Error\InvalidRequest($msg, null);
90 /**
91 * @param string $_id
92 * @param array|null $_params
93 * @param array|string|null $_options
95 * @throws \Stripe\Error\InvalidRequest
97 public static function update($_id, $_params = null, $_options = null)
99 $msg = "Cards cannot be accessed without a customer, recipient or account ID. " .
100 "Call save() on \$customer->sources->retrieve('card_id'), " .
101 "\$recipient->cards->retrieve('card_id'), or";
102 "\$account->external_accounts->retrieve('card_id') instead.";
103 throw new Error\InvalidRequest($msg, null);