From eeaa9bf413070c20a5dfa21733c55032c99e3747 Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Wed, 16 Nov 2022 11:37:36 -0800 Subject: [PATCH] Next major release changes (#1392) --- OPENAPI_VERSION | 2 +- init.php | 4 - lib/AlipayAccount.php | 75 ------------ lib/ApiOperations/Update.php | 4 + lib/Charge.php | 2 +- lib/LineItem.php | 1 - lib/Order.php | 122 -------------------- lib/PaymentIntent.php | 2 +- lib/Refund.php | 5 - lib/SKU.php | 41 ------- lib/Service/CoreServiceFactory.php | 4 - lib/Service/OrderService.php | 144 ------------------------ lib/Service/SkuService.php | 95 ---------------- lib/StripeClient.php | 2 - lib/Util/ApiVersion.php | 2 +- lib/Util/ObjectTypes.php | 2 - tests/Stripe/GeneratedExamplesTest.php | 47 -------- tests/Stripe/SKUTest.php | 88 --------------- tests/Stripe/Service/SkuServiceTest.php | 91 --------------- 19 files changed, 8 insertions(+), 725 deletions(-) delete mode 100644 lib/AlipayAccount.php delete mode 100644 lib/Order.php delete mode 100644 lib/SKU.php delete mode 100644 lib/Service/OrderService.php delete mode 100644 lib/Service/SkuService.php delete mode 100644 tests/Stripe/SKUTest.php delete mode 100644 tests/Stripe/Service/SkuServiceTest.php diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 1f9307ddf..1ec76a11f 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v207 \ No newline at end of file +v207 diff --git a/init.php b/init.php index 9d5a325c8..5555d8f9a 100644 --- a/init.php +++ b/init.php @@ -129,7 +129,6 @@ require __DIR__ . '/lib/LineItem.php'; require __DIR__ . '/lib/LoginLink.php'; require __DIR__ . '/lib/Mandate.php'; -require __DIR__ . '/lib/Order.php'; require __DIR__ . '/lib/PaymentIntent.php'; require __DIR__ . '/lib/PaymentLink.php'; require __DIR__ . '/lib/PaymentMethod.php'; @@ -152,7 +151,6 @@ require __DIR__ . '/lib/SetupIntent.php'; require __DIR__ . '/lib/ShippingRate.php'; require __DIR__ . '/lib/Sigma/ScheduledQueryRun.php'; -require __DIR__ . '/lib/SKU.php'; require __DIR__ . '/lib/Source.php'; require __DIR__ . '/lib/SourceTransaction.php'; require __DIR__ . '/lib/Subscription.php'; @@ -219,7 +217,6 @@ require __DIR__ . '/lib/Service/Issuing/DisputeService.php'; require __DIR__ . '/lib/Service/Issuing/TransactionService.php'; require __DIR__ . '/lib/Service/MandateService.php'; -require __DIR__ . '/lib/Service/OrderService.php'; require __DIR__ . '/lib/Service/PaymentIntentService.php'; require __DIR__ . '/lib/Service/PaymentLinkService.php'; require __DIR__ . '/lib/Service/PaymentMethodService.php'; @@ -240,7 +237,6 @@ require __DIR__ . '/lib/Service/SetupIntentService.php'; require __DIR__ . '/lib/Service/ShippingRateService.php'; require __DIR__ . '/lib/Service/Sigma/ScheduledQueryRunService.php'; -require __DIR__ . '/lib/Service/SkuService.php'; require __DIR__ . '/lib/Service/SourceService.php'; require __DIR__ . '/lib/Service/SubscriptionService.php'; require __DIR__ . '/lib/Service/SubscriptionItemService.php'; diff --git a/lib/AlipayAccount.php b/lib/AlipayAccount.php deleted file mode 100644 index 1d6a5096f..000000000 --- a/lib/AlipayAccount.php +++ /dev/null @@ -1,75 +0,0 @@ -null until a receipt has been sent. * @property null|string $receipt_url This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt. * @property bool $refunded Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false. - * @property \Stripe\Collection<\Stripe\Refund> $refunds A list of refunds that have been applied to the charge. + * @property null|\Stripe\Collection<\Stripe\Refund> $refunds A list of refunds that have been applied to the charge. * @property null|string|\Stripe\Review $review ID of the review associated with this charge if one exists. * @property null|\Stripe\StripeObject $shipping Shipping information for the charge. * @property null|\Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to payment_method or payment_method_details instead. diff --git a/lib/LineItem.php b/lib/LineItem.php index 845ff0173..63c5ca2ec 100644 --- a/lib/LineItem.php +++ b/lib/LineItem.php @@ -17,7 +17,6 @@ * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name. * @property \Stripe\StripeObject[] $discounts The discounts applied to the line item. * @property null|\Stripe\Price $price The price used to generate the line item. - * @property string|\Stripe\Product $product

The ID of the product for this line item.

This will always be the same as price.product.

* @property null|int $quantity The quantity of products being purchased. * @property \Stripe\StripeObject[] $taxes The taxes applied to the line item. */ diff --git a/lib/Order.php b/lib/Order.php deleted file mode 100644 index d9af3dfc5..000000000 --- a/lib/Order.php +++ /dev/null @@ -1,122 +0,0 @@ -Orders overview - * - * @property string $id Unique identifier for the object. - * @property string $object String representing the object's type. Objects of the same type share the same value. - * @property int $amount_subtotal Order cost before any discounts or taxes are applied. A positive integer representing the subtotal of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). - * @property int $amount_total Total order cost after discounts and taxes are applied. A positive integer representing the cost of the order in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). To submit an order, the total must be either 0 or at least $0.50 USD or equivalent in charge currency. - * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the Order, if any. - * @property \Stripe\StripeObject $automatic_tax - * @property null|\Stripe\StripeObject $billing_details Customer billing details associated with the order. - * @property null|string $client_secret

The client secret of this Order. Used for client-side retrieval using a publishable key.

The client secret can be used to complete a payment for an Order from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

Refer to our docs for creating and processing an order to learn about how client_secret should be handled.

- * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. - * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. - * @property null|string|\Stripe\Customer $customer The customer which this orders belongs to. - * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. - * @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the order. Use expand[]=discounts to expand each discount. - * @property null|string $ip_address A recent IP address of the purchaser used for tax reporting and tax location inference. - * @property \Stripe\Collection<\Stripe\LineItem> $line_items A list of line items the customer is ordering. Each line item includes information about the product, the quantity, and the resulting cost. There is a maximum of 100 line items. - * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. - * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. - * @property \Stripe\StripeObject $payment - * @property null|\Stripe\StripeObject $shipping_cost The details of the customer cost of shipping, including the customer chosen ShippingRate. - * @property null|\Stripe\StripeObject $shipping_details Customer shipping information associated with the order. - * @property string $status The overall status of the order. - * @property \Stripe\StripeObject $tax_details - * @property \Stripe\StripeObject $total_details - */ -class Order extends ApiResource -{ - const OBJECT_NAME = 'order'; - - use ApiOperations\All; - use ApiOperations\Create; - use ApiOperations\Retrieve; - use ApiOperations\Update; - - const STATUS_CANCELED = 'canceled'; - const STATUS_COMPLETE = 'complete'; - const STATUS_OPEN = 'open'; - const STATUS_PROCESSING = 'processing'; - const STATUS_SUBMITTED = 'submitted'; - - /** - * @param null|array $params - * @param null|array|string $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order the canceled order - */ - public function cancel($params = null, $opts = null) - { - $url = $this->instanceUrl() . '/cancel'; - list($response, $opts) = $this->_request('post', $url, $params, $opts); - $this->refreshFrom($response, $opts); - - return $this; - } - - /** - * @param string $id - * @param null|array $params - * @param null|array|string $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Collection<\Stripe\LineItem> list of LineItems - */ - public static function allLineItems($id, $params = null, $opts = null) - { - $url = static::resourceUrl($id) . '/line_items'; - list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); - $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); - $obj->setLastResponse($response); - - return $obj; - } - - /** - * @param null|array $params - * @param null|array|string $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order the reopened order - */ - public function reopen($params = null, $opts = null) - { - $url = $this->instanceUrl() . '/reopen'; - list($response, $opts) = $this->_request('post', $url, $params, $opts); - $this->refreshFrom($response, $opts); - - return $this; - } - - /** - * @param null|array $params - * @param null|array|string $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order the submited order - */ - public function submit($params = null, $opts = null) - { - $url = $this->instanceUrl() . '/submit'; - list($response, $opts) = $this->_request('post', $url, $params, $opts); - $this->refreshFrom($response, $opts); - - return $this; - } -} diff --git a/lib/PaymentIntent.php b/lib/PaymentIntent.php index 961802650..7fd577960 100644 --- a/lib/PaymentIntent.php +++ b/lib/PaymentIntent.php @@ -30,7 +30,6 @@ * @property null|int $canceled_at Populated when status is canceled, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch. * @property null|string $cancellation_reason Reason for cancellation of this PaymentIntent, either user-provided (duplicate, fraudulent, requested_by_customer, or abandoned) or generated by Stripe internally (failed_invoice, void_invoice, or automatic). * @property string $capture_method Controls when the funds will be captured from the customer's account. - * @property \Stripe\Collection<\Stripe\Charge> $charges Charges that were created by this PaymentIntent, if any. * @property null|string $client_secret

The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.

The client secret can be used to complete a payment from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

Refer to our docs to accept a payment and learn about how client_secret should be handled.

* @property string $confirmation_method * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. @@ -39,6 +38,7 @@ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string|\Stripe\Invoice $invoice ID of the invoice that created this PaymentIntent, if it exists. * @property null|\Stripe\StripeObject $last_payment_error The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason. + * @property null|string|\Stripe\Charge $latest_charge The latest charge created by this payment intent. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. For more information, see the documentation. * @property null|\Stripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source. diff --git a/lib/Refund.php b/lib/Refund.php index fd7eef280..0ddabfc4e 100644 --- a/lib/Refund.php +++ b/lib/Refund.php @@ -9,11 +9,6 @@ * been created but not yet refunded. Funds will be refunded to the credit or debit * card that was originally charged. * - * Stripe Tax users with recurring payments and invoices can create Credit Notes, which reduce - * overall tax liability because tax is correctly recalculated and apportioned to - * the related invoice. - * * Related guide: Refunds. * * @property string $id Unique identifier for the object. diff --git a/lib/SKU.php b/lib/SKU.php deleted file mode 100644 index 09d6c85e5..000000000 --- a/lib/SKU.php +++ /dev/null @@ -1,41 +0,0 @@ -stock keeping units. - * SKUs describe specific product variations, taking into account any combination - * of: attributes, currency, and cost. For example, a product may be a T-shirt, - * whereas a specific SKU represents the size: large, color: - * red version of that shirt. - * - * Can also be used to manage inventory. - * - * @property string $id Unique identifier for the object. - * @property string $object String representing the object's type. Objects of the same type share the same value. - * @property bool $active Whether the SKU is available for purchase. - * @property \Stripe\StripeObject $attributes A dictionary of attributes and values for the attributes defined by the product. If, for example, a product's attributes are ["size", "gender"], a valid SKU has the following dictionary of attributes: {"size": "Medium", "gender": "Unisex"}. - * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. - * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. - * @property null|string $image The URL of an image for this SKU, meant to be displayable to the customer. - * @property \Stripe\StripeObject $inventory - * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. - * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. - * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this SKU for shipping purposes. - * @property int $price The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency). - * @property string|\Stripe\Product $product The ID of the product this SKU is associated with. The product must be currently active. - * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. - */ -class SKU extends ApiResource -{ - const OBJECT_NAME = 'sku'; - - use ApiOperations\All; - use ApiOperations\Create; - use ApiOperations\Delete; - use ApiOperations\Retrieve; - use ApiOperations\Update; -} diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index ce9676c21..351f6913e 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -34,7 +34,6 @@ * @property Issuing\IssuingServiceFactory $issuing * @property MandateService $mandates * @property OAuthService $oauth - * @property OrderService $orders * @property PaymentIntentService $paymentIntents * @property PaymentLinkService $paymentLinks * @property PaymentMethodService $paymentMethods @@ -52,7 +51,6 @@ * @property SetupIntentService $setupIntents * @property ShippingRateService $shippingRates * @property Sigma\SigmaServiceFactory $sigma - * @property SkuService $skus * @property SourceService $sources * @property SubscriptionItemService $subscriptionItems * @property SubscriptionService $subscriptions @@ -100,7 +98,6 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory 'issuing' => Issuing\IssuingServiceFactory::class, 'mandates' => MandateService::class, 'oauth' => OAuthService::class, - 'orders' => OrderService::class, 'paymentIntents' => PaymentIntentService::class, 'paymentLinks' => PaymentLinkService::class, 'paymentMethods' => PaymentMethodService::class, @@ -118,7 +115,6 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory 'setupIntents' => SetupIntentService::class, 'shippingRates' => ShippingRateService::class, 'sigma' => Sigma\SigmaServiceFactory::class, - 'skus' => SkuService::class, 'sources' => SourceService::class, 'subscriptionItems' => SubscriptionItemService::class, 'subscriptions' => SubscriptionService::class, diff --git a/lib/Service/OrderService.php b/lib/Service/OrderService.php deleted file mode 100644 index 89de15fe8..000000000 --- a/lib/Service/OrderService.php +++ /dev/null @@ -1,144 +0,0 @@ - - */ - public function all($params = null, $opts = null) - { - return $this->requestCollection('get', '/v1/orders', $params, $opts); - } - - /** - * When retrieving an order, there is an includable line_items - * property containing the first handful of those items. There is also a URL where - * you can retrieve the full (paginated) list of line items. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Collection<\Stripe\LineItem> - */ - public function allLineItems($id, $params = null, $opts = null) - { - return $this->requestCollection('get', $this->buildPath('/v1/orders/%s/line_items', $id), $params, $opts); - } - - /** - * Cancels the order as well as the payment intent if one is attached. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order - */ - public function cancel($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/orders/%s/cancel', $id), $params, $opts); - } - - /** - * Creates a new open order object. - * - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order - */ - public function create($params = null, $opts = null) - { - return $this->request('post', '/v1/orders', $params, $opts); - } - - /** - * Reopens a submitted order. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order - */ - public function reopen($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/orders/%s/reopen', $id), $params, $opts); - } - - /** - * Retrieves the details of an existing order. Supply the unique order ID from - * either an order creation request or the order list, and Stripe will return the - * corresponding order information. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order - */ - public function retrieve($id, $params = null, $opts = null) - { - return $this->request('get', $this->buildPath('/v1/orders/%s', $id), $params, $opts); - } - - /** - * Submitting an Order transitions the status to processing and - * creates a PaymentIntent object so the order can be paid. If the Order has an - * amount_total of 0, no PaymentIntent object will be created. Once - * the order is submitted, its contents cannot be changed, unless the reopen method is called. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order - */ - public function submit($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/orders/%s/submit', $id), $params, $opts); - } - - /** - * Updates the specific order by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\Order - */ - public function update($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/orders/%s', $id), $params, $opts); - } -} diff --git a/lib/Service/SkuService.php b/lib/Service/SkuService.php deleted file mode 100644 index c00194ea3..000000000 --- a/lib/Service/SkuService.php +++ /dev/null @@ -1,95 +0,0 @@ - - */ - public function all($params = null, $opts = null) - { - return $this->requestCollection('get', '/v1/skus', $params, $opts); - } - - /** - * Creates a new SKU associated with a product. - * - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\SKU - */ - public function create($params = null, $opts = null) - { - return $this->request('post', '/v1/skus', $params, $opts); - } - - /** - * Delete a SKU. Deleting a SKU is only possible until it has been used in an - * order. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\SKU - */ - public function delete($id, $params = null, $opts = null) - { - return $this->request('delete', $this->buildPath('/v1/skus/%s', $id), $params, $opts); - } - - /** - * Retrieves the details of an existing SKU. Supply the unique SKU identifier from - * either a SKU creation request or from the product, and Stripe will return the - * corresponding SKU information. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\SKU - */ - public function retrieve($id, $params = null, $opts = null) - { - return $this->request('get', $this->buildPath('/v1/skus/%s', $id), $params, $opts); - } - - /** - * Updates the specific SKU by setting the values of the parameters passed. Any - * parameters not provided will be left unchanged. - * - * Note that a SKU’s attributes are not editable. Instead, you would - * need to deactivate the existing SKU and create a new one with the new attribute - * values. - * - * @param string $id - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\SKU - */ - public function update($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/skus/%s', $id), $params, $opts); - } -} diff --git a/lib/StripeClient.php b/lib/StripeClient.php index 05989ff62..73522abc7 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -34,7 +34,6 @@ * @property \Stripe\Service\Issuing\IssuingServiceFactory $issuing * @property \Stripe\Service\MandateService $mandates * @property \Stripe\Service\OAuthService $oauth - * @property \Stripe\Service\OrderService $orders * @property \Stripe\Service\PaymentIntentService $paymentIntents * @property \Stripe\Service\PaymentLinkService $paymentLinks * @property \Stripe\Service\PaymentMethodService $paymentMethods @@ -52,7 +51,6 @@ * @property \Stripe\Service\SetupIntentService $setupIntents * @property \Stripe\Service\ShippingRateService $shippingRates * @property \Stripe\Service\Sigma\SigmaServiceFactory $sigma - * @property \Stripe\Service\SkuService $skus * @property \Stripe\Service\SourceService $sources * @property \Stripe\Service\SubscriptionItemService $subscriptionItems * @property \Stripe\Service\SubscriptionScheduleService $subscriptionSchedules diff --git a/lib/Util/ApiVersion.php b/lib/Util/ApiVersion.php index 7cd0170ae..9efa9d70e 100644 --- a/lib/Util/ApiVersion.php +++ b/lib/Util/ApiVersion.php @@ -6,5 +6,5 @@ class ApiVersion { - const CURRENT = '2022-08-01'; + const CURRENT = '2022-11-15'; } diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index a94b58291..6fa98e407 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -61,7 +61,6 @@ class ObjectTypes \Stripe\LineItem::OBJECT_NAME => \Stripe\LineItem::class, \Stripe\LoginLink::OBJECT_NAME => \Stripe\LoginLink::class, \Stripe\Mandate::OBJECT_NAME => \Stripe\Mandate::class, - \Stripe\Order::OBJECT_NAME => \Stripe\Order::class, \Stripe\PaymentIntent::OBJECT_NAME => \Stripe\PaymentIntent::class, \Stripe\PaymentLink::OBJECT_NAME => \Stripe\PaymentLink::class, \Stripe\PaymentMethod::OBJECT_NAME => \Stripe\PaymentMethod::class, @@ -84,7 +83,6 @@ class ObjectTypes \Stripe\SetupIntent::OBJECT_NAME => \Stripe\SetupIntent::class, \Stripe\ShippingRate::OBJECT_NAME => \Stripe\ShippingRate::class, \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \Stripe\Sigma\ScheduledQueryRun::class, - \Stripe\SKU::OBJECT_NAME => \Stripe\SKU::class, \Stripe\Source::OBJECT_NAME => \Stripe\Source::class, \Stripe\SourceTransaction::OBJECT_NAME => \Stripe\SourceTransaction::class, \Stripe\Subscription::OBJECT_NAME => \Stripe\Subscription::class, diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 36880705e..994d3c2bb 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -2804,53 +2804,6 @@ public function testRetrieveScheduledQueryRun() static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result); } - public function testListSku() - { - $this->expectsRequest('get', '/v1/skus'); - $result = $this->client->skus->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SKU::class, $result->data[0]); - } - - public function testCreateSku() - { - $this->expectsRequest('post', '/v1/skus'); - $result = $this->client->skus->create( - [ - 'attributes' => ['size' => 'Medium', 'gender' => 'Unisex'], - 'price' => 1500, - 'currency' => 'usd', - 'inventory' => ['type' => 'finite', 'quantity' => 500], - 'product' => 'prod_xxxxxxxxxxxxx', - ] - ); - static::assertInstanceOf(\Stripe\SKU::class, $result); - } - - public function testDeleteSku() - { - $this->expectsRequest('delete', '/v1/skus/sku_xxxxxxxxxxxxx'); - $result = $this->client->skus->delete('sku_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\SKU::class, $result); - } - - public function testRetrieveSku() - { - $this->expectsRequest('get', '/v1/skus/sku_xxxxxxxxxxxxx'); - $result = $this->client->skus->retrieve('sku_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\SKU::class, $result); - } - - public function testUpdateSku() - { - $this->expectsRequest('post', '/v1/skus/sku_xxxxxxxxxxxxx'); - $result = $this->client->skus->update( - 'sku_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\SKU::class, $result); - } - public function testRetrieveSource() { $this->expectsRequest('get', '/v1/sources/src_xxxxxxxxxxxxx'); diff --git a/tests/Stripe/SKUTest.php b/tests/Stripe/SKUTest.php deleted file mode 100644 index 54366d1f7..000000000 --- a/tests/Stripe/SKUTest.php +++ /dev/null @@ -1,88 +0,0 @@ -expectsRequest( - 'get', - '/v1/skus' - ); - $resources = SKU::all(); - static::compatAssertIsArray($resources->data); - static::assertInstanceOf(\Stripe\SKU::class, $resources->data[0]); - } - - public function testIsRetrievable() - { - $this->expectsRequest( - 'get', - '/v1/skus/' . self::TEST_RESOURCE_ID - ); - $resource = SKU::retrieve(self::TEST_RESOURCE_ID); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - } - - public function testIsCreatable() - { - $this->expectsRequest( - 'post', - '/v1/skus' - ); - $resource = SKU::create([ - 'currency' => 'usd', - 'inventory' => [ - 'type' => 'finite', - 'quantity' => 1, - ], - 'price' => 100, - 'product' => 'prod_123', - ]); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - } - - public function testIsSaveable() - { - $resource = SKU::retrieve(self::TEST_RESOURCE_ID); - $resource->metadata['key'] = 'value'; - $this->expectsRequest( - 'post', - '/v1/skus/' . $resource->id - ); - $resource->save(); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - } - - public function testIsUpdatable() - { - $this->expectsRequest( - 'post', - '/v1/skus/' . self::TEST_RESOURCE_ID - ); - $resource = SKU::update(self::TEST_RESOURCE_ID, [ - 'metadata' => ['key' => 'value'], - ]); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - } - - public function testIsDeletable() - { - $resource = SKU::retrieve(self::TEST_RESOURCE_ID); - $this->expectsRequest( - 'delete', - '/v1/skus/' . $resource->id - ); - $resource->delete(); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - } -} diff --git a/tests/Stripe/Service/SkuServiceTest.php b/tests/Stripe/Service/SkuServiceTest.php deleted file mode 100644 index dd75c4b54..000000000 --- a/tests/Stripe/Service/SkuServiceTest.php +++ /dev/null @@ -1,91 +0,0 @@ -client = new \Stripe\StripeClient(['api_key' => 'sk_test_123', 'api_base' => MOCK_URL]); - $this->service = new SkuService($this->client); - } - - public function testAll() - { - $this->expectsRequest( - 'get', - '/v1/skus' - ); - $resources = $this->service->all(); - static::compatAssertIsArray($resources->data); - static::assertInstanceOf(\Stripe\SKU::class, $resources->data[0]); - } - - public function testCreate() - { - $this->expectsRequest( - 'post', - '/v1/skus' - ); - $resource = $this->service->create([ - 'currency' => 'usd', - 'inventory' => [ - 'type' => 'finite', - 'quantity' => 1, - ], - 'price' => 100, - 'product' => 'prod_123', - ]); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - } - - public function testDelete() - { - $this->expectsRequest( - 'delete', - '/v1/skus/' . self::TEST_RESOURCE_ID - ); - $resource = $this->service->delete(self::TEST_RESOURCE_ID); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - static::assertTrue($resource->isDeleted()); - } - - public function testRetrieve() - { - $this->expectsRequest( - 'get', - '/v1/skus/' . self::TEST_RESOURCE_ID - ); - $resource = $this->service->retrieve(self::TEST_RESOURCE_ID); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - } - - public function testUpdate() - { - $this->expectsRequest( - 'post', - '/v1/skus/' . self::TEST_RESOURCE_ID - ); - $resource = $this->service->update(self::TEST_RESOURCE_ID, [ - 'metadata' => ['key' => 'value'], - ]); - static::assertInstanceOf(\Stripe\SKU::class, $resource); - } -}