Class: Io::Flow::V0::Clients::PaymentRequests
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::PaymentRequests
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get_by_id(organization, id) ⇒ Object
Returns information about a specific payment request.
-
#initialize(client) ⇒ PaymentRequests
constructor
A new instance of PaymentRequests.
-
#post(organization, payment_request_form) ⇒ Object
Creates a new payment.
-
#post_capture_by_id(organization, id, payment_capture_form) ⇒ Object
Captures payment.
-
#post_payment_method_data_by_id(organization, id, payment_method_data) ⇒ Object
Update the payment method data to progress the payment through relevant actions.
-
#post_refund_by_id(organization, id, payment_refund_form) ⇒ Object
Refunds the payment.
-
#post_reverse_by_id(organization, id, payment_reversal_form) ⇒ Object
Reverses payment authorization.
-
#put_by_id(organization, id, payment_request_form) ⇒ Object
Updates payment request, i.e.
Constructor Details
#initialize(client) ⇒ PaymentRequests
Returns a new instance of PaymentRequests.
7233 7234 7235 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7233 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get_by_id(organization, id) ⇒ Object
Returns information about a specific payment request
7246 7247 7248 7249 7250 7251 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7246 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) ⇒ Object
Creates a new payment
7238 7239 7240 7241 7242 7243 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7238 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) ⇒ Object
Captures payment
7264 7265 7266 7267 7268 7269 7270 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7264 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_method_data_by_id(organization, id, payment_method_data) ⇒ Object
Update the payment method data to progress the payment through relevant actions
7274 7275 7276 7277 7278 7279 7280 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7274 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_by_id(organization, id, payment_refund_form) ⇒ Object
Refunds the payment
7283 7284 7285 7286 7287 7288 7289 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7283 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_reverse_by_id(organization, id, payment_reversal_form) ⇒ Object
Reverses payment authorization
7292 7293 7294 7295 7296 7297 7298 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7292 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) ⇒ Object
Updates payment request, i.e. by adding authorization data or a new payment method
7255 7256 7257 7258 7259 7260 7261 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7255 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 |