diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 1418e2ae4..23c765cb2 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v680 \ No newline at end of file +v689 \ No newline at end of file diff --git a/init.php b/init.php index 008ca6e91..3b7353232 100644 --- a/init.php +++ b/init.php @@ -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'; @@ -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'; diff --git a/lib/BalanceTransaction.php b/lib/BalanceTransaction.php index 7424aa9e2..d2e1d9250 100644 --- a/lib/BalanceTransaction.php +++ b/lib/BalanceTransaction.php @@ -24,7 +24,7 @@ * @property string $reporting_category Learn more about how reporting categories 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 available or pending. - * @property string $type Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, obligation_inbound, obligation_outbound, obligation_reversal_inbound, obligation_reversal_outbound, obligation_payout, obligation_payout_failure, payment, payment_failure_refund, payment_refund, payment_reversal, payment_unreconciled, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. To classify transactions for accounting purposes, consider reporting_category instead. + * @property string $type Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, climate_order_purchase, climate_order_refund, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, obligation_inbound, obligation_outbound, obligation_reversal_inbound, obligation_reversal_outbound, obligation_payout, obligation_payout_failure, payment, payment_failure_refund, payment_refund, payment_reversal, payment_unreconciled, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. To classify transactions for accounting purposes, consider reporting_category instead. */ class BalanceTransaction extends ApiResource { @@ -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'; diff --git a/lib/Climate/Order.php b/lib/Climate/Order.php new file mode 100644 index 000000000..72763a9f0 --- /dev/null +++ b/lib/Climate/Order.php @@ -0,0 +1,69 @@ +Frontier'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 ISO currency code, 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 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 string $metric_tons Quantity of carbon removal that is included in this order. + * @property string|\Stripe\Climate\Product $product Unique ID for the Climate Product 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; + } +} diff --git a/lib/Climate/Product.php b/lib/Climate/Product.php new file mode 100644 index 000000000..df2280798 --- /dev/null +++ b/lib/Climate/Product.php @@ -0,0 +1,27 @@ +climsku_. See carbon removal inventory 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 true if the object exists in live mode or the value false 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; +} diff --git a/lib/Climate/Supplier.php b/lib/Climate/Supplier.php new file mode 100644 index 000000000..7f2f9fd75 --- /dev/null +++ b/lib/Climate/Supplier.php @@ -0,0 +1,29 @@ +true if the object exists in live mode or the value false 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'; +} diff --git a/lib/ErrorObject.php b/lib/ErrorObject.php index d89cb7ded..821a6959d 100644 --- a/lib/ErrorObject.php +++ b/lib/ErrorObject.php @@ -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'; diff --git a/lib/Event.php b/lib/Event.php index 52c88322e..f430fdf0d 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -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'; @@ -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'; diff --git a/lib/PaymentIntent.php b/lib/PaymentIntent.php index de0a24921..41b293c03 100644 --- a/lib/PaymentIntent.php +++ b/lib/PaymentIntent.php @@ -52,7 +52,7 @@ * @property null|string $setup_future_usage

Indicates that you intend to make future payments with this PaymentIntent's payment method.

Providing this parameter will attach the payment method 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 attached to a Customer after the transaction completes.

When processing card payments, Stripe also uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA.

* @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 statement_descriptor_suffix. 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 requires_payment_method, requires_confirmation, requires_action, processing, requires_capture, canceled, or succeeded. Read more about each PaymentIntent status. * @property null|\Stripe\StripeObject $transfer_data The data that automatically creates a Transfer after the payment finalizes. Learn more about the use case for connected accounts. diff --git a/lib/Service/Climate/ClimateServiceFactory.php b/lib/Service/Climate/ClimateServiceFactory.php new file mode 100644 index 000000000..ff4422ae7 --- /dev/null +++ b/lib/Service/Climate/ClimateServiceFactory.php @@ -0,0 +1,29 @@ + + */ + 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; + } +} diff --git a/lib/Service/Climate/OrderService.php b/lib/Service/Climate/OrderService.php new file mode 100644 index 000000000..7cb1bd36e --- /dev/null +++ b/lib/Service/Climate/OrderService.php @@ -0,0 +1,94 @@ + + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/climate/orders', $params, $opts); + } + + /** + * Cancels a Climate order. You can cancel an order within 30 days of creation. + * Stripe refunds the reservation amount_subtotal, but not the + * amount_fees for user-triggered cancellations. Frontier might cancel + * reservations if suppliers fail to deliver. If Frontier cancels the reservation, + * Stripe provides 90 days advance notice and refunds the + * amount_total. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Climate\Order + */ + public function cancel($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/climate/orders/%s/cancel', $id), $params, $opts); + } + + /** + * Creates a Climate order object for a given Climate product. The order will be + * processed immediately after creation and payment will be deducted your Stripe + * balance. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Climate\Order + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/climate/orders', $params, $opts); + } + + /** + * Retrieves the details of a Climate order object with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Climate\Order + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/climate/orders/%s', $id), $params, $opts); + } + + /** + * Updates the specified order by setting the values of the parameters passed. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Climate\Order + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/climate/orders/%s', $id), $params, $opts); + } +} diff --git a/lib/Service/Climate/ProductService.php b/lib/Service/Climate/ProductService.php new file mode 100644 index 000000000..0a3d14642 --- /dev/null +++ b/lib/Service/Climate/ProductService.php @@ -0,0 +1,39 @@ + + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/climate/products', $params, $opts); + } + + /** + * Retrieves the details of a Climate product with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Climate\Product + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/climate/products/%s', $id), $params, $opts); + } +} diff --git a/lib/Service/Climate/SupplierService.php b/lib/Service/Climate/SupplierService.php new file mode 100644 index 000000000..40eac85f6 --- /dev/null +++ b/lib/Service/Climate/SupplierService.php @@ -0,0 +1,39 @@ + + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/climate/suppliers', $params, $opts); + } + + /** + * Retrieves a Climate supplier object. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Climate\Supplier + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/climate/suppliers/%s', $id), $params, $opts); + } +} diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index 250f85f18..5a6844e87 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -18,6 +18,7 @@ * @property BillingPortal\BillingPortalServiceFactory $billingPortal * @property ChargeService $charges * @property Checkout\CheckoutServiceFactory $checkout + * @property Climate\ClimateServiceFactory $climate * @property CountrySpecService $countrySpecs * @property CouponService $coupons * @property CreditNoteService $creditNotes @@ -88,6 +89,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory 'billingPortal' => BillingPortal\BillingPortalServiceFactory::class, 'charges' => ChargeService::class, 'checkout' => Checkout\CheckoutServiceFactory::class, + 'climate' => Climate\ClimateServiceFactory::class, 'countrySpecs' => CountrySpecService::class, 'coupons' => CouponService::class, 'creditNotes' => CreditNoteService::class, diff --git a/lib/StripeClient.php b/lib/StripeClient.php index 80ec648d9..fe9492e8f 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -18,6 +18,7 @@ * @property \Stripe\Service\BillingPortal\BillingPortalServiceFactory $billingPortal * @property \Stripe\Service\ChargeService $charges * @property \Stripe\Service\Checkout\CheckoutServiceFactory $checkout + * @property \Stripe\Service\Climate\ClimateServiceFactory $climate * @property \Stripe\Service\CountrySpecService $countrySpecs * @property \Stripe\Service\CouponService $coupons * @property \Stripe\Service\CreditNoteService $creditNotes diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index adbdfc469..97cf6fe93 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -31,6 +31,9 @@ class ObjectTypes \Stripe\CashBalance::OBJECT_NAME => \Stripe\CashBalance::class, \Stripe\Charge::OBJECT_NAME => \Stripe\Charge::class, \Stripe\Checkout\Session::OBJECT_NAME => \Stripe\Checkout\Session::class, + \Stripe\Climate\Order::OBJECT_NAME => \Stripe\Climate\Order::class, + \Stripe\Climate\Product::OBJECT_NAME => \Stripe\Climate\Product::class, + \Stripe\Climate\Supplier::OBJECT_NAME => \Stripe\Climate\Supplier::class, \Stripe\CountrySpec::OBJECT_NAME => \Stripe\CountrySpec::class, \Stripe\Coupon::OBJECT_NAME => \Stripe\Coupon::class, \Stripe\CreditNote::OBJECT_NAME => \Stripe\CreditNote::class,