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_and_method_and_data_by_id(organization, id, payment_method_data) ⇒ Object
Update the payment method data to progress the payment through relevant actions.
-
#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_and_reversal_by_id(organization, id) ⇒ Object
Reverses the authorization hold if the authorization is not captured yet otherwise refunds the payment entirely.
-
#post_refund_by_id(organization, id, payment_refund_form) ⇒ Object
Refunds the payment.
-
#post_reversal_by_id(organization, id, payment_reversal_form) ⇒ Object
Reverses payment authorization.
-
#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.
7897 7898 7899 |
# 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 |
Instance Method Details
#get_by_id(organization, id) ⇒ Object
Returns information about a specific payment request
7910 7911 7912 7913 7914 7915 |
# 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) ⇒ Object
Creates a new payment
7902 7903 7904 7905 7906 7907 |
# 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) ⇒ Object
Captures payment
7928 7929 7930 7931 7932 7933 7934 |
# 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) ⇒ Object
Update the payment method data to progress the payment through relevant actions
7938 7939 7940 7941 7942 7943 7944 |
# 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) ⇒ Object
Update the payment method data to progress the payment through relevant actions
7948 7949 7950 7951 7952 7953 7954 |
# 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) ⇒ Object
Reverses the authorization hold if the authorization is not captured yet otherwise refunds the payment entirely.
7967 7968 7969 7970 7971 7972 |
# 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) ⇒ Object
Refunds the payment
7957 7958 7959 7960 7961 7962 7963 |
# 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) ⇒ Object
Reverses payment authorization
7975 7976 7977 7978 7979 7980 7981 |
# 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) ⇒ Object
Reverses payment authorization
7984 7985 7986 7987 7988 7989 7990 |
# 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) ⇒ Object
Updates payment request, i.e. by adding authorization data or a new payment method
7919 7920 7921 7922 7923 7924 7925 |
# 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 |