Class: Stripe::OrderService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::OrderService
- Defined in:
- lib/stripe/services/order_service.rb
Defined Under Namespace
Classes: CancelParams, CreateParams, ListParams, ReopenParams, RetrieveParams, SubmitParams, UpdateParams
Instance Attribute Summary collapse
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
Instance Method Summary collapse
-
#cancel(id, params = {}, opts = {}) ⇒ Object
Cancels the order as well as the payment intent if one is attached.
-
#create(params = {}, opts = {}) ⇒ Object
Creates a new open order object.
-
#initialize(requestor) ⇒ OrderService
constructor
A new instance of OrderService.
-
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your orders.
-
#reopen(id, params = {}, opts = {}) ⇒ Object
Reopens a submitted order.
-
#retrieve(id, params = {}, opts = {}) ⇒ Object
Retrieves the details of an existing order.
-
#submit(id, params = {}, opts = {}) ⇒ Object
Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid.
-
#update(id, params = {}, opts = {}) ⇒ Object
Updates the specific order by setting the values of the parameters passed.
Methods inherited from StripeService
Constructor Details
#initialize(requestor) ⇒ OrderService
Returns a new instance of OrderService.
8 9 10 11 |
# File 'lib/stripe/services/order_service.rb', line 8 def initialize(requestor) super @line_items = Stripe::OrderLineItemService.new(@requestor) end |
Instance Attribute Details
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
6 7 8 |
# File 'lib/stripe/services/order_service.rb', line 6 def line_items @line_items end |
Instance Method Details
#cancel(id, params = {}, opts = {}) ⇒ Object
Cancels the order as well as the payment intent if one is attached.
2172 2173 2174 2175 2176 2177 2178 2179 2180 |
# File 'lib/stripe/services/order_service.rb', line 2172 def cancel(id, params = {}, opts = {}) request( method: :post, path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#create(params = {}, opts = {}) ⇒ Object
Creates a new open order object.
2183 2184 2185 |
# File 'lib/stripe/services/order_service.rb', line 2183 def create(params = {}, opts = {}) request(method: :post, path: "/v1/orders", params: params, opts: opts, base_address: :api) end |
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
2188 2189 2190 |
# File 'lib/stripe/services/order_service.rb', line 2188 def list(params = {}, opts = {}) request(method: :get, path: "/v1/orders", params: params, opts: opts, base_address: :api) end |
#reopen(id, params = {}, opts = {}) ⇒ Object
Reopens a submitted order.
2193 2194 2195 2196 2197 2198 2199 2200 2201 |
# File 'lib/stripe/services/order_service.rb', line 2193 def reopen(id, params = {}, opts = {}) request( method: :post, path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#retrieve(id, params = {}, opts = {}) ⇒ Object
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.
2204 2205 2206 2207 2208 2209 2210 2211 2212 |
# File 'lib/stripe/services/order_service.rb', line 2204 def retrieve(id, params = {}, opts = {}) request( method: :get, path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#submit(id, params = {}, opts = {}) ⇒ Object
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](docs.stripe.com/api#reopen_order) method is called.
2215 2216 2217 2218 2219 2220 2221 2222 2223 |
# File 'lib/stripe/services/order_service.rb', line 2215 def submit(id, params = {}, opts = {}) request( method: :post, path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#update(id, params = {}, opts = {}) ⇒ Object
Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
2226 2227 2228 2229 2230 2231 2232 2233 2234 |
# File 'lib/stripe/services/order_service.rb', line 2226 def update(id, params = {}, opts = {}) request( method: :post, path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |