payabli 3.0.19 → 3.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.fern/metadata.json +3 -3
- data/lib/payabli/applications/client.rb +735 -0
- data/lib/payabli/applications/types/create_application_request.rb +27 -0
- data/lib/payabli/applications/types/list_applications_applications_request.rb +13 -0
- data/lib/payabli/applications/types/submit_application_request.rb +13 -0
- data/lib/payabli/applications/types/update_application_request.rb +25 -0
- data/lib/payabli/applications/types/upload_application_document_request.rb +11 -0
- data/lib/payabli/applications/types/withdraw_application_request.rb +13 -0
- data/lib/payabli/boarding/client.rb +90 -0
- data/lib/payabli/boarding_templates/client.rb +196 -0
- data/lib/payabli/boarding_templates/types/list_templates_boarding_templates_request.rb +25 -0
- data/lib/payabli/businesses/client.rb +796 -0
- data/lib/payabli/businesses/types/create_business_address_request.rb +31 -0
- data/lib/payabli/businesses/types/deactivate_business_request.rb +13 -0
- data/lib/payabli/businesses/types/link_business_person_request.rb +35 -0
- data/lib/payabli/businesses/types/list_businesses_businesses_request.rb +25 -0
- data/lib/payabli/businesses/types/update_business_address_request.rb +33 -0
- data/lib/payabli/businesses/types/update_business_person_request.rb +35 -0
- data/lib/payabli/businesses/types/update_business_request.rb +63 -0
- data/lib/payabli/businesses/types/update_business_request_legal_structure.rb +21 -0
- data/lib/payabli/businesses/types/update_business_request_operating_seasons_item.rb +16 -0
- data/lib/payabli/client.rb +36 -1
- data/lib/payabli/export/client.rb +2 -3
- data/lib/payabli/organization/client.rb +5 -5
- data/lib/payabli/organizations/client.rb +214 -0
- data/lib/payabli/organizations/types/create_organization_organizations_request.rb +17 -0
- data/lib/payabli/organizations/types/list_organizations_organizations_request.rb +19 -0
- data/lib/payabli/organizations/types/update_organization_request.rb +27 -0
- data/lib/payabli/payment_methods/client.rb +254 -0
- data/lib/payabli/payment_methods/types/create_payment_methods_request.rb +11 -0
- data/lib/payabli/payment_methods/types/list_payment_methods_payment_methods_request.rb +25 -0
- data/lib/payabli/payment_methods/types/update_payment_method_request.rb +23 -0
- data/lib/payabli/paypoints/client.rb +204 -0
- data/lib/payabli/paypoints/types/create_paypoint_paypoints_request.rb +17 -0
- data/lib/payabli/paypoints/types/list_paypoints_paypoints_request.rb +19 -0
- data/lib/payabli/paypoints/types/update_paypoint_request.rb +29 -0
- data/lib/payabli/people/client.rb +428 -0
- data/lib/payabli/people/types/create_person_request.rb +47 -0
- data/lib/payabli/people/types/list_people_people_request.rb +23 -0
- data/lib/payabli/people/types/search_people_request.rb +15 -0
- data/lib/payabli/people/types/search_people_unmasked_request.rb +15 -0
- data/lib/payabli/people/types/update_person_request.rb +41 -0
- data/lib/payabli/templates/client.rb +25 -0
- data/lib/payabli/types/address_type.rb +16 -0
- data/lib/payabli/types/application.rb +46 -0
- data/lib/payabli/types/application_common.rb +42 -0
- data/lib/payabli/types/application_document.rb +26 -0
- data/lib/payabli/types/application_document_envelope.rb +16 -0
- data/lib/payabli/types/application_document_error.rb +16 -0
- data/lib/payabli/types/application_document_list_envelope.rb +16 -0
- data/lib/payabli/types/application_envelope.rb +16 -0
- data/lib/payabli/types/application_links.rb +12 -0
- data/lib/payabli/types/application_list_item.rb +52 -0
- data/lib/payabli/types/bank_account_services.rb +2 -2
- data/lib/payabli/types/boarding_warning.rb +12 -0
- data/lib/payabli/types/business_address.rb +28 -0
- data/lib/payabli/types/business_address_create.rb +28 -0
- data/lib/payabli/types/business_address_deleted_envelope.rb +16 -0
- data/lib/payabli/types/business_address_deleted_response.rb +16 -0
- data/lib/payabli/types/business_address_envelope.rb +16 -0
- data/lib/payabli/types/business_address_links.rb +12 -0
- data/lib/payabli/types/business_address_list_envelope.rb +16 -0
- data/lib/payabli/types/business_address_location.rb +15 -0
- data/lib/payabli/types/business_address_response.rb +32 -0
- data/lib/payabli/types/business_created_envelope.rb +18 -0
- data/lib/payabli/types/business_created_response.rb +16 -0
- data/lib/payabli/types/business_deactivated_envelope.rb +18 -0
- data/lib/payabli/types/business_deactivated_response.rb +18 -0
- data/lib/payabli/types/business_detail_envelope.rb +18 -0
- data/lib/payabli/types/business_detail_response.rb +76 -0
- data/lib/payabli/types/business_detail_response_legal_structure.rb +17 -0
- data/lib/payabli/types/business_detail_response_operating_seasons_item.rb +14 -0
- data/lib/payabli/types/business_links.rb +10 -0
- data/lib/payabli/types/business_payment_method.rb +36 -0
- data/lib/payabli/types/business_person_envelope.rb +16 -0
- data/lib/payabli/types/business_person_link.rb +42 -0
- data/lib/payabli/types/business_person_links.rb +14 -0
- data/lib/payabli/types/business_person_list_envelope.rb +16 -0
- data/lib/payabli/types/business_relationship_request.rb +35 -0
- data/lib/payabli/types/business_relationship_response.rb +36 -0
- data/lib/payabli/types/business_summary_response.rb +22 -0
- data/lib/payabli/types/business_updated_envelope.rb +18 -0
- data/lib/payabli/types/business_updated_response.rb +14 -0
- data/lib/payabli/types/case_management_money_in_service.rb +17 -0
- data/lib/payabli/types/case_management_money_out_service.rb +17 -0
- data/lib/payabli/types/certification_detail.rb +18 -0
- data/lib/payabli/types/create_business_request.rb +64 -0
- data/lib/payabli/types/create_business_request_legal_structure.rb +19 -0
- data/lib/payabli/types/create_business_request_operating_seasons_item.rb +14 -0
- data/lib/payabli/types/create_organization_all_fields.rb +30 -0
- data/lib/payabli/types/create_organization_with_business_reference.rb +29 -0
- data/lib/payabli/types/create_organization_with_inline_business.rb +29 -0
- data/lib/payabli/types/create_payment_method_request.rb +28 -0
- data/lib/payabli/types/create_payment_method_request_type.rb +11 -0
- data/lib/payabli/types/create_paypoint_all_fields.rb +32 -0
- data/lib/payabli/types/create_paypoint_with_business_reference.rb +31 -0
- data/lib/payabli/types/create_paypoint_with_inline_business.rb +31 -0
- data/lib/payabli/types/document_requirement.rb +31 -0
- data/lib/payabli/types/document_requirement_list_envelope.rb +16 -0
- data/lib/payabli/types/document_requirement_source.rb +12 -0
- data/lib/payabli/types/document_subject_type.rb +13 -0
- data/lib/payabli/types/enablement_envelope.rb +16 -0
- data/lib/payabli/types/enablement_result.rb +24 -0
- data/lib/payabli/types/enablement_service.rb +18 -0
- data/lib/payabli/types/get_basic_organization_response.rb +15 -0
- data/lib/payabli/types/identification_document_request.rb +18 -0
- data/lib/payabli/types/identification_document_response.rb +18 -0
- data/lib/payabli/types/instrument_response.rb +22 -0
- data/lib/payabli/types/list_applications_envelope.rb +16 -0
- data/lib/payabli/types/list_applications_response.rb +16 -0
- data/lib/payabli/types/list_businesses_envelope.rb +18 -0
- data/lib/payabli/types/list_businesses_response.rb +12 -0
- data/lib/payabli/types/list_payment_methods_envelope.rb +16 -0
- data/lib/payabli/types/list_payment_methods_response.rb +12 -0
- data/lib/payabli/types/list_paypoints_envelope.rb +16 -0
- data/lib/payabli/types/list_paypoints_response.rb +16 -0
- data/lib/payabli/types/list_people_envelope.rb +16 -0
- data/lib/payabli/types/list_people_response.rb +12 -0
- data/lib/payabli/types/list_templates_response.rb +12 -0
- data/lib/payabli/types/methods_list_out.rb +4 -0
- data/lib/payabli/types/organization_query_record.rb +23 -21
- data/lib/payabli/types/organization_writable_fields.rb +28 -0
- data/lib/payabli/types/pagination.rb +20 -0
- data/lib/payabli/types/payabli_credentials_pascal.rb +2 -2
- data/lib/payabli/types/payment_method_deactivated_envelope.rb +16 -0
- data/lib/payabli/types/payment_method_detail.rb +38 -0
- data/lib/payabli/types/payment_method_detail_envelope.rb +16 -0
- data/lib/payabli/types/payment_method_links.rb +12 -0
- data/lib/payabli/types/payment_method_owner_type.rb +12 -0
- data/lib/payabli/types/payment_method_result.rb +40 -0
- data/lib/payabli/types/payment_method_updated_envelope.rb +16 -0
- data/lib/payabli/types/payment_method_usage.rb +16 -0
- data/lib/payabli/types/payment_methods_created_envelope.rb +16 -0
- data/lib/payabli/types/payout_metrics.rb +16 -0
- data/lib/payabli/types/paypoint_created_envelope.rb +16 -0
- data/lib/payabli/types/paypoint_created_response.rb +22 -0
- data/lib/payabli/types/paypoint_detail_envelope.rb +16 -0
- data/lib/payabli/types/paypoint_detail_response.rb +40 -0
- data/lib/payabli/types/paypoint_links.rb +12 -0
- data/lib/payabli/types/paypoint_summary_response.rb +40 -0
- data/lib/payabli/types/paypoint_updated_envelope.rb +16 -0
- data/lib/payabli/types/paypoint_updated_response.rb +14 -0
- data/lib/payabli/types/paypoint_writable_fields.rb +28 -0
- data/lib/payabli/types/people_search_envelope.rb +16 -0
- data/lib/payabli/types/people_search_request.rb +12 -0
- data/lib/payabli/types/people_search_result_response.rb +38 -0
- data/lib/payabli/types/people_search_results_response.rb +14 -0
- data/lib/payabli/types/person_address_request.rb +22 -0
- data/lib/payabli/types/person_address_response.rb +22 -0
- data/lib/payabli/types/person_address_type.rb +17 -0
- data/lib/payabli/types/person_detail_envelope.rb +18 -0
- data/lib/payabli/types/person_detail_response.rb +56 -0
- data/lib/payabli/types/person_links.rb +12 -0
- data/lib/payabli/types/person_summary_response.rb +24 -0
- data/lib/payabli/types/person_type.rb +16 -0
- data/lib/payabli/types/person_updated_envelope.rb +16 -0
- data/lib/payabli/types/person_updated_response.rb +14 -0
- data/lib/payabli/types/processing_metrics.rb +30 -0
- data/lib/payabli/types/representative_input.rb +20 -0
- data/lib/payabli/types/representative_response.rb +20 -0
- data/lib/payabli/types/requested_services.rb +13 -0
- data/lib/payabli/types/signature_type.rb +13 -0
- data/lib/payabli/types/status_history_entry.rb +22 -0
- data/lib/payabli/types/status_history_envelope.rb +16 -0
- data/lib/payabli/types/status_history_result.rb +12 -0
- data/lib/payabli/types/submit_application_error.rb +16 -0
- data/lib/payabli/types/submit_signer.rb +32 -0
- data/lib/payabli/types/template.rb +38 -0
- data/lib/payabli/types/template_status.rb +12 -0
- data/lib/payabli/types/template_version.rb +79 -0
- data/lib/payabli/types/templates_summary.rb +14 -0
- data/lib/payabli/types/transition_result.rb +14 -0
- data/lib/payabli/types/transition_result_envelope.rb +16 -0
- data/lib/payabli/types/underwriting_mode.rb +13 -0
- data/lib/payabli/types/validation_missing_field.rb +14 -0
- data/lib/payabli/types/validation_result.rb +14 -0
- data/lib/payabli/types/validation_result_envelope.rb +16 -0
- data/lib/payabli/types/validation_section.rb +12 -0
- data/lib/payabli/types/validation_sections.rb +16 -0
- data/lib/payabli/version.rb +1 -1
- data/lib/payabli.rb +173 -4
- data/reference.md +5643 -221
- data/wiremock/wiremock-mappings.json +1727 -8
- metadata +171 -2
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module PaymentMethods
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Payabli::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Lists payment methods with optional filtering and pagination.
|
|
14
|
+
#
|
|
15
|
+
# @param request_options [Hash]
|
|
16
|
+
# @param params [Hash]
|
|
17
|
+
# @option request_options [String] :base_url
|
|
18
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
19
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
21
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
22
|
+
# @option params [String, nil] :account_owner
|
|
23
|
+
# @option params [Payabli::Types::PaymentMethodOwnerType, nil] :owner_type
|
|
24
|
+
# @option params [String, nil] :status
|
|
25
|
+
# @option params [String, nil] :type
|
|
26
|
+
# @option params [Integer, nil] :limit
|
|
27
|
+
# @option params [Integer, nil] :page
|
|
28
|
+
# @option params [String, nil] :sort_by
|
|
29
|
+
# @option params [String, nil] :sort_order
|
|
30
|
+
#
|
|
31
|
+
# @example
|
|
32
|
+
# client.payment_methods.list_payment_methods(
|
|
33
|
+
# limit: 1,
|
|
34
|
+
# page: 1
|
|
35
|
+
# )
|
|
36
|
+
#
|
|
37
|
+
# @return [Payabli::Types::ListPaymentMethodsEnvelope]
|
|
38
|
+
def list_payment_methods(request_options: {}, **params)
|
|
39
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
40
|
+
query_params = {}
|
|
41
|
+
query_params["accountOwner"] = params[:account_owner] if params.key?(:account_owner)
|
|
42
|
+
query_params["ownerType"] = params[:owner_type] if params.key?(:owner_type)
|
|
43
|
+
query_params["status"] = params[:status] if params.key?(:status)
|
|
44
|
+
query_params["type"] = params[:type] if params.key?(:type)
|
|
45
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
46
|
+
query_params["page"] = params[:page] if params.key?(:page)
|
|
47
|
+
query_params["sortBy"] = params[:sort_by] if params.key?(:sort_by)
|
|
48
|
+
query_params["sortOrder"] = params[:sort_order] if params.key?(:sort_order)
|
|
49
|
+
|
|
50
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
51
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
52
|
+
base_url: request_options[:base_url],
|
|
53
|
+
method: "GET",
|
|
54
|
+
path: "v2/payment-methods",
|
|
55
|
+
headers: headers,
|
|
56
|
+
query: query_params,
|
|
57
|
+
request_options: request_options
|
|
58
|
+
)
|
|
59
|
+
begin
|
|
60
|
+
response = @client.send(request)
|
|
61
|
+
rescue Net::HTTPRequestTimeout
|
|
62
|
+
raise Payabli::Errors::TimeoutError
|
|
63
|
+
end
|
|
64
|
+
code = response.code.to_i
|
|
65
|
+
if code.between?(200, 299)
|
|
66
|
+
Payabli::Types::ListPaymentMethodsEnvelope.load(response.body)
|
|
67
|
+
else
|
|
68
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
69
|
+
raise error_class.new(response.body, code: code)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Creates one or more payment methods for an entity in a single call.
|
|
74
|
+
# Set each payment method's `accountOwner` to the entity it belongs to.
|
|
75
|
+
#
|
|
76
|
+
# @param request_options [Hash]
|
|
77
|
+
# @param params [Payabli::PaymentMethods::Types::CreatePaymentMethodsRequest]
|
|
78
|
+
# @option request_options [String] :base_url
|
|
79
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
80
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
81
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
82
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
83
|
+
#
|
|
84
|
+
# @example
|
|
85
|
+
# client.payment_methods.create_payment_methods(data: [{
|
|
86
|
+
# type: "bank_account",
|
|
87
|
+
# account_owner: "019fed1a-3d6e-75d3-a81e-cba3874b0a55",
|
|
88
|
+
# owner_type: "business",
|
|
89
|
+
# account_type: "checking",
|
|
90
|
+
# account_number: "123456789",
|
|
91
|
+
# routing_number: "021000021",
|
|
92
|
+
# nickname: "Operating account",
|
|
93
|
+
# financial_institution: "Bank of Example",
|
|
94
|
+
# usage: %w[deposits billing]
|
|
95
|
+
# }])
|
|
96
|
+
#
|
|
97
|
+
# @return [Payabli::Types::PaymentMethodsCreatedEnvelope]
|
|
98
|
+
def create_payment_methods(request_options: {}, **params)
|
|
99
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
100
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
101
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
102
|
+
base_url: request_options[:base_url],
|
|
103
|
+
method: "POST",
|
|
104
|
+
path: "v2/payment-methods",
|
|
105
|
+
headers: headers,
|
|
106
|
+
body: Payabli::PaymentMethods::Types::CreatePaymentMethodsRequest.new(params).to_h,
|
|
107
|
+
request_options: request_options
|
|
108
|
+
)
|
|
109
|
+
begin
|
|
110
|
+
response = @client.send(request)
|
|
111
|
+
rescue Net::HTTPRequestTimeout
|
|
112
|
+
raise Payabli::Errors::TimeoutError
|
|
113
|
+
end
|
|
114
|
+
code = response.code.to_i
|
|
115
|
+
if code.between?(200, 299)
|
|
116
|
+
Payabli::Types::PaymentMethodsCreatedEnvelope.load(response.body)
|
|
117
|
+
else
|
|
118
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
119
|
+
raise error_class.new(response.body, code: code)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Retrieves a payment method by reference. Sensitive fields such as the account and routing numbers are masked.
|
|
124
|
+
#
|
|
125
|
+
# @param request_options [Hash]
|
|
126
|
+
# @param params [Hash]
|
|
127
|
+
# @option request_options [String] :base_url
|
|
128
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
129
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
130
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
131
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
132
|
+
# @option params [String] :payment_method_reference
|
|
133
|
+
#
|
|
134
|
+
# @example
|
|
135
|
+
# client.payment_methods.get_payment_method(payment_method_reference: "019ff142-454b-7721-96a3-c8628b9d568f")
|
|
136
|
+
#
|
|
137
|
+
# @return [Payabli::Types::PaymentMethodDetailEnvelope]
|
|
138
|
+
def get_payment_method(request_options: {}, **params)
|
|
139
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
140
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
141
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
142
|
+
base_url: request_options[:base_url],
|
|
143
|
+
method: "GET",
|
|
144
|
+
path: "v2/payment-methods/#{URI.encode_uri_component(params[:payment_method_reference].to_s)}",
|
|
145
|
+
headers: headers,
|
|
146
|
+
request_options: request_options
|
|
147
|
+
)
|
|
148
|
+
begin
|
|
149
|
+
response = @client.send(request)
|
|
150
|
+
rescue Net::HTTPRequestTimeout
|
|
151
|
+
raise Payabli::Errors::TimeoutError
|
|
152
|
+
end
|
|
153
|
+
code = response.code.to_i
|
|
154
|
+
if code.between?(200, 299)
|
|
155
|
+
Payabli::Types::PaymentMethodDetailEnvelope.load(response.body)
|
|
156
|
+
else
|
|
157
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
158
|
+
raise error_class.new(response.body, code: code)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Deactivates a payment method. This is a soft delete: the payment
|
|
163
|
+
# method moves to `INACTIVE` and the record is kept.
|
|
164
|
+
#
|
|
165
|
+
# @param request_options [Hash]
|
|
166
|
+
# @param params [Hash]
|
|
167
|
+
# @option request_options [String] :base_url
|
|
168
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
169
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
170
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
171
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
172
|
+
# @option params [String] :payment_method_reference
|
|
173
|
+
#
|
|
174
|
+
# @example
|
|
175
|
+
# client.payment_methods.deactivate_payment_method(payment_method_reference: "019ff142-454b-7721-96a3-c8628b9d568f")
|
|
176
|
+
#
|
|
177
|
+
# @return [Payabli::Types::PaymentMethodDeactivatedEnvelope]
|
|
178
|
+
def deactivate_payment_method(request_options: {}, **params)
|
|
179
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
180
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
181
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
182
|
+
base_url: request_options[:base_url],
|
|
183
|
+
method: "DELETE",
|
|
184
|
+
path: "v2/payment-methods/#{URI.encode_uri_component(params[:payment_method_reference].to_s)}",
|
|
185
|
+
headers: headers,
|
|
186
|
+
request_options: request_options
|
|
187
|
+
)
|
|
188
|
+
begin
|
|
189
|
+
response = @client.send(request)
|
|
190
|
+
rescue Net::HTTPRequestTimeout
|
|
191
|
+
raise Payabli::Errors::TimeoutError
|
|
192
|
+
end
|
|
193
|
+
code = response.code.to_i
|
|
194
|
+
if code.between?(200, 299)
|
|
195
|
+
Payabli::Types::PaymentMethodDeactivatedEnvelope.load(response.body)
|
|
196
|
+
else
|
|
197
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
198
|
+
raise error_class.new(response.body, code: code)
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Applies a partial update to a payment method. Send only the fields you
|
|
203
|
+
# want to change. Only payment methods in `PENDING` status can be updated.
|
|
204
|
+
# Once a payment method is active, change it through the bank account
|
|
205
|
+
# change process instead.
|
|
206
|
+
#
|
|
207
|
+
# @param request_options [Hash]
|
|
208
|
+
# @param params [Payabli::PaymentMethods::Types::UpdatePaymentMethodRequest]
|
|
209
|
+
# @option request_options [String] :base_url
|
|
210
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
211
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
212
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
213
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
214
|
+
# @option params [String] :payment_method_reference
|
|
215
|
+
#
|
|
216
|
+
# @example
|
|
217
|
+
# client.payment_methods.update_payment_method(
|
|
218
|
+
# payment_method_reference: "019ff142-454b-7721-96a3-c8628b9d568f",
|
|
219
|
+
# nickname: "Primary operating account",
|
|
220
|
+
# usage: %w[deposits billing]
|
|
221
|
+
# )
|
|
222
|
+
#
|
|
223
|
+
# @return [Payabli::Types::PaymentMethodUpdatedEnvelope]
|
|
224
|
+
def update_payment_method(request_options: {}, **params)
|
|
225
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
226
|
+
request_data = Payabli::PaymentMethods::Types::UpdatePaymentMethodRequest.new(params).to_h
|
|
227
|
+
non_body_param_names = %w[paymentMethodReference]
|
|
228
|
+
body = request_data.except(*non_body_param_names)
|
|
229
|
+
|
|
230
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
231
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
232
|
+
base_url: request_options[:base_url],
|
|
233
|
+
method: "PATCH",
|
|
234
|
+
path: "v2/payment-methods/#{URI.encode_uri_component(params[:payment_method_reference].to_s)}",
|
|
235
|
+
headers: headers,
|
|
236
|
+
body: body,
|
|
237
|
+
request_options: request_options
|
|
238
|
+
)
|
|
239
|
+
begin
|
|
240
|
+
response = @client.send(request)
|
|
241
|
+
rescue Net::HTTPRequestTimeout
|
|
242
|
+
raise Payabli::Errors::TimeoutError
|
|
243
|
+
end
|
|
244
|
+
code = response.code.to_i
|
|
245
|
+
if code.between?(200, 299)
|
|
246
|
+
Payabli::Types::PaymentMethodUpdatedEnvelope.load(response.body)
|
|
247
|
+
else
|
|
248
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
249
|
+
raise error_class.new(response.body, code: code)
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module PaymentMethods
|
|
5
|
+
module Types
|
|
6
|
+
class CreatePaymentMethodsRequest < Internal::Types::Model
|
|
7
|
+
field :data, -> { Internal::Types::Array[Payabli::Types::CreatePaymentMethodRequest] }, optional: false, nullable: false
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module PaymentMethods
|
|
5
|
+
module Types
|
|
6
|
+
class ListPaymentMethodsPaymentMethodsRequest < Internal::Types::Model
|
|
7
|
+
field :account_owner, -> { String }, optional: true, nullable: false, api_name: "accountOwner"
|
|
8
|
+
|
|
9
|
+
field :owner_type, -> { Payabli::Types::PaymentMethodOwnerType }, optional: true, nullable: false, api_name: "ownerType"
|
|
10
|
+
|
|
11
|
+
field :status, -> { String }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :type, -> { String }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
16
|
+
|
|
17
|
+
field :page, -> { Integer }, optional: true, nullable: false
|
|
18
|
+
|
|
19
|
+
field :sort_by, -> { String }, optional: true, nullable: false, api_name: "sortBy"
|
|
20
|
+
|
|
21
|
+
field :sort_order, -> { String }, optional: true, nullable: false, api_name: "sortOrder"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module PaymentMethods
|
|
5
|
+
module Types
|
|
6
|
+
class UpdatePaymentMethodRequest < Internal::Types::Model
|
|
7
|
+
field :payment_method_reference, -> { String }, optional: false, nullable: false, api_name: "paymentMethodReference"
|
|
8
|
+
|
|
9
|
+
field :nickname, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :financial_institution, -> { String }, optional: true, nullable: false, api_name: "financialInstitution"
|
|
12
|
+
|
|
13
|
+
field :account_type, -> { String }, optional: true, nullable: false, api_name: "accountType"
|
|
14
|
+
|
|
15
|
+
field :account_number, -> { String }, optional: true, nullable: false, api_name: "accountNumber"
|
|
16
|
+
|
|
17
|
+
field :routing_number, -> { String }, optional: true, nullable: false, api_name: "routingNumber"
|
|
18
|
+
|
|
19
|
+
field :usage, -> { Internal::Types::Array[Payabli::Types::PaymentMethodUsage] }, optional: true, nullable: false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module Paypoints
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Payabli::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Lists paypoints with optional filtering and pagination.
|
|
14
|
+
#
|
|
15
|
+
# @param request_options [Hash]
|
|
16
|
+
# @param params [Hash]
|
|
17
|
+
# @option request_options [String] :base_url
|
|
18
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
19
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
21
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
22
|
+
# @option params [String, nil] :business_reference
|
|
23
|
+
# @option params [String, nil] :status
|
|
24
|
+
# @option params [String, nil] :search
|
|
25
|
+
# @option params [Integer, nil] :limit
|
|
26
|
+
# @option params [Integer, nil] :page
|
|
27
|
+
#
|
|
28
|
+
# @example
|
|
29
|
+
# client.paypoints.list_paypoints(
|
|
30
|
+
# limit: 1,
|
|
31
|
+
# page: 1
|
|
32
|
+
# )
|
|
33
|
+
#
|
|
34
|
+
# @return [Payabli::Types::ListPaypointsEnvelope]
|
|
35
|
+
def list_paypoints(request_options: {}, **params)
|
|
36
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
37
|
+
query_params = {}
|
|
38
|
+
query_params["businessReference"] = params[:business_reference] if params.key?(:business_reference)
|
|
39
|
+
query_params["status"] = params[:status] if params.key?(:status)
|
|
40
|
+
query_params["search"] = params[:search] if params.key?(:search)
|
|
41
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
42
|
+
query_params["page"] = params[:page] if params.key?(:page)
|
|
43
|
+
|
|
44
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
45
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
46
|
+
base_url: request_options[:base_url],
|
|
47
|
+
method: "GET",
|
|
48
|
+
path: "v2/paypoints",
|
|
49
|
+
headers: headers,
|
|
50
|
+
query: query_params,
|
|
51
|
+
request_options: request_options
|
|
52
|
+
)
|
|
53
|
+
begin
|
|
54
|
+
response = @client.send(request)
|
|
55
|
+
rescue Net::HTTPRequestTimeout
|
|
56
|
+
raise Payabli::Errors::TimeoutError
|
|
57
|
+
end
|
|
58
|
+
code = response.code.to_i
|
|
59
|
+
if code.between?(200, 299)
|
|
60
|
+
Payabli::Types::ListPaypointsEnvelope.load(response.body)
|
|
61
|
+
else
|
|
62
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
63
|
+
raise error_class.new(response.body, code: code)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Creates a paypoint. New paypoints start in `pending`. Provide exactly
|
|
68
|
+
# one of `businessReference` (an existing business) or `business` (to
|
|
69
|
+
# create the business inline).
|
|
70
|
+
#
|
|
71
|
+
# @param request_options [Hash]
|
|
72
|
+
# @param params [Payabli::Paypoints::Types::CreatePaypointPaypointsRequest]
|
|
73
|
+
# @option request_options [String] :base_url
|
|
74
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
75
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
76
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
77
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
78
|
+
#
|
|
79
|
+
# @example
|
|
80
|
+
# client.paypoints.create_paypoint(
|
|
81
|
+
# paypoint_type: "merchant",
|
|
82
|
+
# doing_business_as: "Rose Gardens",
|
|
83
|
+
# description: "Boutique flower shop",
|
|
84
|
+
# website: "https://example.com",
|
|
85
|
+
# customer_service_phone: "3055551212",
|
|
86
|
+
# customer_service_email: "support@example.com",
|
|
87
|
+
# timezone: "America/New_York",
|
|
88
|
+
# business_reference: "019fed1a-3d6e-75d3-a81e-cba3874b0a55"
|
|
89
|
+
# )
|
|
90
|
+
#
|
|
91
|
+
# @return [Payabli::Types::PaypointCreatedEnvelope]
|
|
92
|
+
def create_paypoint(request_options: {}, **params)
|
|
93
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
94
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
95
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
96
|
+
base_url: request_options[:base_url],
|
|
97
|
+
method: "POST",
|
|
98
|
+
path: "v2/paypoints",
|
|
99
|
+
headers: headers,
|
|
100
|
+
body: Payabli::Paypoints::Types::CreatePaypointPaypointsRequest.new(params).to_h,
|
|
101
|
+
request_options: request_options
|
|
102
|
+
)
|
|
103
|
+
begin
|
|
104
|
+
response = @client.send(request)
|
|
105
|
+
rescue Net::HTTPRequestTimeout
|
|
106
|
+
raise Payabli::Errors::TimeoutError
|
|
107
|
+
end
|
|
108
|
+
code = response.code.to_i
|
|
109
|
+
if code.between?(200, 299)
|
|
110
|
+
Payabli::Types::PaypointCreatedEnvelope.load(response.body)
|
|
111
|
+
else
|
|
112
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
113
|
+
raise error_class.new(response.body, code: code)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Retrieves a paypoint by reference.
|
|
118
|
+
#
|
|
119
|
+
# @param request_options [Hash]
|
|
120
|
+
# @param params [Hash]
|
|
121
|
+
# @option request_options [String] :base_url
|
|
122
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
123
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
124
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
125
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
126
|
+
# @option params [String] :paypoint_reference
|
|
127
|
+
#
|
|
128
|
+
# @example
|
|
129
|
+
# client.paypoints.get_paypoint(paypoint_reference: "019ff064-c690-7679-a73e-688418aadc7c")
|
|
130
|
+
#
|
|
131
|
+
# @return [Payabli::Types::PaypointDetailEnvelope]
|
|
132
|
+
def get_paypoint(request_options: {}, **params)
|
|
133
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
134
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
135
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
136
|
+
base_url: request_options[:base_url],
|
|
137
|
+
method: "GET",
|
|
138
|
+
path: "v2/paypoints/#{URI.encode_uri_component(params[:paypoint_reference].to_s)}",
|
|
139
|
+
headers: headers,
|
|
140
|
+
request_options: request_options
|
|
141
|
+
)
|
|
142
|
+
begin
|
|
143
|
+
response = @client.send(request)
|
|
144
|
+
rescue Net::HTTPRequestTimeout
|
|
145
|
+
raise Payabli::Errors::TimeoutError
|
|
146
|
+
end
|
|
147
|
+
code = response.code.to_i
|
|
148
|
+
if code.between?(200, 299)
|
|
149
|
+
Payabli::Types::PaypointDetailEnvelope.load(response.body)
|
|
150
|
+
else
|
|
151
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
152
|
+
raise error_class.new(response.body, code: code)
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Applies a partial update to a paypoint. Send only the fields you want to change.
|
|
157
|
+
#
|
|
158
|
+
# @param request_options [Hash]
|
|
159
|
+
# @param params [Payabli::Paypoints::Types::UpdatePaypointRequest]
|
|
160
|
+
# @option request_options [String] :base_url
|
|
161
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
162
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
163
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
164
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
165
|
+
# @option params [String] :paypoint_reference
|
|
166
|
+
#
|
|
167
|
+
# @example
|
|
168
|
+
# client.paypoints.update_paypoint(
|
|
169
|
+
# paypoint_reference: "019ff064-c690-7679-a73e-688418aadc7c",
|
|
170
|
+
# description: "Updated description"
|
|
171
|
+
# )
|
|
172
|
+
#
|
|
173
|
+
# @return [Payabli::Types::PaypointUpdatedEnvelope]
|
|
174
|
+
def update_paypoint(request_options: {}, **params)
|
|
175
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
176
|
+
request_data = Payabli::Paypoints::Types::UpdatePaypointRequest.new(params).to_h
|
|
177
|
+
non_body_param_names = %w[paypointReference]
|
|
178
|
+
body = request_data.except(*non_body_param_names)
|
|
179
|
+
|
|
180
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
181
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
182
|
+
base_url: request_options[:base_url],
|
|
183
|
+
method: "PATCH",
|
|
184
|
+
path: "v2/paypoints/#{URI.encode_uri_component(params[:paypoint_reference].to_s)}",
|
|
185
|
+
headers: headers,
|
|
186
|
+
body: body,
|
|
187
|
+
request_options: request_options
|
|
188
|
+
)
|
|
189
|
+
begin
|
|
190
|
+
response = @client.send(request)
|
|
191
|
+
rescue Net::HTTPRequestTimeout
|
|
192
|
+
raise Payabli::Errors::TimeoutError
|
|
193
|
+
end
|
|
194
|
+
code = response.code.to_i
|
|
195
|
+
if code.between?(200, 299)
|
|
196
|
+
Payabli::Types::PaypointUpdatedEnvelope.load(response.body)
|
|
197
|
+
else
|
|
198
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
199
|
+
raise error_class.new(response.body, code: code)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module Paypoints
|
|
5
|
+
module Types
|
|
6
|
+
class CreatePaypointPaypointsRequest < Internal::Types::Model
|
|
7
|
+
extend Payabli::Internal::Types::Union
|
|
8
|
+
|
|
9
|
+
member -> { Payabli::Types::CreatePaypointWithBusinessReference }
|
|
10
|
+
|
|
11
|
+
member -> { Payabli::Types::CreatePaypointWithInlineBusiness }
|
|
12
|
+
|
|
13
|
+
member -> { Payabli::Types::CreatePaypointAllFields }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module Paypoints
|
|
5
|
+
module Types
|
|
6
|
+
class ListPaypointsPaypointsRequest < Internal::Types::Model
|
|
7
|
+
field :business_reference, -> { String }, optional: true, nullable: false, api_name: "businessReference"
|
|
8
|
+
|
|
9
|
+
field :status, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :search, -> { String }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :page, -> { Integer }, optional: true, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module Paypoints
|
|
5
|
+
module Types
|
|
6
|
+
class UpdatePaypointRequest < Internal::Types::Model
|
|
7
|
+
field :paypoint_reference, -> { String }, optional: false, nullable: false, api_name: "paypointReference"
|
|
8
|
+
|
|
9
|
+
field :paypoint_type, -> { String }, optional: true, nullable: false, api_name: "paypointType"
|
|
10
|
+
|
|
11
|
+
field :doing_business_as, -> { String }, optional: true, nullable: false, api_name: "doingBusinessAs"
|
|
12
|
+
|
|
13
|
+
field :description, -> { String }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :website, -> { String }, optional: true, nullable: false
|
|
16
|
+
|
|
17
|
+
field :customer_service_phone, -> { String }, optional: true, nullable: false, api_name: "customerServicePhone"
|
|
18
|
+
|
|
19
|
+
field :customer_service_email, -> { String }, optional: true, nullable: false, api_name: "customerServiceEmail"
|
|
20
|
+
|
|
21
|
+
field :timezone, -> { String }, optional: true, nullable: false
|
|
22
|
+
|
|
23
|
+
field :external_id, -> { String }, optional: true, nullable: false, api_name: "externalId"
|
|
24
|
+
|
|
25
|
+
field :custom_data, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false, api_name: "customData"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|