Configuration.php
101 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace AmeliaVendor\Stripe\BillingPortal; |
| 5 | |
| 6 | /** |
| 7 | * A portal configuration describes the functionality and behavior of a portal session. |
| 8 | * |
| 9 | * @property string $id Unique identifier for the object. |
| 10 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 11 | * @property bool $active Whether the configuration is active and can be used to create portal sessions. |
| 12 | * @property null|string|\AmeliaVendor\Stripe\Application $application ID of the Connect Application that created the configuration. |
| 13 | * @property (object{headline: null|string, privacy_policy_url: null|string, terms_of_service_url: null|string}&\AmeliaVendor\Stripe\StripeObject) $business_profile |
| 14 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 15 | * @property null|string $default_return_url The default URL to redirect customers to when they click on the portal's link to return to your website. This can be <a href="https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url">overriden</a> when creating the session. |
| 16 | * @property (object{customer_update: (object{allowed_updates: string[], enabled: bool}&\AmeliaVendor\Stripe\StripeObject), invoice_history: (object{enabled: bool}&\AmeliaVendor\Stripe\StripeObject), payment_method_update: (object{enabled: bool}&\AmeliaVendor\Stripe\StripeObject), subscription_cancel: (object{cancellation_reason: (object{enabled: bool, options: string[]}&\AmeliaVendor\Stripe\StripeObject), enabled: bool, mode: string, proration_behavior: string}&\AmeliaVendor\Stripe\StripeObject), subscription_update: (object{default_allowed_updates: string[], enabled: bool, products?: null|(object{prices: string[], product: string}&\AmeliaVendor\Stripe\StripeObject)[], proration_behavior: string, schedule_at_period_end: (object{conditions: (object{type: string}&\AmeliaVendor\Stripe\StripeObject)[]}&\AmeliaVendor\Stripe\StripeObject)}&\AmeliaVendor\Stripe\StripeObject)}&\AmeliaVendor\Stripe\StripeObject) $features |
| 17 | * @property bool $is_default Whether the configuration is the default. If <code>true</code>, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session. |
| 18 | * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. |
| 19 | * @property (object{enabled: bool, url: null|string}&\AmeliaVendor\Stripe\StripeObject) $login_page |
| 20 | * @property null|\AmeliaVendor\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
| 21 | * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. |
| 22 | */ |
| 23 | class Configuration extends \AmeliaVendor\Stripe\ApiResource |
| 24 | { |
| 25 | const OBJECT_NAME = 'billing_portal.configuration'; |
| 26 | use \AmeliaVendor\Stripe\ApiOperations\Update; |
| 27 | /** |
| 28 | * Creates a configuration that describes the functionality and behavior of a |
| 29 | * PortalSession. |
| 30 | * |
| 31 | * @param null|array{business_profile?: array{headline?: null|string, privacy_policy_url?: string, terms_of_service_url?: string}, default_return_url?: null|string, expand?: string[], features: array{customer_update?: array{allowed_updates?: null|string[], enabled: bool}, invoice_history?: array{enabled: bool}, payment_method_update?: array{enabled: bool}, subscription_cancel?: array{cancellation_reason?: array{enabled: bool, options: null|string[]}, enabled: bool, mode?: string, proration_behavior?: string}, subscription_update?: array{default_allowed_updates?: null|string[], enabled: bool, products?: null|array{prices: string[], product: string}[], proration_behavior?: string, schedule_at_period_end?: array{conditions?: array{type: string}[]}}}, login_page?: array{enabled: bool}, metadata?: array<string, string>} $params |
| 32 | * @param null|array|string $options |
| 33 | * |
| 34 | * @return Configuration the created resource |
| 35 | * |
| 36 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 37 | */ |
| 38 | public static function create($params = null, $options = null) |
| 39 | { |
| 40 | self::_validateParams($params); |
| 41 | $url = static::classUrl(); |
| 42 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 43 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 44 | $obj->setLastResponse($response); |
| 45 | return $obj; |
| 46 | } |
| 47 | /** |
| 48 | * Returns a list of configurations that describe the functionality of the customer |
| 49 | * portal. |
| 50 | * |
| 51 | * @param null|array{active?: bool, ending_before?: string, expand?: string[], is_default?: bool, limit?: int, starting_after?: string} $params |
| 52 | * @param null|array|string $opts |
| 53 | * |
| 54 | * @return \AmeliaVendor\Stripe\Collection<Configuration> of ApiResources |
| 55 | * |
| 56 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 57 | */ |
| 58 | public static function all($params = null, $opts = null) |
| 59 | { |
| 60 | $url = static::classUrl(); |
| 61 | return static::_requestPage($url, \AmeliaVendor\Stripe\Collection::class, $params, $opts); |
| 62 | } |
| 63 | /** |
| 64 | * Retrieves a configuration that describes the functionality of the customer |
| 65 | * portal. |
| 66 | * |
| 67 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 68 | * @param null|array|string $opts |
| 69 | * |
| 70 | * @return Configuration |
| 71 | * |
| 72 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 73 | */ |
| 74 | public static function retrieve($id, $opts = null) |
| 75 | { |
| 76 | $opts = \AmeliaVendor\Stripe\Util\RequestOptions::parse($opts); |
| 77 | $instance = new static($id, $opts); |
| 78 | $instance->refresh(); |
| 79 | return $instance; |
| 80 | } |
| 81 | /** |
| 82 | * Updates a configuration that describes the functionality of the customer portal. |
| 83 | * |
| 84 | * @param string $id the ID of the resource to update |
| 85 | * @param null|array{active?: bool, business_profile?: array{headline?: null|string, privacy_policy_url?: null|string, terms_of_service_url?: null|string}, default_return_url?: null|string, expand?: string[], features?: array{customer_update?: array{allowed_updates?: null|string[], enabled?: bool}, invoice_history?: array{enabled: bool}, payment_method_update?: array{enabled: bool}, subscription_cancel?: array{cancellation_reason?: array{enabled: bool, options?: null|string[]}, enabled?: bool, mode?: string, proration_behavior?: string}, subscription_update?: array{default_allowed_updates?: null|string[], enabled?: bool, products?: null|array{prices: string[], product: string}[], proration_behavior?: string, schedule_at_period_end?: array{conditions?: null|array{type: string}[]}}}, login_page?: array{enabled: bool}, metadata?: null|array<string, string>} $params |
| 86 | * @param null|array|string $opts |
| 87 | * |
| 88 | * @return Configuration the updated resource |
| 89 | * |
| 90 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 91 | */ |
| 92 | public static function update($id, $params = null, $opts = null) |
| 93 | { |
| 94 | self::_validateParams($params); |
| 95 | $url = static::resourceUrl($id); |
| 96 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 97 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 98 | $obj->setLastResponse($response); |
| 99 | return $obj; |
| 100 | } |
| 101 | } |