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,735 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module Applications
|
|
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 boarding applications with 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 [Integer, nil] :page
|
|
23
|
+
# @option params [Integer, nil] :limit
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# client.applications.list_applications
|
|
27
|
+
#
|
|
28
|
+
# @return [Payabli::Types::ListApplicationsEnvelope]
|
|
29
|
+
def list_applications(request_options: {}, **params)
|
|
30
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
31
|
+
query_params = {}
|
|
32
|
+
query_params["page"] = params[:page] if params.key?(:page)
|
|
33
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
34
|
+
|
|
35
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
36
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
37
|
+
base_url: request_options[:base_url],
|
|
38
|
+
method: "GET",
|
|
39
|
+
path: "v2/requests",
|
|
40
|
+
headers: headers,
|
|
41
|
+
query: query_params,
|
|
42
|
+
request_options: request_options
|
|
43
|
+
)
|
|
44
|
+
begin
|
|
45
|
+
response = @client.send(request)
|
|
46
|
+
rescue Net::HTTPRequestTimeout
|
|
47
|
+
raise Payabli::Errors::TimeoutError
|
|
48
|
+
end
|
|
49
|
+
code = response.code.to_i
|
|
50
|
+
if code.between?(200, 299)
|
|
51
|
+
Payabli::Types::ListApplicationsEnvelope.load(response.body)
|
|
52
|
+
else
|
|
53
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
54
|
+
raise error_class.new(response.body, code: code)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Creates a boarding application for a business. The business must
|
|
59
|
+
# already have a paypoint. New applications start in `draft`.
|
|
60
|
+
#
|
|
61
|
+
# @param request_options [Hash]
|
|
62
|
+
# @param params [Payabli::Applications::Types::CreateApplicationRequest]
|
|
63
|
+
# @option request_options [String] :base_url
|
|
64
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
65
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
66
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
67
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
68
|
+
#
|
|
69
|
+
# @example
|
|
70
|
+
# client.applications.create_application(
|
|
71
|
+
# business_reference: "019fed1a-3d6e-75d3-a81e-cba3874b0a55",
|
|
72
|
+
# external_id: "APP-2025-0417",
|
|
73
|
+
# tags: ["priority"]
|
|
74
|
+
# )
|
|
75
|
+
#
|
|
76
|
+
# @return [Payabli::Types::ApplicationEnvelope]
|
|
77
|
+
def create_application(request_options: {}, **params)
|
|
78
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
79
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
80
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
81
|
+
base_url: request_options[:base_url],
|
|
82
|
+
method: "POST",
|
|
83
|
+
path: "v2/requests",
|
|
84
|
+
headers: headers,
|
|
85
|
+
body: Payabli::Applications::Types::CreateApplicationRequest.new(params).to_h,
|
|
86
|
+
request_options: request_options
|
|
87
|
+
)
|
|
88
|
+
begin
|
|
89
|
+
response = @client.send(request)
|
|
90
|
+
rescue Net::HTTPRequestTimeout
|
|
91
|
+
raise Payabli::Errors::TimeoutError
|
|
92
|
+
end
|
|
93
|
+
code = response.code.to_i
|
|
94
|
+
if code.between?(200, 299)
|
|
95
|
+
Payabli::Types::ApplicationEnvelope.load(response.body)
|
|
96
|
+
else
|
|
97
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
98
|
+
raise error_class.new(response.body, code: code)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Retrieves a boarding application by reference.
|
|
103
|
+
#
|
|
104
|
+
# @param request_options [Hash]
|
|
105
|
+
# @param params [Hash]
|
|
106
|
+
# @option request_options [String] :base_url
|
|
107
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
108
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
109
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
110
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
111
|
+
# @option params [String] :requests_reference
|
|
112
|
+
#
|
|
113
|
+
# @example
|
|
114
|
+
# client.applications.get_application(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
115
|
+
#
|
|
116
|
+
# @return [Payabli::Types::ApplicationEnvelope]
|
|
117
|
+
def get_application(request_options: {}, **params)
|
|
118
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
119
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
120
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
121
|
+
base_url: request_options[:base_url],
|
|
122
|
+
method: "GET",
|
|
123
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}",
|
|
124
|
+
headers: headers,
|
|
125
|
+
request_options: request_options
|
|
126
|
+
)
|
|
127
|
+
begin
|
|
128
|
+
response = @client.send(request)
|
|
129
|
+
rescue Net::HTTPRequestTimeout
|
|
130
|
+
raise Payabli::Errors::TimeoutError
|
|
131
|
+
end
|
|
132
|
+
code = response.code.to_i
|
|
133
|
+
if code.between?(200, 299)
|
|
134
|
+
Payabli::Types::ApplicationEnvelope.load(response.body)
|
|
135
|
+
else
|
|
136
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
137
|
+
raise error_class.new(response.body, code: code)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Applies a partial update to a boarding application. Send only the fields you want to change.
|
|
142
|
+
#
|
|
143
|
+
# @param request_options [Hash]
|
|
144
|
+
# @param params [Payabli::Applications::Types::UpdateApplicationRequest]
|
|
145
|
+
# @option request_options [String] :base_url
|
|
146
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
147
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
148
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
149
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
150
|
+
# @option params [String] :requests_reference
|
|
151
|
+
#
|
|
152
|
+
# @example
|
|
153
|
+
# client.applications.update_application(
|
|
154
|
+
# requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c",
|
|
155
|
+
# external_id: "APP-2025-0417-REV2",
|
|
156
|
+
# tags: %w[priority expedited]
|
|
157
|
+
# )
|
|
158
|
+
#
|
|
159
|
+
# @return [Payabli::Types::ApplicationEnvelope]
|
|
160
|
+
def update_application(request_options: {}, **params)
|
|
161
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
162
|
+
request_data = Payabli::Applications::Types::UpdateApplicationRequest.new(params).to_h
|
|
163
|
+
non_body_param_names = %w[requestsReference]
|
|
164
|
+
body = request_data.except(*non_body_param_names)
|
|
165
|
+
|
|
166
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
167
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
168
|
+
base_url: request_options[:base_url],
|
|
169
|
+
method: "PATCH",
|
|
170
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}",
|
|
171
|
+
headers: headers,
|
|
172
|
+
body: body,
|
|
173
|
+
request_options: request_options
|
|
174
|
+
)
|
|
175
|
+
begin
|
|
176
|
+
response = @client.send(request)
|
|
177
|
+
rescue Net::HTTPRequestTimeout
|
|
178
|
+
raise Payabli::Errors::TimeoutError
|
|
179
|
+
end
|
|
180
|
+
code = response.code.to_i
|
|
181
|
+
if code.between?(200, 299)
|
|
182
|
+
Payabli::Types::ApplicationEnvelope.load(response.body)
|
|
183
|
+
else
|
|
184
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
185
|
+
raise error_class.new(response.body, code: code)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Checks whether the records linked to an application (the business, its people, and its payment methods) include
|
|
190
|
+
# everything the application's requested services need. The response lists any missing or invalid fields by
|
|
191
|
+
# section. Validation doesn't change the application, and it doesn't return a validation token. The request has no
|
|
192
|
+
# body.
|
|
193
|
+
#
|
|
194
|
+
# One owner on the application must be the signer, flagged with `isSigner` on their business link. If no one is
|
|
195
|
+
# flagged, the `people` section returns a `missingFields` entry with `field` set to `people.isSigner`, `label` set
|
|
196
|
+
# to `Signer`, and `reason` set to `required — choose the person who signs the application`. The signer rule isn't
|
|
197
|
+
# reported when the application has no people.
|
|
198
|
+
#
|
|
199
|
+
# The `people` section also checks ownership. At least one person must be the primary controller, flagged with
|
|
200
|
+
# `isPrimaryController`. If no one is, the entry has `field` set to `people.isPrimaryController`, `label` set to
|
|
201
|
+
# `Primary Controller`, and `reason` set to `required — at least one principal must be designated`. Unless the
|
|
202
|
+
# business's `legalStructure` is `government` or `non-profit`, at least one owner must have an
|
|
203
|
+
# `ownershipPercentage` of 25 or more. If no one does, the entry has `field` set to `people.ownershipPercentage`,
|
|
204
|
+
# `label` set to `Qualifying Owner`, and `reason` set to `at least one principal must have an ownership stake of
|
|
205
|
+
# 25% or more`.
|
|
206
|
+
#
|
|
207
|
+
# Validation also reports required documents that have nothing uploaded. See [List application document
|
|
208
|
+
# requirements](/developers/api-reference/applications/list-application-document-requirements). The bank statement
|
|
209
|
+
# requirement appears in the `business` section, with `field` set to `documents.bankStatement`. A person document
|
|
210
|
+
# appears in the `people` section, with `field` set to `people.{personReference}.` followed by the requirement's
|
|
211
|
+
# `fieldPath`, such as `people.01a0014d-ce1a-7110-9bac-c4c59647a88d.person.documents.w9`. Submit doesn't enforce
|
|
212
|
+
# document requirements.
|
|
213
|
+
#
|
|
214
|
+
# @param request_options [Hash]
|
|
215
|
+
# @param params [Hash]
|
|
216
|
+
# @option request_options [String] :base_url
|
|
217
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
218
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
219
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
220
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
221
|
+
# @option params [String] :requests_reference
|
|
222
|
+
#
|
|
223
|
+
# @example
|
|
224
|
+
# client.applications.validate_application(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
225
|
+
#
|
|
226
|
+
# @return [Payabli::Types::ValidationResultEnvelope]
|
|
227
|
+
def validate_application(request_options: {}, **params)
|
|
228
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
229
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
230
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
231
|
+
base_url: request_options[:base_url],
|
|
232
|
+
method: "POST",
|
|
233
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/validate",
|
|
234
|
+
headers: headers,
|
|
235
|
+
request_options: request_options
|
|
236
|
+
)
|
|
237
|
+
begin
|
|
238
|
+
response = @client.send(request)
|
|
239
|
+
rescue Net::HTTPRequestTimeout
|
|
240
|
+
raise Payabli::Errors::TimeoutError
|
|
241
|
+
end
|
|
242
|
+
code = response.code.to_i
|
|
243
|
+
if code.between?(200, 299)
|
|
244
|
+
Payabli::Types::ValidationResultEnvelope.load(response.body)
|
|
245
|
+
else
|
|
246
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
247
|
+
raise error_class.new(response.body, code: code)
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Submits a draft application for review. Your integration (the applicant) calls this after the business, its
|
|
252
|
+
# people, payment methods, and services are in place. Verification then runs automatically.
|
|
253
|
+
#
|
|
254
|
+
# The application must have a signer: an owner flagged with `isSigner` on their business link, or one you name in
|
|
255
|
+
# `signer.personReference`. Payabli records the signer's identity from their person record and business link, so
|
|
256
|
+
# update those before you submit. The `signer` object carries the signature details.
|
|
257
|
+
#
|
|
258
|
+
# If the application has no signer, the request fails with `422` and the error `SIGNER_REQUIRED`. If
|
|
259
|
+
# `signer.personReference` names a person who isn't an owner, the request fails with `422` and the error
|
|
260
|
+
# `SIGNER_NOT_OWNER`. If the application isn't a draft, the request fails with `409` and the error `BIZ_004`,
|
|
261
|
+
# before any signer check. If `signer.reportedSignerIp` isn't a single valid IPv4 or IPv6 address, the request
|
|
262
|
+
# fails with `400` and the error `VALIDATION_ERROR`, and the application isn't submitted.
|
|
263
|
+
#
|
|
264
|
+
# Submit doesn't check every rule that [validate](/developers/api-reference/applications/validate-an-application)
|
|
265
|
+
# reports, such as the primary controller and ownership rules. Validate the application and resolve its missing
|
|
266
|
+
# fields before you submit.
|
|
267
|
+
#
|
|
268
|
+
# @param request_options [Hash]
|
|
269
|
+
# @param params [Payabli::Applications::Types::SubmitApplicationRequest]
|
|
270
|
+
# @option request_options [String] :base_url
|
|
271
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
272
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
273
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
274
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
275
|
+
# @option params [String] :requests_reference
|
|
276
|
+
#
|
|
277
|
+
# @example
|
|
278
|
+
# client.applications.submit_application(
|
|
279
|
+
# requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c",
|
|
280
|
+
# signer: {
|
|
281
|
+
# person_reference: "01a0014d-ce1a-7110-9bac-c4c59647a88d",
|
|
282
|
+
# signature: "Marcus J Delgado",
|
|
283
|
+
# signature_type: "type",
|
|
284
|
+
# acceptance: true,
|
|
285
|
+
# pci_attestation: true,
|
|
286
|
+
# reported_signer_ip: "203.0.113.7"
|
|
287
|
+
# }
|
|
288
|
+
# )
|
|
289
|
+
#
|
|
290
|
+
# @return [Payabli::Types::TransitionResultEnvelope]
|
|
291
|
+
def submit_application(request_options: {}, **params)
|
|
292
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
293
|
+
request_data = Payabli::Applications::Types::SubmitApplicationRequest.new(params).to_h
|
|
294
|
+
non_body_param_names = %w[requestsReference]
|
|
295
|
+
body = request_data.except(*non_body_param_names)
|
|
296
|
+
|
|
297
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
298
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
299
|
+
base_url: request_options[:base_url],
|
|
300
|
+
method: "POST",
|
|
301
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/submit",
|
|
302
|
+
headers: headers,
|
|
303
|
+
body: body,
|
|
304
|
+
request_options: request_options
|
|
305
|
+
)
|
|
306
|
+
begin
|
|
307
|
+
response = @client.send(request)
|
|
308
|
+
rescue Net::HTTPRequestTimeout
|
|
309
|
+
raise Payabli::Errors::TimeoutError
|
|
310
|
+
end
|
|
311
|
+
code = response.code.to_i
|
|
312
|
+
if code.between?(200, 299)
|
|
313
|
+
Payabli::Types::TransitionResultEnvelope.load(response.body)
|
|
314
|
+
else
|
|
315
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
316
|
+
raise error_class.new(response.body, code: code)
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# Marks the documents that Payabli requested during review as provided, when the application is in
|
|
321
|
+
# `pendingdocuments`. It returns the application to review. The request has no body.
|
|
322
|
+
#
|
|
323
|
+
# @param request_options [Hash]
|
|
324
|
+
# @param params [Hash]
|
|
325
|
+
# @option request_options [String] :base_url
|
|
326
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
327
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
328
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
329
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
330
|
+
# @option params [String] :requests_reference
|
|
331
|
+
#
|
|
332
|
+
# @example
|
|
333
|
+
# client.applications.provide_documents(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
334
|
+
#
|
|
335
|
+
# @return [Payabli::Types::TransitionResultEnvelope]
|
|
336
|
+
def provide_documents(request_options: {}, **params)
|
|
337
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
338
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
339
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
340
|
+
base_url: request_options[:base_url],
|
|
341
|
+
method: "POST",
|
|
342
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/provide-documents",
|
|
343
|
+
headers: headers,
|
|
344
|
+
request_options: request_options
|
|
345
|
+
)
|
|
346
|
+
begin
|
|
347
|
+
response = @client.send(request)
|
|
348
|
+
rescue Net::HTTPRequestTimeout
|
|
349
|
+
raise Payabli::Errors::TimeoutError
|
|
350
|
+
end
|
|
351
|
+
code = response.code.to_i
|
|
352
|
+
if code.between?(200, 299)
|
|
353
|
+
Payabli::Types::TransitionResultEnvelope.load(response.body)
|
|
354
|
+
else
|
|
355
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
356
|
+
raise error_class.new(response.body, code: code)
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Marks the information that Payabli requested during review as provided, when the application is in
|
|
361
|
+
# `pendingresponse`. It returns the application to review. The request has no body.
|
|
362
|
+
#
|
|
363
|
+
# @param request_options [Hash]
|
|
364
|
+
# @param params [Hash]
|
|
365
|
+
# @option request_options [String] :base_url
|
|
366
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
367
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
368
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
369
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
370
|
+
# @option params [String] :requests_reference
|
|
371
|
+
#
|
|
372
|
+
# @example
|
|
373
|
+
# client.applications.provide_response(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
374
|
+
#
|
|
375
|
+
# @return [Payabli::Types::TransitionResultEnvelope]
|
|
376
|
+
def provide_response(request_options: {}, **params)
|
|
377
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
378
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
379
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
380
|
+
base_url: request_options[:base_url],
|
|
381
|
+
method: "POST",
|
|
382
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/provide-response",
|
|
383
|
+
headers: headers,
|
|
384
|
+
request_options: request_options
|
|
385
|
+
)
|
|
386
|
+
begin
|
|
387
|
+
response = @client.send(request)
|
|
388
|
+
rescue Net::HTTPRequestTimeout
|
|
389
|
+
raise Payabli::Errors::TimeoutError
|
|
390
|
+
end
|
|
391
|
+
code = response.code.to_i
|
|
392
|
+
if code.between?(200, 299)
|
|
393
|
+
Payabli::Types::TransitionResultEnvelope.load(response.body)
|
|
394
|
+
else
|
|
395
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
396
|
+
raise error_class.new(response.body, code: code)
|
|
397
|
+
end
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
# Withdraws a boarding application. The response returns the application's
|
|
401
|
+
# new status and the actions now allowed on it.
|
|
402
|
+
#
|
|
403
|
+
# @param request_options [Hash]
|
|
404
|
+
# @param params [Payabli::Applications::Types::WithdrawApplicationRequest]
|
|
405
|
+
# @option request_options [String] :base_url
|
|
406
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
407
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
408
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
409
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
410
|
+
# @option params [String] :requests_reference
|
|
411
|
+
#
|
|
412
|
+
# @example
|
|
413
|
+
# client.applications.withdraw_application(
|
|
414
|
+
# requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c",
|
|
415
|
+
# reason: "Duplicate application"
|
|
416
|
+
# )
|
|
417
|
+
#
|
|
418
|
+
# @return [Payabli::Types::TransitionResultEnvelope]
|
|
419
|
+
def withdraw_application(request_options: {}, **params)
|
|
420
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
421
|
+
request_data = Payabli::Applications::Types::WithdrawApplicationRequest.new(params).to_h
|
|
422
|
+
non_body_param_names = %w[requestsReference]
|
|
423
|
+
body = request_data.except(*non_body_param_names)
|
|
424
|
+
|
|
425
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
426
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
427
|
+
base_url: request_options[:base_url],
|
|
428
|
+
method: "POST",
|
|
429
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/withdraw",
|
|
430
|
+
headers: headers,
|
|
431
|
+
body: body,
|
|
432
|
+
request_options: request_options
|
|
433
|
+
)
|
|
434
|
+
begin
|
|
435
|
+
response = @client.send(request)
|
|
436
|
+
rescue Net::HTTPRequestTimeout
|
|
437
|
+
raise Payabli::Errors::TimeoutError
|
|
438
|
+
end
|
|
439
|
+
code = response.code.to_i
|
|
440
|
+
if code.between?(200, 299)
|
|
441
|
+
Payabli::Types::TransitionResultEnvelope.load(response.body)
|
|
442
|
+
else
|
|
443
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
444
|
+
raise error_class.new(response.body, code: code)
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
# Retrieves the status transition history of a boarding application, oldest first. History records changes only.
|
|
449
|
+
# An approved application that fails enablement the same way on every attempt doesn't add entries, so use
|
|
450
|
+
# [enablement](/developers/api-reference/applications/get-application-enablement-progress) to follow that
|
|
451
|
+
# progress.
|
|
452
|
+
#
|
|
453
|
+
# @param request_options [Hash]
|
|
454
|
+
# @param params [Hash]
|
|
455
|
+
# @option request_options [String] :base_url
|
|
456
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
457
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
458
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
459
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
460
|
+
# @option params [String] :requests_reference
|
|
461
|
+
#
|
|
462
|
+
# @example
|
|
463
|
+
# client.applications.get_application_history(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
464
|
+
#
|
|
465
|
+
# @return [Payabli::Types::StatusHistoryEnvelope]
|
|
466
|
+
def get_application_history(request_options: {}, **params)
|
|
467
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
468
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
469
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
470
|
+
base_url: request_options[:base_url],
|
|
471
|
+
method: "GET",
|
|
472
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/history",
|
|
473
|
+
headers: headers,
|
|
474
|
+
request_options: request_options
|
|
475
|
+
)
|
|
476
|
+
begin
|
|
477
|
+
response = @client.send(request)
|
|
478
|
+
rescue Net::HTTPRequestTimeout
|
|
479
|
+
raise Payabli::Errors::TimeoutError
|
|
480
|
+
end
|
|
481
|
+
code = response.code.to_i
|
|
482
|
+
if code.between?(200, 299)
|
|
483
|
+
Payabli::Types::StatusHistoryEnvelope.load(response.body)
|
|
484
|
+
else
|
|
485
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
486
|
+
raise error_class.new(response.body, code: code)
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
# Retrieves the progress of setting up an approved application's services with their processors. An application's
|
|
491
|
+
# status stays `approved` or `autoapproved` while this runs, and it moves to `activated` after every requested
|
|
492
|
+
# service is set up. Use this endpoint to see why an approved merchant isn't live yet.
|
|
493
|
+
#
|
|
494
|
+
# Enablement doesn't send webhooks, so poll this endpoint to follow it. Until enablement starts, `state` and the
|
|
495
|
+
# other progress fields are `null`, and `services` is empty. That includes applications that are in `draft`,
|
|
496
|
+
# withdrawn, or in `error`.
|
|
497
|
+
#
|
|
498
|
+
# @param request_options [Hash]
|
|
499
|
+
# @param params [Hash]
|
|
500
|
+
# @option request_options [String] :base_url
|
|
501
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
502
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
503
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
504
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
505
|
+
# @option params [String] :requests_reference
|
|
506
|
+
#
|
|
507
|
+
# @example
|
|
508
|
+
# client.applications.get_application_enablement(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
509
|
+
#
|
|
510
|
+
# @return [Payabli::Types::EnablementEnvelope]
|
|
511
|
+
def get_application_enablement(request_options: {}, **params)
|
|
512
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
513
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
514
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
515
|
+
base_url: request_options[:base_url],
|
|
516
|
+
method: "GET",
|
|
517
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/enablement",
|
|
518
|
+
headers: headers,
|
|
519
|
+
request_options: request_options
|
|
520
|
+
)
|
|
521
|
+
begin
|
|
522
|
+
response = @client.send(request)
|
|
523
|
+
rescue Net::HTTPRequestTimeout
|
|
524
|
+
raise Payabli::Errors::TimeoutError
|
|
525
|
+
end
|
|
526
|
+
code = response.code.to_i
|
|
527
|
+
if code.between?(200, 299)
|
|
528
|
+
Payabli::Types::EnablementEnvelope.load(response.body)
|
|
529
|
+
else
|
|
530
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
531
|
+
raise error_class.new(response.body, code: code)
|
|
532
|
+
end
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
# Lists the documents an application asks for, from its template and from Payabli business rules. For example, a
|
|
536
|
+
# business with an annual revenue of $1,000,000 or more needs bank statements. Each requirement gives the
|
|
537
|
+
# `fieldPath` and `subject` to send when you upload, the formats it accepts, how many documents it takes, and how
|
|
538
|
+
# many are uploaded so far.
|
|
539
|
+
#
|
|
540
|
+
# A person requirement appears once for each owner of the business, with that owner's `personReference`. The list
|
|
541
|
+
# is empty when the application asks for no documents.
|
|
542
|
+
#
|
|
543
|
+
# @param request_options [Hash]
|
|
544
|
+
# @param params [Hash]
|
|
545
|
+
# @option request_options [String] :base_url
|
|
546
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
547
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
548
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
549
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
550
|
+
# @option params [String] :requests_reference
|
|
551
|
+
#
|
|
552
|
+
# @example
|
|
553
|
+
# client.applications.list_application_document_requirements(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
554
|
+
#
|
|
555
|
+
# @return [Payabli::Types::DocumentRequirementListEnvelope]
|
|
556
|
+
def list_application_document_requirements(request_options: {}, **params)
|
|
557
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
558
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
559
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
560
|
+
base_url: request_options[:base_url],
|
|
561
|
+
method: "GET",
|
|
562
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/documents/requirements",
|
|
563
|
+
headers: headers,
|
|
564
|
+
request_options: request_options
|
|
565
|
+
)
|
|
566
|
+
begin
|
|
567
|
+
response = @client.send(request)
|
|
568
|
+
rescue Net::HTTPRequestTimeout
|
|
569
|
+
raise Payabli::Errors::TimeoutError
|
|
570
|
+
end
|
|
571
|
+
code = response.code.to_i
|
|
572
|
+
if code.between?(200, 299)
|
|
573
|
+
Payabli::Types::DocumentRequirementListEnvelope.load(response.body)
|
|
574
|
+
else
|
|
575
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
576
|
+
raise error_class.new(response.body, code: code)
|
|
577
|
+
end
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
# Lists the documents uploaded to an application. The list is empty when none are uploaded.
|
|
581
|
+
#
|
|
582
|
+
# @param request_options [Hash]
|
|
583
|
+
# @param params [Hash]
|
|
584
|
+
# @option request_options [String] :base_url
|
|
585
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
586
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
587
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
588
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
589
|
+
# @option params [String] :requests_reference
|
|
590
|
+
#
|
|
591
|
+
# @example
|
|
592
|
+
# client.applications.list_application_documents(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
593
|
+
#
|
|
594
|
+
# @return [Payabli::Types::ApplicationDocumentListEnvelope]
|
|
595
|
+
def list_application_documents(request_options: {}, **params)
|
|
596
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
597
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
598
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
599
|
+
base_url: request_options[:base_url],
|
|
600
|
+
method: "GET",
|
|
601
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/documents",
|
|
602
|
+
headers: headers,
|
|
603
|
+
request_options: request_options
|
|
604
|
+
)
|
|
605
|
+
begin
|
|
606
|
+
response = @client.send(request)
|
|
607
|
+
rescue Net::HTTPRequestTimeout
|
|
608
|
+
raise Payabli::Errors::TimeoutError
|
|
609
|
+
end
|
|
610
|
+
code = response.code.to_i
|
|
611
|
+
if code.between?(200, 299)
|
|
612
|
+
Payabli::Types::ApplicationDocumentListEnvelope.load(response.body)
|
|
613
|
+
else
|
|
614
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
615
|
+
raise error_class.new(response.body, code: code)
|
|
616
|
+
end
|
|
617
|
+
end
|
|
618
|
+
|
|
619
|
+
# Uploads one document to an application as multipart form data. [List the application's document
|
|
620
|
+
# requirements](/developers/api-reference/applications/list-application-document-requirements) first. Send the
|
|
621
|
+
# requirement's `fieldPath`, one of its `subjectTypes` as `subject`, and, for a person requirement, its
|
|
622
|
+
# `personReference`.
|
|
623
|
+
#
|
|
624
|
+
# The file can be up to 10 MB, in a format the requirement accepts. Payabli checks the file's content, not only
|
|
625
|
+
# its name. Each requirement takes up to `maxUploads` documents.
|
|
626
|
+
#
|
|
627
|
+
# Uploading doesn't change the application's status. When underwriting requests documents, upload them, then call
|
|
628
|
+
# [provide documents](/developers/api-reference/applications/provide-application-documents) to return the
|
|
629
|
+
# application to review.
|
|
630
|
+
#
|
|
631
|
+
# @param request_options [Hash]
|
|
632
|
+
# @param params [void]
|
|
633
|
+
# @option request_options [String] :base_url
|
|
634
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
635
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
636
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
637
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
638
|
+
# @option params [String] :requests_reference
|
|
639
|
+
#
|
|
640
|
+
# @example
|
|
641
|
+
# client.applications.upload_application_document(requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c")
|
|
642
|
+
#
|
|
643
|
+
# @return [Payabli::Types::ApplicationDocumentEnvelope]
|
|
644
|
+
def upload_application_document(request_options: {}, **params)
|
|
645
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
646
|
+
body = Internal::Multipart::FormData.new
|
|
647
|
+
|
|
648
|
+
body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]
|
|
649
|
+
if params[:field_path]
|
|
650
|
+
body.add(
|
|
651
|
+
name: "fieldPath",
|
|
652
|
+
value: params[:field_path]
|
|
653
|
+
)
|
|
654
|
+
end
|
|
655
|
+
if params[:subject]
|
|
656
|
+
body.add(
|
|
657
|
+
name: "subject",
|
|
658
|
+
value: params[:subject]
|
|
659
|
+
)
|
|
660
|
+
end
|
|
661
|
+
if params[:person_reference]
|
|
662
|
+
body.add(
|
|
663
|
+
name: "personReference",
|
|
664
|
+
value: params[:person_reference]
|
|
665
|
+
)
|
|
666
|
+
end
|
|
667
|
+
|
|
668
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
669
|
+
request = Payabli::Internal::Multipart::Request.new(
|
|
670
|
+
base_url: request_options[:base_url],
|
|
671
|
+
method: "POST",
|
|
672
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/documents",
|
|
673
|
+
headers: headers,
|
|
674
|
+
body: body,
|
|
675
|
+
request_options: request_options
|
|
676
|
+
)
|
|
677
|
+
begin
|
|
678
|
+
response = @client.send(request)
|
|
679
|
+
rescue Net::HTTPRequestTimeout
|
|
680
|
+
raise Payabli::Errors::TimeoutError
|
|
681
|
+
end
|
|
682
|
+
code = response.code.to_i
|
|
683
|
+
if code.between?(200, 299)
|
|
684
|
+
Payabli::Types::ApplicationDocumentEnvelope.load(response.body)
|
|
685
|
+
else
|
|
686
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
687
|
+
raise error_class.new(response.body, code: code)
|
|
688
|
+
end
|
|
689
|
+
end
|
|
690
|
+
|
|
691
|
+
# Removes a document you uploaded from an application. Deleting doesn't change the application's status. A deleted
|
|
692
|
+
# document no longer counts toward its requirement, so you can upload a replacement. Deleting a document that's
|
|
693
|
+
# already deleted returns `404`.
|
|
694
|
+
#
|
|
695
|
+
# @param request_options [Hash]
|
|
696
|
+
# @param params [Hash]
|
|
697
|
+
# @option request_options [String] :base_url
|
|
698
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
699
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
700
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
701
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
702
|
+
# @option params [String] :requests_reference
|
|
703
|
+
# @option params [String] :document_reference
|
|
704
|
+
#
|
|
705
|
+
# @example
|
|
706
|
+
# client.applications.delete_application_document(
|
|
707
|
+
# requests_reference: "3f3caa7b-bdfe-4bf1-814b-30d54859247c",
|
|
708
|
+
# document_reference: "019ff1d7-6e14-7c8b-a2f5-91d3b7e04c62"
|
|
709
|
+
# )
|
|
710
|
+
#
|
|
711
|
+
# @return [untyped]
|
|
712
|
+
def delete_application_document(request_options: {}, **params)
|
|
713
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
714
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
|
|
715
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
716
|
+
base_url: request_options[:base_url],
|
|
717
|
+
method: "DELETE",
|
|
718
|
+
path: "v2/requests/#{URI.encode_uri_component(params[:requests_reference].to_s)}/documents/#{URI.encode_uri_component(params[:document_reference].to_s)}",
|
|
719
|
+
headers: headers,
|
|
720
|
+
request_options: request_options
|
|
721
|
+
)
|
|
722
|
+
begin
|
|
723
|
+
response = @client.send(request)
|
|
724
|
+
rescue Net::HTTPRequestTimeout
|
|
725
|
+
raise Payabli::Errors::TimeoutError
|
|
726
|
+
end
|
|
727
|
+
code = response.code.to_i
|
|
728
|
+
return if code.between?(200, 299)
|
|
729
|
+
|
|
730
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
731
|
+
raise error_class.new(response.body, code: code)
|
|
732
|
+
end
|
|
733
|
+
end
|
|
734
|
+
end
|
|
735
|
+
end
|