class Io::Flow::V0::Clients::PaymentRequests

Public Class Methods

new(client) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 7897
def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Public Instance Methods

get_by_id(organization, id) click to toggle source

Returns information about a specific payment request

# File lib/flow_commerce/flow_api_v0_client.rb, line 7910
def get_by_id(organization, id)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}").get
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
post(organization, payment_request_form) click to toggle source

Creates a new payment

# File lib/flow_commerce/flow_api_v0_client.rb, line 7902
def post(organization, payment_request_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (x = payment_request_form; x.is_a?(::Io::Flow::V0::Models::PaymentRequestForm) ? x : ::Io::Flow::V0::Models::PaymentRequestForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/payment/requests").with_json(payment_request_form.to_json).post
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
post_capture_by_id(organization, id, payment_capture_form) click to toggle source

Captures payment

# File lib/flow_commerce/flow_api_v0_client.rb, line 7928
def post_capture_by_id(organization, id, payment_capture_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = payment_capture_form; x.is_a?(::Io::Flow::V0::Models::PaymentCaptureForm) ? x : ::Io::Flow::V0::Models::PaymentCaptureForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}/capture").with_json(payment_capture_form.to_json).post
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
post_payment_and_method_and_data_by_id(organization, id, payment_method_data) click to toggle source

Update the payment method data to progress the payment through relevant actions

# File lib/flow_commerce/flow_api_v0_client.rb, line 7938
def post_payment_and_method_and_data_by_id(organization, id, payment_method_data)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = payment_method_data; x.is_a?(::Io::Flow::V0::Models::PaymentMethodData) ? x : ::Io::Flow::V0::Models::PaymentMethodData.from_json(x))
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}/payment/method/data").with_json(payment_method_data.to_json).post
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
post_payment_method_data_by_id(organization, id, payment_method_data) click to toggle source

Update the payment method data to progress the payment through relevant actions

# File lib/flow_commerce/flow_api_v0_client.rb, line 7948
def post_payment_method_data_by_id(organization, id, payment_method_data)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = payment_method_data; x.is_a?(::Io::Flow::V0::Models::PaymentMethodData) ? x : ::Io::Flow::V0::Models::PaymentMethodData.from_json(x))
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}/payment_method_data").with_json(payment_method_data.to_json).post
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
post_refund_and_reversal_by_id(organization, id) click to toggle source

Reverses the authorization hold if the authorization is not captured yet otherwise refunds the payment entirely.

# File lib/flow_commerce/flow_api_v0_client.rb, line 7967
def post_refund_and_reversal_by_id(organization, id)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}/refund/reversal").post
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
post_refund_by_id(organization, id, payment_refund_form) click to toggle source

Refunds the payment

# File lib/flow_commerce/flow_api_v0_client.rb, line 7957
def post_refund_by_id(organization, id, payment_refund_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = payment_refund_form; x.is_a?(::Io::Flow::V0::Models::PaymentRefundForm) ? x : ::Io::Flow::V0::Models::PaymentRefundForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}/refund").with_json(payment_refund_form.to_json).post
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
post_reversal_by_id(organization, id, payment_reversal_form) click to toggle source

Reverses payment authorization

# File lib/flow_commerce/flow_api_v0_client.rb, line 7975
def post_reversal_by_id(organization, id, payment_reversal_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = payment_reversal_form; x.is_a?(::Io::Flow::V0::Models::PaymentReversalForm) ? x : ::Io::Flow::V0::Models::PaymentReversalForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}/reversal").with_json(payment_reversal_form.to_json).post
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
post_reverse_by_id(organization, id, payment_reversal_form) click to toggle source

Reverses payment authorization

# File lib/flow_commerce/flow_api_v0_client.rb, line 7984
def post_reverse_by_id(organization, id, payment_reversal_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = payment_reversal_form; x.is_a?(::Io::Flow::V0::Models::PaymentReversalForm) ? x : ::Io::Flow::V0::Models::PaymentReversalForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}/reverse").with_json(payment_reversal_form.to_json).post
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end
put_by_id(organization, id, payment_request_form) click to toggle source

Updates payment request, i.e. by adding authorization data or a new payment method

# File lib/flow_commerce/flow_api_v0_client.rb, line 7919
def put_by_id(organization, id, payment_request_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = payment_request_form; x.is_a?(::Io::Flow::V0::Models::PaymentRequestForm) ? x : ::Io::Flow::V0::Models::PaymentRequestForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/payment/requests/#{CGI.escape(id)}").with_json(payment_request_form.to_json).put
  ::Io::Flow::V0::Models::PaymentRequest.new(r)
end