mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-06 00:02:18 -04:00
* Support for APIs in the new API version 2024-09-30.acacia (#1458) * remove parseSnapshotEvent (#1463) * Bump version to 13.0.0 * Fixed API Version --------- Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com> Co-authored-by: Ramya Rao <ramya@stripe.com> Co-authored-by: Prathmesh Ranaut <prathmesh@stripe.com>
79 lines
2.7 KiB
Ruby
79 lines
2.7 KiB
Ruby
# File generated from our OpenAPI spec
|
|
# frozen_string_literal: true
|
|
|
|
module Stripe
|
|
class OrderService < StripeService
|
|
attr_reader :line_items
|
|
|
|
def initialize(requestor)
|
|
super(requestor)
|
|
@line_items = Stripe::OrderLineItemService.new(@requestor)
|
|
end
|
|
|
|
# Cancels the order as well as the payment intent if one is attached.
|
|
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
|
|
|
|
# Creates a new open order object.
|
|
def create(params = {}, opts = {})
|
|
request(method: :post, path: "/v1/orders", params: params, opts: opts, base_address: :api)
|
|
end
|
|
|
|
# Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
|
|
def list(params = {}, opts = {})
|
|
request(method: :get, path: "/v1/orders", params: params, opts: opts, base_address: :api)
|
|
end
|
|
|
|
# Reopens a submitted order.
|
|
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
|
|
|
|
# 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.
|
|
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
|
|
|
|
# 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](https://stripe.com/docs/api#reopen_order) method is called.
|
|
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
|
|
|
|
# Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
|
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
|
|
end
|
|
end
|