Skip to content

Commit

Permalink
Merge branch 'master' into richardm-usage
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe authored Dec 1, 2023
2 parents 09d5543 + a688c0e commit fc88a57
Show file tree
Hide file tree
Showing 19 changed files with 370 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 13.5.0 - 2023-11-30
* [#1611](https://github.com/stripe/stripe-php/pull/1611) Update generated code
* Add support for new resources `Climate.Order`, `Climate.Product`, and `Climate.Supplier`
* Add support for `all`, `cancel`, `create`, `retrieve`, and `update` methods on resource `Order`
* Add support for `all` and `retrieve` methods on resources `Product` and `Supplier`
* Add support for new value `financial_connections_account_inactive` on enum `StripeError.code`
* Add support for new values `climate_order_purchase` and `climate_order_refund` on enum `BalanceTransaction.type`
* Add support for new values `climate.order.canceled`, `climate.order.created`, `climate.order.delayed`, `climate.order.delivered`, `climate.order.product_substituted`, `climate.product.created`, and `climate.product.pricing_updated` on enum `Event.type`

## 13.4.0 - 2023-11-21
* [#1608](https://github.com/stripe/stripe-php/pull/1608) Update generated code
Add support for `transferred_to_balance` to `CustomerCashBalanceTransaction`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v680
v689
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
13.4.0
13.5.0
7 changes: 7 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
require __DIR__ . '/lib/CashBalance.php';
require __DIR__ . '/lib/Charge.php';
require __DIR__ . '/lib/Checkout/Session.php';
require __DIR__ . '/lib/Climate/Order.php';
require __DIR__ . '/lib/Climate/Product.php';
require __DIR__ . '/lib/Climate/Supplier.php';
require __DIR__ . '/lib/CountrySpec.php';
require __DIR__ . '/lib/Coupon.php';
require __DIR__ . '/lib/CreditNote.php';
Expand Down Expand Up @@ -165,6 +168,10 @@
require __DIR__ . '/lib/Service/ChargeService.php';
require __DIR__ . '/lib/Service/Checkout/CheckoutServiceFactory.php';
require __DIR__ . '/lib/Service/Checkout/SessionService.php';
require __DIR__ . '/lib/Service/Climate/ClimateServiceFactory.php';
require __DIR__ . '/lib/Service/Climate/OrderService.php';
require __DIR__ . '/lib/Service/Climate/ProductService.php';
require __DIR__ . '/lib/Service/Climate/SupplierService.php';
require __DIR__ . '/lib/Service/CoreServiceFactory.php';
require __DIR__ . '/lib/Service/CountrySpecService.php';
require __DIR__ . '/lib/Service/CouponService.php';
Expand Down
4 changes: 3 additions & 1 deletion lib/BalanceTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @property string $reporting_category Learn more about how <a href="https://stripe.com/docs/reports/reporting-categories">reporting categories</a> can help you understand balance transactions from an accounting perspective.
* @property null|string|\Stripe\ApplicationFee|\Stripe\ApplicationFeeRefund|\Stripe\Charge|\Stripe\CustomerCashBalanceTransaction|\Stripe\Dispute|\Stripe\Issuing\Authorization|\Stripe\Issuing\Dispute|\Stripe\Issuing\Transaction|\Stripe\Payout|\Stripe\Refund|\Stripe\StripeObject|\Stripe\Topup|\Stripe\Transfer|\Stripe\TransferReversal $source This transaction relates to the Stripe object.
* @property string $status The transaction's net funds status in the Stripe balance, which are either <code>available</code> or <code>pending</code>.
* @property string $type Transaction type: <code>adjustment</code>, <code>advance</code>, <code>advance_funding</code>, <code>anticipation_repayment</code>, <code>application_fee</code>, <code>application_fee_refund</code>, <code>charge</code>, <code>connect_collection_transfer</code>, <code>contribution</code>, <code>issuing_authorization_hold</code>, <code>issuing_authorization_release</code>, <code>issuing_dispute</code>, <code>issuing_transaction</code>, <code>obligation_inbound</code>, <code>obligation_outbound</code>, <code>obligation_reversal_inbound</code>, <code>obligation_reversal_outbound</code>, <code>obligation_payout</code>, <code>obligation_payout_failure</code>, <code>payment</code>, <code>payment_failure_refund</code>, <code>payment_refund</code>, <code>payment_reversal</code>, <code>payment_unreconciled</code>, <code>payout</code>, <code>payout_cancel</code>, <code>payout_failure</code>, <code>refund</code>, <code>refund_failure</code>, <code>reserve_transaction</code>, <code>reserved_funds</code>, <code>stripe_fee</code>, <code>stripe_fx_fee</code>, <code>tax_fee</code>, <code>topup</code>, <code>topup_reversal</code>, <code>transfer</code>, <code>transfer_cancel</code>, <code>transfer_failure</code>, or <code>transfer_refund</code>. Learn more about <a href="https://stripe.com/docs/reports/balance-transaction-types">balance transaction types and what they represent</a>. To classify transactions for accounting purposes, consider <code>reporting_category</code> instead.
* @property string $type Transaction type: <code>adjustment</code>, <code>advance</code>, <code>advance_funding</code>, <code>anticipation_repayment</code>, <code>application_fee</code>, <code>application_fee_refund</code>, <code>charge</code>, <code>climate_order_purchase</code>, <code>climate_order_refund</code>, <code>connect_collection_transfer</code>, <code>contribution</code>, <code>issuing_authorization_hold</code>, <code>issuing_authorization_release</code>, <code>issuing_dispute</code>, <code>issuing_transaction</code>, <code>obligation_inbound</code>, <code>obligation_outbound</code>, <code>obligation_reversal_inbound</code>, <code>obligation_reversal_outbound</code>, <code>obligation_payout</code>, <code>obligation_payout_failure</code>, <code>payment</code>, <code>payment_failure_refund</code>, <code>payment_refund</code>, <code>payment_reversal</code>, <code>payment_unreconciled</code>, <code>payout</code>, <code>payout_cancel</code>, <code>payout_failure</code>, <code>refund</code>, <code>refund_failure</code>, <code>reserve_transaction</code>, <code>reserved_funds</code>, <code>stripe_fee</code>, <code>stripe_fx_fee</code>, <code>tax_fee</code>, <code>topup</code>, <code>topup_reversal</code>, <code>transfer</code>, <code>transfer_cancel</code>, <code>transfer_failure</code>, or <code>transfer_refund</code>. Learn more about <a href="https://stripe.com/docs/reports/balance-transaction-types">balance transaction types and what they represent</a>. To classify transactions for accounting purposes, consider <code>reporting_category</code> instead.
*/
class BalanceTransaction extends ApiResource
{
Expand All @@ -40,6 +40,8 @@ class BalanceTransaction extends ApiResource
const TYPE_APPLICATION_FEE = 'application_fee';
const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund';
const TYPE_CHARGE = 'charge';
const TYPE_CLIMATE_ORDER_PURCHASE = 'climate_order_purchase';
const TYPE_CLIMATE_ORDER_REFUND = 'climate_order_refund';
const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer';
const TYPE_CONTRIBUTION = 'contribution';
const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold';
Expand Down
69 changes: 69 additions & 0 deletions lib/Climate/Order.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Climate;

/**
* Orders represent your intent to purchase a particular Climate product. When you create an order, the
* payment is deducted from your merchant balance.
*
* @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_fees Total amount of <a href="https://frontierclimate.com/">Frontier</a>'s service fees in the currency's smallest unit.
* @property int $amount_subtotal Total amount of the carbon removal in the currency's smallest unit.
* @property int $amount_total Total amount of the order including fees in the currency's smallest unit.
* @property null|\Stripe\StripeObject $beneficiary
* @property null|int $canceled_at Time at which the order was canceled. Measured in seconds since the Unix epoch.
* @property null|string $cancellation_reason Reason for the cancellation of this order.
* @property null|string $certificate For delivered orders, a URL to a delivery certificate for the order.
* @property null|int $confirmed_at Time at which the order was confirmed. Measured in seconds since the Unix epoch.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase, representing the currency for this order.
* @property null|int $delayed_at Time at which the order's expected_delivery_year was delayed. Measured in seconds since the Unix epoch.
* @property null|int $delivered_at Time at which the order was delivered. Measured in seconds since the Unix epoch.
* @property \Stripe\StripeObject[] $delivery_details Details about the delivery of carbon removal for this order.
* @property int $expected_delivery_year The year this order is expected to be delivered.
* @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.
* @property \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.
* @property string $metric_tons Quantity of carbon removal that is included in this order.
* @property string|\Stripe\Climate\Product $product Unique ID for the Climate <code>Product</code> this order is purchasing.
* @property null|int $product_substituted_at Time at which the order's product was substituted for a different product. Measured in seconds since the Unix epoch.
* @property string $status The current status of this order.
*/
class Order extends \Stripe\ApiResource
{
const OBJECT_NAME = 'climate.order';

use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;
use \Stripe\ApiOperations\Retrieve;
use \Stripe\ApiOperations\Update;

const CANCELLATION_REASON_EXPIRED = 'expired';
const CANCELLATION_REASON_PRODUCT_UNAVAILABLE = 'product_unavailable';
const CANCELLATION_REASON_REQUESTED = 'requested';

const STATUS_AWAITING_FUNDS = 'awaiting_funds';
const STATUS_CANCELED = 'canceled';
const STATUS_CONFIRMED = 'confirmed';
const STATUS_DELIVERED = 'delivered';
const STATUS_OPEN = 'open';

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Climate\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;
}
}
27 changes: 27 additions & 0 deletions lib/Climate/Product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Climate;

/**
* A Climate product represents a type of carbon removal unit available for reservation.
* You can retrieve it to see the current price and availability.
*
* @property string $id Unique identifier for the object. For convenience, Climate product IDs are human-readable strings that start with <code>climsku_</code>. See <a href="https://stripe.com/docs/climate/orders/carbon-removal-inventory">carbon removal inventory</a> for a list of available carbon removal products.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property \Stripe\StripeObject $current_prices_per_metric_ton Current prices for a metric ton of carbon removal in a currency's smallest unit.
* @property null|int $delivery_year The year in which the carbon removal is expected to be delivered.
* @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.
* @property null|string $metric_tons_available The quantity of metric tons available for reservation.
* @property string $name The Climate product's name.
* @property \Stripe\Climate\Supplier[] $suppliers The carbon removal suppliers that fulfill orders for this Climate product.
*/
class Product extends \Stripe\ApiResource
{
const OBJECT_NAME = 'climate.product';

use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;
}
29 changes: 29 additions & 0 deletions lib/Climate/Supplier.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Climate;

/**
* A supplier of carbon removal.
*
* @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 string $info_url Link to a webpage to learn more about the supplier.
* @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.
* @property \Stripe\StripeObject[] $locations The locations in which this supplier operates.
* @property string $name Name of this carbon removal supplier.
* @property string $removal_pathway The scientific pathway used for carbon removal.
*/
class Supplier extends \Stripe\ApiResource
{
const OBJECT_NAME = 'climate.supplier';

use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;

const REMOVAL_PATHWAY_BIOMASS_CARBON_REMOVAL_AND_STORAGE = 'biomass_carbon_removal_and_storage';
const REMOVAL_PATHWAY_DIRECT_AIR_CAPTURE = 'direct_air_capture';
const REMOVAL_PATHWAY_ENHANCED_WEATHERING = 'enhanced_weathering';
const REMOVAL_PATHWAY_VARIOUS = 'various';
}
1 change: 1 addition & 0 deletions lib/ErrorObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class ErrorObject extends StripeObject
const CODE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized';
const CODE_EMAIL_INVALID = 'email_invalid';
const CODE_EXPIRED_CARD = 'expired_card';
const CODE_FINANCIAL_CONNECTIONS_ACCOUNT_INACTIVE = 'financial_connections_account_inactive';
const CODE_IDEMPOTENCY_KEY_IN_USE = 'idempotency_key_in_use';
const CODE_INCORRECT_ADDRESS = 'incorrect_address';
const CODE_INCORRECT_CVC = 'incorrect_cvc';
Expand Down
14 changes: 14 additions & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ class Event extends ApiResource
const CHECKOUT_SESSION_ASYNC_PAYMENT_SUCCEEDED = 'checkout.session.async_payment_succeeded';
const CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed';
const CHECKOUT_SESSION_EXPIRED = 'checkout.session.expired';
const CLIMATE_ORDER_CANCELED = 'climate.order.canceled';
const CLIMATE_ORDER_CREATED = 'climate.order.created';
const CLIMATE_ORDER_DELAYED = 'climate.order.delayed';
const CLIMATE_ORDER_DELIVERED = 'climate.order.delivered';
const CLIMATE_ORDER_PRODUCT_SUBSTITUTED = 'climate.order.product_substituted';
const CLIMATE_PRODUCT_CREATED = 'climate.product.created';
const CLIMATE_PRODUCT_PRICING_UPDATED = 'climate.product.pricing_updated';
const COUPON_CREATED = 'coupon.created';
const COUPON_DELETED = 'coupon.deleted';
const COUPON_UPDATED = 'coupon.updated';
Expand Down Expand Up @@ -315,6 +322,13 @@ class Event extends ApiResource
const TYPE_CHECKOUT_SESSION_ASYNC_PAYMENT_SUCCEEDED = 'checkout.session.async_payment_succeeded';
const TYPE_CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed';
const TYPE_CHECKOUT_SESSION_EXPIRED = 'checkout.session.expired';
const TYPE_CLIMATE_ORDER_CANCELED = 'climate.order.canceled';
const TYPE_CLIMATE_ORDER_CREATED = 'climate.order.created';
const TYPE_CLIMATE_ORDER_DELAYED = 'climate.order.delayed';
const TYPE_CLIMATE_ORDER_DELIVERED = 'climate.order.delivered';
const TYPE_CLIMATE_ORDER_PRODUCT_SUBSTITUTED = 'climate.order.product_substituted';
const TYPE_CLIMATE_PRODUCT_CREATED = 'climate.product.created';
const TYPE_CLIMATE_PRODUCT_PRICING_UPDATED = 'climate.product.pricing_updated';
const TYPE_COUPON_CREATED = 'coupon.created';
const TYPE_COUPON_DELETED = 'coupon.deleted';
const TYPE_COUPON_UPDATED = 'coupon.updated';
Expand Down
2 changes: 1 addition & 1 deletion lib/PaymentIntent.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* @property null|string $setup_future_usage <p>Indicates that you intend to make future payments with this PaymentIntent's payment method.</p><p>Providing this parameter will <a href="https://stripe.com/docs/payments/save-during-payment">attach the payment method</a> to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be <a href="https://stripe.com/docs/api/payment_methods/attach">attached</a> to a Customer after the transaction completes.</p><p>When processing card payments, Stripe also uses <code>setup_future_usage</code> to dynamically optimize your payment flow and comply with regional legislation and network rules, such as <a href="https://stripe.com/docs/strong-customer-authentication">SCA</a>.</p>
* @property null|\Stripe\StripeObject $shipping Shipping information for this PaymentIntent.
* @property null|string|\Stripe\Account|\Stripe\BankAccount|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied.
* @property null|string $statement_descriptor For non-card charges, you can use this value as the complete description that appears on your customers statements. Must contain at least one letter, maximum 22 characters.
* @property null|string $statement_descriptor For card charges, use <a href="https://stripe.com/docs/payments/account/statement-descriptors#dynamic">statement_descriptor_suffix</a>. Otherwise, you can use this value as the complete description of a charge on your customers' statements. It must contain at least one letter and be 1–22 characters long.
* @property null|string $statement_descriptor_suffix Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
* @property string $status Status of this PaymentIntent, one of <code>requires_payment_method</code>, <code>requires_confirmation</code>, <code>requires_action</code>, <code>processing</code>, <code>requires_capture</code>, <code>canceled</code>, or <code>succeeded</code>. Read more about each PaymentIntent <a href="https://stripe.com/docs/payments/intents#intent-statuses">status</a>.
* @property null|\Stripe\StripeObject $transfer_data The data that automatically creates a Transfer after the payment finalizes. Learn more about the <a href="https://stripe.com/docs/payments/connected-accounts">use case for connected accounts</a>.
Expand Down
29 changes: 29 additions & 0 deletions lib/Service/Climate/ClimateServiceFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\Climate;

/**
* Service factory class for API resources in the Climate namespace.
*
* @property OrderService $orders
* @property ProductService $products
* @property SupplierService $suppliers
*/
class ClimateServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'orders' => OrderService::class,
'products' => ProductService::class,
'suppliers' => SupplierService::class,
];

protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}
Loading

0 comments on commit fc88a57

Please sign in to comment.