composer package updates
[openemr.git] / vendor / stripe / stripe-php / lib / Subscription.php
blob5cdebb87a4e751382468b06522c4a6c366e5ba12
1 <?php
3 namespace Stripe;
5 /**
6 * Class Subscription
8 * @property string $id
9 * @property string $object
10 * @property float $application_fee_percent
11 * @property string $billing
12 * @property int $billing_cycle_anchor
13 * @property bool $cancel_at_period_end
14 * @property int $canceled_at
15 * @property int $created
16 * @property int current_period_end
17 * @property int current_period_start
18 * @property string $customer
19 * @property int $days_until_due
20 * @property Discount $discount
21 * @property int $ended_at
22 * @property Collection $items
23 * @property boolean $livemode
24 * @property StripeObject $metadata
25 * @property Plan $plan
26 * @property int $quantity
27 * @property int $start
28 * @property string $status
29 * @property float $tax_percent
30 * @property int $trial_end
31 * @property int $trial_start
33 * @package Stripe
35 class Subscription extends ApiResource
38 const OBJECT_NAME = "subscription";
40 use ApiOperations\All;
41 use ApiOperations\Create;
42 use ApiOperations\Delete {
43 delete as protected _delete;
45 use ApiOperations\Retrieve;
46 use ApiOperations\Update;
48 /**
49 * These constants are possible representations of the status field.
51 * @link https://stripe.com/docs/api#subscription_object-status
53 const STATUS_ACTIVE = 'active';
54 const STATUS_CANCELED = 'canceled';
55 const STATUS_PAST_DUE = 'past_due';
56 const STATUS_TRIALING = 'trialing';
57 const STATUS_UNPAID = 'unpaid';
59 public static function getSavedNestedResources()
61 static $savedNestedResources = null;
62 if ($savedNestedResources === null) {
63 $savedNestedResources = new Util\Set([
64 'source',
65 ]);
67 return $savedNestedResources;
70 /**
71 * @param array|null $params
73 * @return Subscription The deleted subscription.
75 public function cancel($params = null, $opts = null)
77 return $this->_delete($params, $opts);
80 /**
81 * @return Subscription The updated subscription.
83 public function deleteDiscount()
85 $url = $this->instanceUrl() . '/discount';
86 list($response, $opts) = $this->_request('delete', $url);
87 $this->refreshFrom(['discount' => null], $opts, true);