PATH:
home
/
lab2454c
/
costbloc.com
/
vendor
/
stripe
/
stripe-php
/
lib
<?php namespace Stripe; /** * Class ApiResource. */ abstract class ApiResource extends StripeObject { use ApiOperations\Request; /** * @return \Stripe\Util\Set A list of fields that can be their own type of * API resource (say a nested card under an account for example), and if * that resource is set, it should be transmitted to the API on a create or * update. Doing so is not the default behavior because API resources * should normally be persisted on their own RESTful endpoints. */ public static function getSavedNestedResources() { static $savedNestedResources = null; if (null === $savedNestedResources) { $savedNestedResources = new Util\Set(); } return $savedNestedResources; } /** * @var bool A flag that can be set a behavior that will cause this * resource to be encoded and sent up along with an update of its parent * resource. This is usually not desirable because resources are updated * individually on their own endpoints, but there are certain cases, * replacing a customer's source for example, where this is allowed. */ public $saveWithParent = false; public function __set($k, $v) { parent::__set($k, $v); $v = $this->{$k}; if ((static::getSavedNestedResources()->includes($k)) && ($v instanceof ApiResource)) { $v->saveWithParent = true; } } /** * @throws Exception\ApiErrorException * * @return ApiResource the refreshed resource */ public function refresh() { $requestor = new ApiRequestor($this->_opts->apiKey, static::baseUrl()); $url = $this->instanceUrl(); list($response, $this->_opts->apiKey) = $requestor->request( 'get', $url, $this->_retrieveOptions, $this->_opts->headers ); $this->setLastResponse($response); $this->refreshFrom($response->json, $this->_opts); return $this; } /** * @return string the base URL for the given class */ public static function baseUrl() { return Stripe::$apiBase; } /** * @return string the endpoint URL for the given class */ public static function classUrl() { // Replace dots with slashes for namespaced resources, e.g. if the object's name is // "foo.bar", then its URL will be "/v1/foo/bars". /** @phpstan-ignore-next-line */ $base = \str_replace('.', '/', static::OBJECT_NAME); return "/v1/{$base}s"; } /** * @param null|string $id the ID of the resource * * @throws Exception\UnexpectedValueException if $id is null * * @return string the instance endpoint URL for the given class */ public static function resourceUrl($id) { if (null === $id) { $class = static::class; $message = 'Could not determine which URL to request: ' . "{$class} instance has invalid ID: {$id}"; throw new Exception\UnexpectedValueException($message); } $id = Util\Util::utf8($id); $base = static::classUrl(); $extn = \urlencode($id); return "{$base}/{$extn}"; } /** * @return string the full API URL for this API resource */ public function instanceUrl() { return static::resourceUrl($this['id']); } }
[-] ThreeDSecure.php
[edit]
[-] WebhookEndpoint.php
[edit]
[+]
Terminal
[-] ApplicationFeeRefund.php
[edit]
[-] WebhookSignature.php
[edit]
[-] OrderItem.php
[edit]
[-] PaymentIntent.php
[edit]
[-] StripeClientInterface.php
[edit]
[-] AlipayAccount.php
[edit]
[-] InvoiceItem.php
[edit]
[-] TransferReversal.php
[edit]
[-] StripeClient.php
[edit]
[+]
Sigma
[-] Coupon.php
[edit]
[-] File.php
[edit]
[-] BaseStripeClient.php
[edit]
[-] OAuth.php
[edit]
[-] Review.php
[edit]
[-] FileLink.php
[edit]
[-] LoginLink.php
[edit]
[-] Charge.php
[edit]
[+]
..
[-] Discount.php
[edit]
[-] Balance.php
[edit]
[+]
Exception
[-] CustomerBalanceTransaction.php
[edit]
[-] Payout.php
[edit]
[-] TaxRate.php
[edit]
[-] ApplicationFee.php
[edit]
[-] SubscriptionSchedule.php
[edit]
[-] ApplePayDomain.php
[edit]
[-] ShippingRate.php
[edit]
[-] OAuthErrorObject.php
[edit]
[-] SetupIntent.php
[edit]
[-] ApiResource.php
[edit]
[-] Plan.php
[edit]
[-] Refund.php
[edit]
[-] InvoiceLineItem.php
[edit]
[-] CountrySpec.php
[edit]
[-] EphemeralKey.php
[edit]
[-] BitcoinTransaction.php
[edit]
[-] Card.php
[edit]
[-] Quote.php
[edit]
[-] SourceTransaction.php
[edit]
[-] Order.php
[edit]
[-] TaxId.php
[edit]
[+]
FinancialConnections
[-] Subscription.php
[edit]
[-] Account.php
[edit]
[-] AccountLink.php
[edit]
[-] PaymentLink.php
[edit]
[-] Price.php
[edit]
[+]
Issuing
[-] Token.php
[edit]
[-] SetupAttempt.php
[edit]
[-] Stripe.php
[edit]
[-] Customer.php
[edit]
[-] Event.php
[edit]
[-] RequestTelemetry.php
[edit]
[-] StripeStreamingClientInterface.php
[edit]
[-] ExchangeRate.php
[edit]
[-] PromotionCode.php
[edit]
[+]
Checkout
[+]
ApiOperations
[-] Mandate.php
[edit]
[-] Person.php
[edit]
[-] ApiResponse.php
[edit]
[-] BaseStripeClientInterface.php
[edit]
[-] Transfer.php
[edit]
[+]
Radar
[-] SKU.php
[edit]
[-] RecipientTransfer.php
[edit]
[-] CashBalance.php
[edit]
[-] Recipient.php
[edit]
[+]
HttpClient
[+]
BillingPortal
[-] BalanceTransaction.php
[edit]
[-] ApiRequestor.php
[edit]
[-] Product.php
[edit]
[-] LineItem.php
[edit]
[+]
Reporting
[-] Capability.php
[edit]
[-] OrderReturn.php
[edit]
[-] CreditNote.php
[edit]
[-] SearchResult.php
[edit]
[-] UsageRecordSummary.php
[edit]
[-] PaymentMethod.php
[edit]
[-] UsageRecord.php
[edit]
[+]
Util
[-] Invoice.php
[edit]
[-] BankAccount.php
[edit]
[-] ErrorObject.php
[edit]
[-] Source.php
[edit]
[-] FundingInstructions.php
[edit]
[-] Topup.php
[edit]
[+]
Service
[-] Dispute.php
[edit]
[+]
TestHelpers
[-] SubscriptionItem.php
[edit]
[-] SingletonApiResource.php
[edit]
[-] TaxCode.php
[edit]
[-] StripeObject.php
[edit]
[-] Webhook.php
[edit]
[-] CreditNoteLineItem.php
[edit]
[-] BitcoinReceiver.php
[edit]
[-] Collection.php
[edit]
[+]
Identity