stripe-ruby/lib/stripe/services/issuing/authorization_service.rb
2024-12-20 19:41:09 +00:00

170 lines
7.8 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Issuing
class AuthorizationService < StripeService
class ListParams < Stripe::RequestParams
class Created < Stripe::RequestParams
# Minimum value to filter by (exclusive)
attr_accessor :gt
# Minimum value to filter by (inclusive)
attr_accessor :gte
# Maximum value to filter by (exclusive)
attr_accessor :lt
# Maximum value to filter by (inclusive)
attr_accessor :lte
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
@gt = gt
@gte = gte
@lt = lt
@lte = lte
end
end
# Only return authorizations that belong to the given card.
attr_accessor :card
# Only return authorizations that belong to the given cardholder.
attr_accessor :cardholder
# Only return authorizations that were created during the given date interval.
attr_accessor :created
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
# Only return authorizations with the given status. One of `pending`, `closed`, or `reversed`.
attr_accessor :status
def initialize(
card: nil,
cardholder: nil,
created: nil,
ending_before: nil,
expand: nil,
limit: nil,
starting_after: nil,
status: nil
)
@card = card
@cardholder = cardholder
@created = created
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
@status = status
end
end
class RetrieveParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
class UpdateParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
def initialize(expand: nil, metadata: nil)
@expand = expand
@metadata = metadata
end
end
class ApproveParams < Stripe::RequestParams
# If the authorization's `pending_request.is_amount_controllable` property is `true`, you may provide this value to control how much to hold for the authorization. Must be positive (use [`decline`](https://stripe.com/docs/api/issuing/authorizations/decline) to decline an authorization request).
attr_accessor :amount
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
def initialize(amount: nil, expand: nil, metadata: nil)
@amount = amount
@expand = expand
@metadata = metadata
end
end
class DeclineParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
def initialize(expand: nil, metadata: nil)
@expand = expand
@metadata = metadata
end
end
# [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
# This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
def approve(authorization, params = {}, opts = {})
request(
method: :post,
path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts,
base_address: :api
)
end
# [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
# This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
def decline(authorization, params = {}, opts = {})
request(
method: :post,
path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts,
base_address: :api
)
end
# Returns a list of Issuing Authorization objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
def list(params = {}, opts = {})
request(
method: :get,
path: "/v1/issuing/authorizations",
params: params,
opts: opts,
base_address: :api
)
end
# Retrieves an Issuing Authorization object.
def retrieve(authorization, params = {}, opts = {})
request(
method: :get,
path: format("/v1/issuing/authorizations/%<authorization>s", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts,
base_address: :api
)
end
# Updates the specified Issuing Authorization object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
def update(authorization, params = {}, opts = {})
request(
method: :post,
path: format("/v1/issuing/authorizations/%<authorization>s", { authorization: CGI.escape(authorization) }),
params: params,
opts: opts,
base_address: :api
)
end
end
end
end