| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._stripe_service import StripeService |
| 4 |
from stripe._util import sanitize_id |
| 5 |
from typing import Optional, cast |
| 6 |
from typing_extensions import TYPE_CHECKING |
| 7 |
|
| 8 |
if TYPE_CHECKING: |
| 9 |
from stripe._list_object import ListObject |
| 10 |
from stripe._request_options import RequestOptions |
| 11 |
from stripe.climate._order import Order |
| 12 |
from stripe.params.climate._order_cancel_params import OrderCancelParams |
| 13 |
from stripe.params.climate._order_create_params import OrderCreateParams |
| 14 |
from stripe.params.climate._order_list_params import OrderListParams |
| 15 |
from stripe.params.climate._order_retrieve_params import ( |
| 16 |
OrderRetrieveParams, |
| 17 |
) |
| 18 |
from stripe.params.climate._order_update_params import OrderUpdateParams |
| 19 |
|
| 20 |
|
| 21 |
class OrderService(StripeService): |
| 22 |
def list( |
| 23 |
self, |
| 24 |
params: Optional["OrderListParams"] = None, |
| 25 |
options: Optional["RequestOptions"] = None, |
| 26 |
) -> "ListObject[Order]": |
| 27 |
""" |
| 28 |
Lists all Climate order objects. The orders are returned sorted by creation date, with the |
| 29 |
most recently created orders appearing first. |
| 30 |
""" |
| 31 |
return cast( |
| 32 |
"ListObject[Order]", |
| 33 |
self._request( |
| 34 |
"get", |
| 35 |
"/v1/climate/orders", |
| 36 |
base_address="api", |
| 37 |
params=params, |
| 38 |
options=options, |
| 39 |
), |
| 40 |
) |
| 41 |
|
| 42 |
async def list_async( |
| 43 |
self, |
| 44 |
params: Optional["OrderListParams"] = None, |
| 45 |
options: Optional["RequestOptions"] = None, |
| 46 |
) -> "ListObject[Order]": |
| 47 |
""" |
| 48 |
Lists all Climate order objects. The orders are returned sorted by creation date, with the |
| 49 |
most recently created orders appearing first. |
| 50 |
""" |
| 51 |
return cast( |
| 52 |
"ListObject[Order]", |
| 53 |
await self._request_async( |
| 54 |
"get", |
| 55 |
"/v1/climate/orders", |
| 56 |
base_address="api", |
| 57 |
params=params, |
| 58 |
options=options, |
| 59 |
), |
| 60 |
) |
| 61 |
|
| 62 |
def create( |
| 63 |
self, |
| 64 |
params: "OrderCreateParams", |
| 65 |
options: Optional["RequestOptions"] = None, |
| 66 |
) -> "Order": |
| 67 |
""" |
| 68 |
Creates a Climate order object for a given Climate product. The order will be processed immediately |
| 69 |
after creation and payment will be deducted your Stripe balance. |
| 70 |
""" |
| 71 |
return cast( |
| 72 |
"Order", |
| 73 |
self._request( |
| 74 |
"post", |
| 75 |
"/v1/climate/orders", |
| 76 |
base_address="api", |
| 77 |
params=params, |
| 78 |
options=options, |
| 79 |
), |
| 80 |
) |
| 81 |
|
| 82 |
async def create_async( |
| 83 |
self, |
| 84 |
params: "OrderCreateParams", |
| 85 |
options: Optional["RequestOptions"] = None, |
| 86 |
) -> "Order": |
| 87 |
""" |
| 88 |
Creates a Climate order object for a given Climate product. The order will be processed immediately |
| 89 |
after creation and payment will be deducted your Stripe balance. |
| 90 |
""" |
| 91 |
return cast( |
| 92 |
"Order", |
| 93 |
await self._request_async( |
| 94 |
"post", |
| 95 |
"/v1/climate/orders", |
| 96 |
base_address="api", |
| 97 |
params=params, |
| 98 |
options=options, |
| 99 |
), |
| 100 |
) |
| 101 |
|
| 102 |
def retrieve( |
| 103 |
self, |
| 104 |
order: str, |
| 105 |
params: Optional["OrderRetrieveParams"] = None, |
| 106 |
options: Optional["RequestOptions"] = None, |
| 107 |
) -> "Order": |
| 108 |
""" |
| 109 |
Retrieves the details of a Climate order object with the given ID. |
| 110 |
""" |
| 111 |
return cast( |
| 112 |
"Order", |
| 113 |
self._request( |
| 114 |
"get", |
| 115 |
"/v1/climate/orders/{order}".format(order=sanitize_id(order)), |
| 116 |
base_address="api", |
| 117 |
params=params, |
| 118 |
options=options, |
| 119 |
), |
| 120 |
) |
| 121 |
|
| 122 |
async def retrieve_async( |
| 123 |
self, |
| 124 |
order: str, |
| 125 |
params: Optional["OrderRetrieveParams"] = None, |
| 126 |
options: Optional["RequestOptions"] = None, |
| 127 |
) -> "Order": |
| 128 |
""" |
| 129 |
Retrieves the details of a Climate order object with the given ID. |
| 130 |
""" |
| 131 |
return cast( |
| 132 |
"Order", |
| 133 |
await self._request_async( |
| 134 |
"get", |
| 135 |
"/v1/climate/orders/{order}".format(order=sanitize_id(order)), |
| 136 |
base_address="api", |
| 137 |
params=params, |
| 138 |
options=options, |
| 139 |
), |
| 140 |
) |
| 141 |
|
| 142 |
def update( |
| 143 |
self, |
| 144 |
order: str, |
| 145 |
params: Optional["OrderUpdateParams"] = None, |
| 146 |
options: Optional["RequestOptions"] = None, |
| 147 |
) -> "Order": |
| 148 |
""" |
| 149 |
Updates the specified order by setting the values of the parameters passed. |
| 150 |
""" |
| 151 |
return cast( |
| 152 |
"Order", |
| 153 |
self._request( |
| 154 |
"post", |
| 155 |
"/v1/climate/orders/{order}".format(order=sanitize_id(order)), |
| 156 |
base_address="api", |
| 157 |
params=params, |
| 158 |
options=options, |
| 159 |
), |
| 160 |
) |
| 161 |
|
| 162 |
async def update_async( |
| 163 |
self, |
| 164 |
order: str, |
| 165 |
params: Optional["OrderUpdateParams"] = None, |
| 166 |
options: Optional["RequestOptions"] = None, |
| 167 |
) -> "Order": |
| 168 |
""" |
| 169 |
Updates the specified order by setting the values of the parameters passed. |
| 170 |
""" |
| 171 |
return cast( |
| 172 |
"Order", |
| 173 |
await self._request_async( |
| 174 |
"post", |
| 175 |
"/v1/climate/orders/{order}".format(order=sanitize_id(order)), |
| 176 |
base_address="api", |
| 177 |
params=params, |
| 178 |
options=options, |
| 179 |
), |
| 180 |
) |
| 181 |
|
| 182 |
def cancel( |
| 183 |
self, |
| 184 |
order: str, |
| 185 |
params: Optional["OrderCancelParams"] = None, |
| 186 |
options: Optional["RequestOptions"] = None, |
| 187 |
) -> "Order": |
| 188 |
""" |
| 189 |
Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the |
| 190 |
reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier |
| 191 |
might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe |
| 192 |
provides 90 days advance notice and refunds the amount_total. |
| 193 |
""" |
| 194 |
return cast( |
| 195 |
"Order", |
| 196 |
self._request( |
| 197 |
"post", |
| 198 |
"/v1/climate/orders/{order}/cancel".format( |
| 199 |
order=sanitize_id(order), |
| 200 |
), |
| 201 |
base_address="api", |
| 202 |
params=params, |
| 203 |
options=options, |
| 204 |
), |
| 205 |
) |
| 206 |
|
| 207 |
async def cancel_async( |
| 208 |
self, |
| 209 |
order: str, |
| 210 |
params: Optional["OrderCancelParams"] = None, |
| 211 |
options: Optional["RequestOptions"] = None, |
| 212 |
) -> "Order": |
| 213 |
""" |
| 214 |
Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the |
| 215 |
reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier |
| 216 |
might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe |
| 217 |
provides 90 days advance notice and refunds the amount_total. |
| 218 |
""" |
| 219 |
return cast( |
| 220 |
"Order", |
| 221 |
await self._request_async( |
| 222 |
"post", |
| 223 |
"/v1/climate/orders/{order}/cancel".format( |
| 224 |
order=sanitize_id(order), |
| 225 |
), |
| 226 |
base_address="api", |
| 227 |
params=params, |
| 228 |
options=options, |
| 229 |
), |
| 230 |
) |