unit_ruby_sdk 1.0.5 → 1.2.0
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/README.md +190 -19
- data/lib/unit/api_resources/application_form_resource.rb +40 -0
- data/lib/unit/api_resources/authorization_request_resource.rb +49 -0
- data/lib/unit/api_resources/authorization_resource.rb +31 -0
- data/lib/unit/api_resources/card_resource.rb +8 -0
- data/lib/unit/api_resources/event_resource.rb +40 -0
- data/lib/unit/api_resources/fee_resource.rb +32 -0
- data/lib/unit/api_resources/payment_resource.rb +17 -0
- data/lib/unit/api_resources/received_payment_resource.rb +47 -0
- data/lib/unit/api_resources/recurring_payment_resource.rb +55 -0
- data/lib/unit/api_resources/repayment_resource.rb +41 -0
- data/lib/unit/api_resources/reward_resource.rb +41 -0
- data/lib/unit/api_resources/webhook_resource.rb +65 -0
- data/lib/unit/models/application/application.rb +98 -10
- data/lib/unit/models/application/create_business_application_request.rb +34 -13
- data/lib/unit/models/application/create_individual_application_request.rb +12 -8
- data/lib/unit/models/application/create_sole_proprietor_application_request.rb +113 -0
- data/lib/unit/models/application/create_trust_application_request.rb +67 -0
- data/lib/unit/models/application/patch_trust_application_request.rb +31 -0
- data/lib/unit/models/application_form/application_form.rb +43 -0
- data/lib/unit/models/application_form/create_application_form_request.rb +48 -0
- data/lib/unit/models/application_form/list_application_form_params.rb +30 -0
- data/lib/unit/models/authorization/authorization.rb +42 -0
- data/lib/unit/models/authorization/get_request.rb +22 -0
- data/lib/unit/models/authorization/list_request.rb +67 -0
- data/lib/unit/models/authorization_request/approve_request.rb +37 -0
- data/lib/unit/models/authorization_request/authorization_request.rb +55 -0
- data/lib/unit/models/authorization_request/decline_request.rb +31 -0
- data/lib/unit/models/authorization_request/list_authorization_params.rb +44 -0
- data/lib/unit/models/card/card.rb +102 -4
- data/lib/unit/models/card/create_business_credit_card_request.rb +29 -0
- data/lib/unit/models/card/create_business_debit_card_request.rb +10 -6
- data/lib/unit/models/card/create_business_virtual_credit_card_request.rb +25 -0
- data/lib/unit/models/card/create_business_virtual_debit_card_request.rb +10 -6
- data/lib/unit/models/card/create_individual_debit_card_request.rb +7 -3
- data/lib/unit/models/card/create_individual_virtual_card_request.rb +6 -3
- data/lib/unit/models/card/patch_business_card_request.rb +50 -0
- data/lib/unit/models/card/patch_business_credit_card_request.rb +22 -0
- data/lib/unit/models/card/patch_business_virtual_card_request.rb +43 -0
- data/lib/unit/models/card/patch_business_virtual_credit_card_request.rb +20 -0
- data/lib/unit/models/customer/list_customer_params.rb +4 -2
- data/lib/unit/models/event/event.rb +37 -0
- data/lib/unit/models/event/list_event_params.rb +37 -0
- data/lib/unit/models/fee/create_fee_request.rb +43 -0
- data/lib/unit/models/fee/fee.rb +34 -0
- data/lib/unit/models/fee/reverse_fee_request.rb +43 -0
- data/lib/unit/models/payment/batch_release_request_builder.rb +21 -0
- data/lib/unit/models/payment/bulk_payment_request.rb +15 -0
- data/lib/unit/models/payment/create_ach_payment_inline_request.rb +29 -19
- data/lib/unit/models/payment/create_batch_release_request.rb +54 -0
- data/lib/unit/models/payment/create_book_payment_request.rb +24 -14
- data/lib/unit/models/payment/create_payment_linked_request.rb +31 -21
- data/lib/unit/models/payment/create_wire_payment_request.rb +22 -12
- data/lib/unit/models/payment/create_with_plaid_token_request.rb +32 -22
- data/lib/unit/models/payment/payment.rb +40 -12
- data/lib/unit/models/received_payment/list_payment_params.rb +51 -0
- data/lib/unit/models/received_payment/patch_payment_request.rb +31 -0
- data/lib/unit/models/received_payment/received_payment.rb +54 -0
- data/lib/unit/models/recurring_payment/create_recurring_credit_ach_payment_request.rb +52 -0
- data/lib/unit/models/recurring_payment/create_recurring_credit_book_payment_request.rb +54 -0
- data/lib/unit/models/recurring_payment/create_recurring_debit_ach_payment_request.rb +60 -0
- data/lib/unit/models/recurring_payment/list_recurring_payment_params.rb +60 -0
- data/lib/unit/models/recurring_payment/recurring_payment.rb +106 -0
- data/lib/unit/models/repayment/create_ach_repayment_request.rb +57 -0
- data/lib/unit/models/repayment/create_book_repayment_request.rb +53 -0
- data/lib/unit/models/repayment/list_repayment_params.rb +48 -0
- data/lib/unit/models/repayment/repayment.rb +67 -0
- data/lib/unit/models/reward/create_reward_request.rb +49 -0
- data/lib/unit/models/reward/get_request.rb +22 -0
- data/lib/unit/models/reward/list_reward_params.rb +65 -0
- data/lib/unit/models/reward/reward.rb +55 -0
- data/lib/unit/models/unit_response.rb +1 -1
- data/lib/unit/models/webhook/create_webhook_request.rb +49 -0
- data/lib/unit/models/webhook/list_webhook_params.rb +39 -0
- data/lib/unit/models/webhook/patch_webhook_request.rb +47 -0
- data/lib/unit/models/webhook/webhook.rb +80 -0
- data/lib/unit/types/application_form_prefill.rb +84 -0
- data/lib/unit/types/application_form_settings_override.rb +51 -0
- data/lib/unit/types/beneficial_owner.rb +15 -10
- data/lib/unit/types/beneficiary.rb +25 -0
- data/lib/unit/types/create_schedule.rb +38 -0
- data/lib/unit/types/evaluation_params.rb +4 -4
- data/lib/unit/types/grantor.rb +37 -0
- data/lib/unit/types/officer.rb +26 -13
- data/lib/unit/types/power_of_attorney_agent.rb +5 -12
- data/lib/unit/types/require_id_verification.rb +29 -0
- data/lib/unit/types/trust_contact.rb +34 -0
- data/lib/unit/types/trustee.rb +37 -0
- data/lib/unit/version.rb +1 -1
- data/lib/unit_ruby_sdk.rb +28 -0
- metadata +67 -2
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require_relative "./base_resource"
|
6
|
+
require_relative "../utils/http_helper"
|
7
|
+
|
8
|
+
# class for creating requests for repayments to Unit API and parsing responses
|
9
|
+
# @see https://docs.unit.co/repayments
|
10
|
+
module Unit
|
11
|
+
module Resource
|
12
|
+
class RepaymentResource < Unit::Resource::BaseResource
|
13
|
+
class << self
|
14
|
+
# Get a repayment by calling Unit's API
|
15
|
+
# @param request [GetRequest]
|
16
|
+
# @return [UnitResponse, UnitError]
|
17
|
+
def get(repayment_id)
|
18
|
+
response = HttpHelper.get("#{api_url}/repayments/#{repayment_id}", headers: headers)
|
19
|
+
response_handler(response)
|
20
|
+
end
|
21
|
+
|
22
|
+
# List repayments by calling Unit's API
|
23
|
+
# @param request [ListRepaymentParams]
|
24
|
+
# @return [UnitResponse, UnitError]
|
25
|
+
def list(params = nil)
|
26
|
+
response = HttpHelper.get("#{api_url}/repayments", params: params&.to_hash, headers: headers)
|
27
|
+
response_handler(response)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Create a repayment by calling Unit's API
|
31
|
+
# @param request [CreateAchRepaymentRequest, CreateBookRepaymentRequest]
|
32
|
+
# @return [UnitResponse, UnitError]
|
33
|
+
def create(request)
|
34
|
+
payload = request.to_json_api
|
35
|
+
response = HttpHelper.post("#{api_url}/repayments", body: payload, headers: headers)
|
36
|
+
response_handler(response)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "./base_resource"
|
4
|
+
require_relative "../utils/http_helper"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
# class for creating request for rewards to Unit API and parsing responses
|
8
|
+
# @see https://docs.unit.co/Rewards
|
9
|
+
module Unit
|
10
|
+
module Resource
|
11
|
+
class RewardResource < Unit::Resource::BaseResource
|
12
|
+
class << self
|
13
|
+
# Create a new reward by calling Unit's API
|
14
|
+
# @param request [CreateRewardRequest]
|
15
|
+
# @return [UnitResponse, UnitError]
|
16
|
+
def create_reward(request)
|
17
|
+
payload = request.to_json_api
|
18
|
+
response = HttpHelper.post("#{api_url}/rewards", body: payload, headers: headers)
|
19
|
+
response_handler(response)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get a reward by calling Unit's API
|
23
|
+
# @param request [GetRequest]
|
24
|
+
# @return [UnitResponse, UnitError]
|
25
|
+
def get_reward(request)
|
26
|
+
payload = request.to_hash
|
27
|
+
response = HttpHelper.get("#{api_url}/rewards/#{request.reward_id}", params: payload, headers: headers)
|
28
|
+
response_handler(response)
|
29
|
+
end
|
30
|
+
|
31
|
+
# List rewards by calling Unit's API
|
32
|
+
# @param params [ListRewardParams]
|
33
|
+
# @return [UnitResponse, UnitError]
|
34
|
+
def list_rewards(params = nil)
|
35
|
+
response = HttpHelper.get("#{api_url}/rewards", params: params&.to_hash, headers: headers)
|
36
|
+
response_handler(response)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "./base_resource"
|
4
|
+
require_relative "../utils/http_helper"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
# class for creating requests for webhooks
|
8
|
+
# @see https://docs.unit.co/webhooks/#webhook
|
9
|
+
module Unit
|
10
|
+
module Resource
|
11
|
+
class WebhookResource < Unit::Resource::BaseResource
|
12
|
+
class << self
|
13
|
+
# Create a webhook by calling Unit's API
|
14
|
+
# @param request [CreateWebhookRequest]
|
15
|
+
# @return [UnitResponse, UnitError]
|
16
|
+
def create_webhook(request)
|
17
|
+
payload = request.to_json_api
|
18
|
+
response = HttpHelper.post("#{api_url}/webhooks", body: payload, headers: headers)
|
19
|
+
response_handler(response)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get a webhook by calling Unit's API
|
23
|
+
# @param webhook_id [String]
|
24
|
+
# @return [UnitResponse, UnitError]
|
25
|
+
def get_webhook(webhook_id)
|
26
|
+
response = HttpHelper.get("#{api_url}/webhooks/#{webhook_id}", headers: headers)
|
27
|
+
response_handler(response)
|
28
|
+
end
|
29
|
+
|
30
|
+
# List webhooks by calling Unit's API
|
31
|
+
# @param params [ListWebhookParams]
|
32
|
+
# @return [UnitResponse, UnitError]
|
33
|
+
def list_webhooks(params = nil)
|
34
|
+
response = HttpHelper.get("#{api_url}/webhooks", params: params.to_hash, headers: headers)
|
35
|
+
response_handler(response)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Update a webhook by calling Unit's API
|
39
|
+
# @param request [PatchWebhookRequest]
|
40
|
+
# @return [UnitResponse, UnitError]
|
41
|
+
def update_webhook(request)
|
42
|
+
payload = request.to_json_api
|
43
|
+
response = HttpHelper.patch("#{api_url}/webhooks/#{request.webhook_id}", body: payload, headers: headers)
|
44
|
+
response_handler(response)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Enable a webhook by calling Unit's API
|
48
|
+
# @param webhook_id [String]
|
49
|
+
# @return [UnitResponse, UnitError]
|
50
|
+
def enable_webhook(webhook_id)
|
51
|
+
response = HttpHelper.post("#{api_url}/webhooks/#{webhook_id}/enable", headers: headers)
|
52
|
+
response_handler(response)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Disable a webhook by calling Unit's API
|
56
|
+
# @param webhook_id [String]
|
57
|
+
# @return [UnitResponse, UnitError]
|
58
|
+
def disable_webhook(webhook_id)
|
59
|
+
response = HttpHelper.post("#{api_url}/webhooks/#{webhook_id}/disable", headers: headers)
|
60
|
+
response_handler(response)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -5,43 +5,55 @@ module Unit
|
|
5
5
|
APPLICATION_LIST_OFFSET = 0
|
6
6
|
APPLICATION_LIST_LIMIT = 100
|
7
7
|
autoload :CreateBusinessApplicationRequest, "unit/models/application/create_business_application_request"
|
8
|
+
autoload :CreateSoleProprietorApplicationRequest, "unit/models/application/create_sole_proprietor_application_request"
|
8
9
|
autoload :CreateIndividualApplicationRequest, "unit/models/application/create_individual_application_request"
|
9
10
|
autoload :ListApplicationParams, "unit/models/application/list_application_params"
|
10
11
|
autoload :PatchApplicationRequest, "unit/models/application/patch_application_request"
|
11
12
|
autoload :UploadDocumentRequest, "unit/models/application/upload_document_request"
|
12
|
-
|
13
|
+
autoload :CreateTrustApplicationRequest, "unit/models/application/create_trust_application_request"
|
14
|
+
autoload :PatchTrustApplicationRequest, "unit/models/application/patch_trust_application_request"
|
13
15
|
class << self
|
14
16
|
# Create a new business application by calling Unit's API
|
17
|
+
# @see https://docs.unit.co/applications#create-business-application
|
15
18
|
# @param name [String]
|
16
19
|
# @param address [Address]
|
17
20
|
# @param phone [Phone]
|
18
21
|
# @param state_of_incorporation [String]
|
19
22
|
# @param ein [String]
|
20
|
-
# @param industry [String]
|
21
23
|
# @param contact [BusinessContact]
|
22
24
|
# @param officer [Officer]
|
23
25
|
# @param beneficial_owners [Array]
|
24
26
|
# @param entity_type [String]
|
27
|
+
# @param industry [String] - optional
|
25
28
|
# @param dba [String] - optional
|
26
29
|
# @param ip [String] - optional
|
27
30
|
# @param website [String] - optional
|
28
31
|
# @param tags [Hash] - optional
|
29
32
|
# @param idempotency_key [String] - optional
|
30
33
|
# @param device_fingerprints [DeviceFingerprint] - optional
|
31
|
-
# @
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
# @param annual_revenue [String] - optional
|
35
|
+
# @param number_of_employees [String] - optional
|
36
|
+
# @param cash_flow [String] - optional
|
37
|
+
# @param year_of_incorporation [String] - optional
|
38
|
+
# @param countries_of_operation [Array<String>] - optional
|
39
|
+
# @param stock_symbol [String] - optional
|
40
|
+
# @param business_vertical [String] - optional
|
41
|
+
def create_business_application(name:, address:, phone:, state_of_incorporation:, ein:, contact:,
|
42
|
+
officer:, beneficial_owners:, entity_type:, industry: nil, dba: nil, ip: nil, website: nil,
|
43
|
+
tags: nil, idempotency_key: nil, device_fingerprints: nil, annual_revenue: nil, number_of_employees: nil,
|
44
|
+
cash_flow: nil, year_of_incorporation: nil, countries_of_operation: nil, stock_symbol: nil, business_vertical: nil)
|
35
45
|
|
36
46
|
request = CreateBusinessApplicationRequest.new(
|
37
|
-
name, address, phone, state_of_incorporation, ein,
|
38
|
-
beneficial_owners, entity_type, dba, ip, website, tags, idempotency_key, device_fingerprints
|
47
|
+
name, address, phone, state_of_incorporation, ein, contact, officer,
|
48
|
+
beneficial_owners, entity_type, industry, dba, ip, website, tags, idempotency_key, device_fingerprints,
|
49
|
+
annual_revenue, number_of_employees, cash_flow, year_of_incorporation, countries_of_operation, stock_symbol, business_vertical
|
39
50
|
)
|
40
51
|
|
41
52
|
Unit::Resource::ApplicationResource.create_application(request)
|
42
53
|
end
|
43
54
|
|
44
55
|
# Create a new individual application by calling Unit's API
|
56
|
+
# @see https://docs.unit.co/applications#create-individual-application
|
45
57
|
# @param ssn [String]
|
46
58
|
# @param full_name [FullName]
|
47
59
|
# @param date_of_birth [Date]
|
@@ -61,21 +73,67 @@ module Unit
|
|
61
73
|
# @param jwt_subject [String] - optional
|
62
74
|
# @param power_of_attorney_agent [PowerOfAttorneyAgent] - optional
|
63
75
|
# @param evaluation_params [EvaluationParams] - optional
|
76
|
+
# @param occupation [String] - optional
|
77
|
+
# @param annual_income [String] - optional
|
78
|
+
# @param source_of_income [String] - optional
|
64
79
|
# @return [UnitResponse, UnitError]
|
65
80
|
def create_individual_application(ssn:, full_name:, date_of_birth:, address:, email:, phone:, ip: nil, ein: nil,
|
66
81
|
industry: nil, dba: nil, sole_proprietorship: nil, passport: nil, nationality: nil,
|
67
82
|
device_fingerprints: nil, idempotency_key: nil, tags: nil, jwt_subject: nil,
|
68
|
-
power_of_attorney_agent: nil, evaluation_params: nil)
|
83
|
+
power_of_attorney_agent: nil, evaluation_params: nil, occupation: nil, annual_income: nil, source_of_income: nil)
|
69
84
|
|
70
85
|
request = CreateIndividualApplicationRequest.new(
|
71
86
|
ssn, full_name, date_of_birth, address, email, phone, ip, ein, industry, dba, sole_proprietorship, passport,
|
72
|
-
nationality, device_fingerprints, idempotency_key, tags, jwt_subject, power_of_attorney_agent, evaluation_params
|
87
|
+
nationality, device_fingerprints, idempotency_key, tags, jwt_subject, power_of_attorney_agent, evaluation_params,
|
88
|
+
occupation, annual_income, source_of_income
|
73
89
|
)
|
90
|
+
Unit::Resource::ApplicationResource.create_application(request)
|
91
|
+
end
|
74
92
|
|
93
|
+
# Create a new sole proprietor application by calling Unit's API
|
94
|
+
# @see https://docs.unit.co/applications#create-sole-proprietor-application
|
95
|
+
# @param nationality [String]
|
96
|
+
# @param full_name [FullName]
|
97
|
+
# @param date_of_birth [Date]
|
98
|
+
# @param address [Address]
|
99
|
+
# @param phone [Phone]
|
100
|
+
# @param email [String]
|
101
|
+
# @param sole_proprietorship [Boolean]
|
102
|
+
# @param industry [String]
|
103
|
+
# @param ssn [String] - optional
|
104
|
+
# @param passport [String] - optional
|
105
|
+
# @param ein [String] - optional
|
106
|
+
# @param dba [String] - optional
|
107
|
+
# @param power_of_attorney_agent [PowerOfAttorneyAgent] - optional
|
108
|
+
# @param evaluation_params [EvaluationParams] - optional
|
109
|
+
# @param occupation [String] - optional
|
110
|
+
# @param annual_income [String] - optional
|
111
|
+
# @param source_of_income [String] - optional
|
112
|
+
# @param annual_revenue [String] - optional
|
113
|
+
# @param number_of_employees [String] - optional
|
114
|
+
# @param business_vertical [String] - optional
|
115
|
+
# @param website [String] - optional
|
116
|
+
# @param ip [String] - optional
|
117
|
+
# @param tags [Hash] - optional
|
118
|
+
# @param idempotency_key [String] - optional
|
119
|
+
# @param device_fingerprints [Array<DeviceFingerprint>] - optional
|
120
|
+
# @param jwt_subject [String] - optional
|
121
|
+
# @return [UnitResponse, UnitError]
|
122
|
+
def create_sole_proprietor_application(nationality:, full_name:, date_of_birth:, address:, phone:,
|
123
|
+
email:, industry:, ssn: nil, passport: nil, ein: nil, dba: nil, power_of_attorney_agent: nil, evaluation_params: nil,
|
124
|
+
occupation: nil, annual_income: nil, source_of_income: nil, annual_revenue: nil,
|
125
|
+
number_of_employees: nil, business_vertical: nil, website: nil, ip: nil, tags: nil,
|
126
|
+
idempotency_key: nil, device_fingerprints: nil, jwt_subject: nil, sole_proprietorship: true)
|
127
|
+
request = CreateSoleProprietorApplicationRequest.new(nationality, full_name, date_of_birth, address, phone,
|
128
|
+
email, industry, ssn, passport, ein, dba, power_of_attorney_agent, evaluation_params,
|
129
|
+
occupation, annual_income, source_of_income, annual_revenue, number_of_employees,
|
130
|
+
business_vertical, website, ip, tags, idempotency_key,
|
131
|
+
device_fingerprints, jwt_subject, sole_proprietorship: sole_proprietorship)
|
75
132
|
Unit::Resource::ApplicationResource.create_application(request)
|
76
133
|
end
|
77
134
|
|
78
135
|
# Update an application by calling Unit's API
|
136
|
+
# @see https://docs.unit.co/applications#update-individual-application
|
79
137
|
# @param application_id [String] The application id
|
80
138
|
# @param type [String] The type
|
81
139
|
# @param tags [Hash] The tags
|
@@ -86,6 +144,7 @@ module Unit
|
|
86
144
|
end
|
87
145
|
|
88
146
|
# List applications by calling Unit's API
|
147
|
+
# @see https://docs.unit.co/applications#list-applications
|
89
148
|
# @param offset [Integer] Number of resources to skip.
|
90
149
|
# @param limit [Integer] The limit Maximum number of resources that will be returned.
|
91
150
|
# @param email [String] Filter applications by email address (case sensitive).
|
@@ -102,6 +161,7 @@ module Unit
|
|
102
161
|
end
|
103
162
|
|
104
163
|
# Get an application by calling Unit's API
|
164
|
+
# @see https://docs.unit.co/applications#get-application-by-id
|
105
165
|
# @param [String] application_id
|
106
166
|
# @return [UnitResponse, UnitError]
|
107
167
|
def get_application(application_id)
|
@@ -109,6 +169,7 @@ module Unit
|
|
109
169
|
end
|
110
170
|
|
111
171
|
# Upload an application document by calling Unit's API
|
172
|
+
# @see https://docs.unit.co/application-documents#upload-document
|
112
173
|
# @param application_id [String] The application ID
|
113
174
|
# @param document_id [String] The document ID
|
114
175
|
# @param file [String] The file content
|
@@ -119,6 +180,33 @@ module Unit
|
|
119
180
|
request = UploadDocumentRequest.new(application_id, document_id, file, file_type, is_back_side: is_back_side)
|
120
181
|
Unit::Resource::ApplicationResource.upload(request)
|
121
182
|
end
|
183
|
+
|
184
|
+
# Create a trust application
|
185
|
+
# @see https://docs.unit.co/applications/#create-trust-application
|
186
|
+
# @param name [String]
|
187
|
+
# @param state_of_incorporation [String]
|
188
|
+
# @param revocability [String]
|
189
|
+
# @param source_of_funds [String]
|
190
|
+
# @param tax_id [String]
|
191
|
+
# @param grantor [Grantor]
|
192
|
+
# @param trustees [Array<Trustee>]
|
193
|
+
# @param beneficiaries [Array<Beneficiary>]
|
194
|
+
# @param contact [TrustContact]
|
195
|
+
# @param ip [String] - optional
|
196
|
+
# @param tags [Hash] - optional
|
197
|
+
# @param idempotency_key [String] - optional
|
198
|
+
# @param device_fingerprints [Array<DeviceFingerprint>] - optional
|
199
|
+
def create_trust_application(name:, state_of_incorporation:, revocability:, source_of_funds:, tax_id:,
|
200
|
+
grantor:, trustees:, beneficiaries:, contact:, ip: nil, tags: nil, idempotency_key: nil, device_fingerprints: nil)
|
201
|
+
request = CreateTrustApplicationRequest.new(name, state_of_incorporation, revocability, source_of_funds, tax_id,
|
202
|
+
grantor, trustees, beneficiaries, contact, ip, tags, idempotency_key, device_fingerprints)
|
203
|
+
Unit::Resource::ApplicationResource.create_application(request)
|
204
|
+
end
|
205
|
+
|
206
|
+
def update_trust_application(application_id:, tags: nil)
|
207
|
+
request = PatchTrustApplicationRequest.new(application_id, tags)
|
208
|
+
Unit::Resource::ApplicationResource.update(request)
|
209
|
+
end
|
122
210
|
end
|
123
211
|
end
|
124
212
|
end
|
@@ -1,39 +1,43 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "unit/types/full_name"
|
4
|
-
require "unit/types/address"
|
5
|
-
require "unit/types/phone"
|
6
|
-
require "unit/types/business_contact"
|
7
|
-
require "unit/types/beneficial_owner"
|
8
|
-
require "unit/types/officer"
|
9
|
-
|
10
3
|
# Request to create a business application
|
11
4
|
# @see https://docs.unit.co/applications/#create-business-application
|
12
5
|
module Unit
|
13
6
|
module Application
|
14
7
|
class CreateBusinessApplicationRequest
|
15
8
|
attr_reader :name, :address, :phone, :state_of_incorporation, :ein, :industry, :contact, :officer, :beneficial_owners,
|
16
|
-
:entity_type, :dba, :ip, :website, :tags, :idempotency_key, :device_fingerprints,
|
9
|
+
:entity_type, :dba, :ip, :website, :tags, :idempotency_key, :device_fingerprints,
|
10
|
+
:annual_revenue, :number_of_employees, :cash_flow, :year_of_incorporation,
|
11
|
+
:countries_of_operation, :stock_symbol, :business_vertical, :type
|
17
12
|
|
18
13
|
# @param name [String]
|
19
14
|
# @param address [Address]
|
20
15
|
# @param phone [Phone]
|
21
16
|
# @param state_of_incorporation [String]
|
22
17
|
# @param ein [String]
|
23
|
-
# @param industry [String]
|
24
18
|
# @param contact [BusinessContact]
|
25
19
|
# @param officer [Officer]
|
26
20
|
# @param beneficial_owners [Array]
|
27
21
|
# @param entity_type [String]
|
22
|
+
# @param industry [String] - optional
|
28
23
|
# @param dba [String] - optional
|
29
24
|
# @param ip [String] - optional
|
30
25
|
# @param website [String] - optional
|
31
26
|
# @param tags [Hash] - optional
|
32
27
|
# @param idempotency_key [String] - optional
|
33
28
|
# @param device_fingerprints [DeviceFingerprint] - optional
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
# @param annual_revenue [String] - optional
|
30
|
+
# @param number_of_employees [String] - optional
|
31
|
+
# @param cash_flow [String] - optional
|
32
|
+
# @param year_of_incorporation [String] - optional
|
33
|
+
# @param countries_of_operation [Array<String>] - optional
|
34
|
+
# @param stock_symbol [String] - optional
|
35
|
+
# @param business_vertical [String] - optional
|
36
|
+
def initialize(name, address, phone, state_of_incorporation, ein, contact, officer,
|
37
|
+
beneficial_owners, entity_type, industry = nil, dba = nil, ip = nil, website = nil, tags = nil, idempotency_key = nil,
|
38
|
+
device_fingerprints = nil, annual_revenue = nil, number_of_employees = nil,
|
39
|
+
cash_flow = nil, year_of_incorporation = nil, countries_of_operation = nil,
|
40
|
+
stock_symbol = nil, business_vertical = nil)
|
37
41
|
@name = name
|
38
42
|
@address = address
|
39
43
|
@phone = phone
|
@@ -50,6 +54,13 @@ module Unit
|
|
50
54
|
@tags = tags
|
51
55
|
@idempotency_key = idempotency_key
|
52
56
|
@device_fingerprints = device_fingerprints
|
57
|
+
@annual_revenue = annual_revenue
|
58
|
+
@number_of_employees = number_of_employees
|
59
|
+
@cash_flow = cash_flow
|
60
|
+
@year_of_incorporation = year_of_incorporation
|
61
|
+
@countries_of_operation = countries_of_operation
|
62
|
+
@stock_symbol = stock_symbol
|
63
|
+
@business_vertical = business_vertical
|
53
64
|
@type = "businessApplication"
|
54
65
|
end
|
55
66
|
|
@@ -70,7 +81,17 @@ module Unit
|
|
70
81
|
entityType: entity_type,
|
71
82
|
dba: dba,
|
72
83
|
ip: ip,
|
73
|
-
website: website
|
84
|
+
website: website,
|
85
|
+
tags: tags,
|
86
|
+
idempotency_key: idempotency_key,
|
87
|
+
device_fingerprints: device_fingerprints,
|
88
|
+
annual_revenue: annual_revenue,
|
89
|
+
number_of_employees: number_of_employees,
|
90
|
+
cashFlow: cash_flow,
|
91
|
+
yearOfIncorporation: year_of_incorporation,
|
92
|
+
countriesOfOperation: countries_of_operation&.join(","),
|
93
|
+
stockSymbol: stock_symbol,
|
94
|
+
businessVertical: business_vertical
|
74
95
|
}
|
75
96
|
}
|
76
97
|
}
|
@@ -1,10 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "unit/types/full_name"
|
4
|
-
require "unit/types/address"
|
5
|
-
require "unit/types/phone"
|
6
|
-
require "unit/types/device_fingerprint"
|
7
|
-
|
8
3
|
# Request to create an individual application
|
9
4
|
# @see https://docs.unit.co/applications/#create-individual-application
|
10
5
|
module Unit
|
@@ -12,7 +7,7 @@ module Unit
|
|
12
7
|
class CreateIndividualApplicationRequest
|
13
8
|
attr_reader :type, :ssn, :full_name, :date_of_birth, :address, :email, :phone, :ip, :ein, :industry, :dba, :sole_proprietorship,
|
14
9
|
:passport, :nationality, :device_fingerprints, :idempotency_key, :tags, :jwt_subject, :power_of_attorney_agent,
|
15
|
-
:evaluation_params
|
10
|
+
:evaluation_params, :occupation, :annual_income, :source_of_income
|
16
11
|
|
17
12
|
# @param ssn [String]
|
18
13
|
# @param full_name [FullName]
|
@@ -33,9 +28,12 @@ module Unit
|
|
33
28
|
# @param jwt_subject [String] - optional
|
34
29
|
# @param power_of_attorney_agent [PowerOfAttorneyAgent] - optional
|
35
30
|
# @param evaluation_params [EvaluationParams] - optional
|
31
|
+
# @param occupation [String] - optional
|
32
|
+
# @param annual_income [String] - optional
|
33
|
+
# @param source_of_income [String] - optional
|
36
34
|
def initialize(ssn, full_name, date_of_birth, address, email, phone, ip = nil, ein = nil, industry = nil, dba = nil, sole_proprietorship = nil, passport = nil,
|
37
35
|
nationality = nil, device_fingerprints = nil, idempotency_key = nil, tags = nil, jwt_subject = nil, power_of_attorney_agent = nil,
|
38
|
-
evaluation_params = nil)
|
36
|
+
evaluation_params = nil, occupation = nil, annual_income = nil, source_of_income = nil)
|
39
37
|
@ssn = ssn
|
40
38
|
@full_name = full_name
|
41
39
|
@date_of_birth = date_of_birth
|
@@ -55,6 +53,9 @@ module Unit
|
|
55
53
|
@jwt_object = jwt_subject
|
56
54
|
@power_of_attorney_agent = power_of_attorney_agent
|
57
55
|
@evaluation_params = evaluation_params
|
56
|
+
@occupation = occupation
|
57
|
+
@annual_income = annual_income
|
58
|
+
@source_of_income = source_of_income
|
58
59
|
@type = "individualApplication"
|
59
60
|
end
|
60
61
|
|
@@ -80,7 +81,10 @@ module Unit
|
|
80
81
|
tags: tags,
|
81
82
|
jwtSubject: jwt_subject,
|
82
83
|
powerOfAttorneyAgent: power_of_attorney_agent&.represent,
|
83
|
-
evaluationParams: evaluation_params&.represent
|
84
|
+
evaluationParams: evaluation_params&.represent,
|
85
|
+
occupation: occupation,
|
86
|
+
annualIncome: annual_income,
|
87
|
+
sourceOfIncome: source_of_income
|
84
88
|
}
|
85
89
|
}
|
86
90
|
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Request to create a proprietor application
|
4
|
+
# @see https://docs.unit.co/applications#create-sole-proprietor-application
|
5
|
+
module Unit
|
6
|
+
module Application
|
7
|
+
class CreateSoleProprietorApplicationRequest
|
8
|
+
attr_reader :ssn, :passport, :nationality, :full_name, :date_of_birth,
|
9
|
+
:address, :phone, :email, :sole_proprietorship, :ein, :industry,
|
10
|
+
:dba, :power_of_attorney_agent, :evaluation_params, :occupation,
|
11
|
+
:annual_income, :source_of_income, :annual_revenue, :number_of_employees,
|
12
|
+
:business_vertical, :website, :ip, :tags, :idempotency_key,
|
13
|
+
:device_fingerprints, :jwt_subject
|
14
|
+
|
15
|
+
# @param nationality [String]
|
16
|
+
# @param full_name [FullName]
|
17
|
+
# @param date_of_birth [Date]
|
18
|
+
# @param address [Address]
|
19
|
+
# @param phone [Phone]
|
20
|
+
# @param email [String]
|
21
|
+
# @param sole_proprietorship [Boolean]
|
22
|
+
# @param industry [String]
|
23
|
+
# @param ssn [String] - optional
|
24
|
+
# @param passport [String] - optional
|
25
|
+
# @param ein [String] - optional
|
26
|
+
# @param dba [String] - optional
|
27
|
+
# @param power_of_attorney_agent [PowerOfAttorneyAgent] - optional
|
28
|
+
# @param evaluation_params [EvaluationParams] - optional
|
29
|
+
# @param occupation [String] - optional
|
30
|
+
# @param annual_income [String] - optional
|
31
|
+
# @param source_of_income [String] - optional
|
32
|
+
# @param annual_revenue [String] - optional
|
33
|
+
# @param number_of_employees [String] - optional
|
34
|
+
# @param business_vertical [String] - optional
|
35
|
+
# @param website [String] - optional
|
36
|
+
# @param ip [String] - optional
|
37
|
+
# @param tags [Hash] - optional
|
38
|
+
# @param idempotency_key [String] - optional
|
39
|
+
# @param device_fingerprints [Array<DeviceFingerprint>] - optional
|
40
|
+
# @param jwt_subject [String] - optional
|
41
|
+
def initialize(nationality, full_name, date_of_birth, address, phone,
|
42
|
+
email, industry, ssn = nil, passport = nil, ein = nil, dba = nil, power_of_attorney_agent = nil, evaluation_params = nil,
|
43
|
+
occupation = nil, annual_income = nil, source_of_income = nil, annual_revenue = nil,
|
44
|
+
number_of_employees = nil, business_vertical = nil, website = nil, ip = nil, tags = nil,
|
45
|
+
idempotency_key = nil, device_fingerprints = nil, jwt_subject = nil, sole_proprietorship: true)
|
46
|
+
@ssn = ssn
|
47
|
+
@passport = passport
|
48
|
+
@nationality = nationality
|
49
|
+
@full_name = full_name
|
50
|
+
@date_of_birth = date_of_birth
|
51
|
+
@address = address
|
52
|
+
@phone = phone
|
53
|
+
@email = email
|
54
|
+
@sole_proprietorship = sole_proprietorship
|
55
|
+
@ein = ein
|
56
|
+
@industry = industry
|
57
|
+
@dba = dba
|
58
|
+
@power_of_attorney_agent = power_of_attorney_agent
|
59
|
+
@evaluation_params = evaluation_params
|
60
|
+
@occupation = occupation
|
61
|
+
@annual_income = annual_income
|
62
|
+
@source_of_income = source_of_income
|
63
|
+
@annual_revenue = annual_revenue
|
64
|
+
@number_of_employees = number_of_employees
|
65
|
+
@business_vertical = business_vertical
|
66
|
+
@website = website
|
67
|
+
@ip = ip
|
68
|
+
@tags = tags
|
69
|
+
@idempotency_key = idempotency_key
|
70
|
+
@device_fingerprints = device_fingerprints
|
71
|
+
@jwt_subject = jwt_subject
|
72
|
+
end
|
73
|
+
|
74
|
+
def to_json_api
|
75
|
+
payload = {
|
76
|
+
data: {
|
77
|
+
type: "individualApplication",
|
78
|
+
attributes: {
|
79
|
+
ssn: ssn,
|
80
|
+
passport: passport,
|
81
|
+
nationality: nationality,
|
82
|
+
fullName: full_name.represent,
|
83
|
+
dateOfBirth: date_of_birth,
|
84
|
+
address: address.represent,
|
85
|
+
phone: phone&.represent,
|
86
|
+
email: email,
|
87
|
+
soleProprietorship: sole_proprietorship,
|
88
|
+
ein: ein,
|
89
|
+
industry: industry,
|
90
|
+
dba: dba,
|
91
|
+
powerOfAttorneyAgent: power_of_attorney_agent&.represent,
|
92
|
+
evaluationParams: evaluation_params&.represent,
|
93
|
+
occupation: occupation,
|
94
|
+
annualIncome: annual_income,
|
95
|
+
sourceOfIncome: source_of_income,
|
96
|
+
annualRevenue: annual_revenue,
|
97
|
+
numberOfEmployees: number_of_employees,
|
98
|
+
businessVertical: business_vertical,
|
99
|
+
website: website,
|
100
|
+
ip: ip,
|
101
|
+
tags: tags,
|
102
|
+
idempotencyKey: idempotency_key,
|
103
|
+
deviceFingerprints: device_fingerprints&.map(&:represent),
|
104
|
+
jwtSubject: jwt_subject
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
payload[:data][:attributes].compact!
|
109
|
+
payload.to_json
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Request to create a trust application
|
4
|
+
# @see https://docs.unit.co/applications#create-trust-application
|
5
|
+
module Unit
|
6
|
+
module Application
|
7
|
+
class CreateTrustApplicationRequest
|
8
|
+
attr_reader :name, :state_of_incorporation, :revocability, :source_of_funds, :tax_id,
|
9
|
+
:grantor, :trustees, :beneficiaries, :contact, :ip, :tags, :idempotency_key, :device_fingerprints
|
10
|
+
|
11
|
+
# @param name [String]
|
12
|
+
# @param state_of_incorporation [String]
|
13
|
+
# @param revocability [String]
|
14
|
+
# @param source_of_funds [String]
|
15
|
+
# @param tax_id [String]
|
16
|
+
# @param grantor [Grantor]
|
17
|
+
# @param trustees [Array<Trustee>]
|
18
|
+
# @param beneficiaries [Array<Beneficiary>]
|
19
|
+
# @param contact [TrustContact]
|
20
|
+
# @param ip [String] - optional
|
21
|
+
# @param tags [Hash] - optional
|
22
|
+
# @param idempotency_key [String] - optional
|
23
|
+
# @param device_fingerprints [Array<DeviceFingerprint>] - optional
|
24
|
+
def initialize(name, state_of_incorporation, revocability, source_of_funds, tax_id,
|
25
|
+
grantor, trustees, beneficiaries, contact, ip = nil, tags = nil, idempotency_key = nil, device_fingerprints = nil)
|
26
|
+
@name = name
|
27
|
+
@state_of_incorporation = state_of_incorporation
|
28
|
+
@revocability = revocability
|
29
|
+
@source_of_funds = source_of_funds
|
30
|
+
@tax_id = tax_id
|
31
|
+
@grantor = grantor
|
32
|
+
@trustees = trustees
|
33
|
+
@beneficiaries = beneficiaries
|
34
|
+
@contact = contact
|
35
|
+
@ip = ip
|
36
|
+
@tags = tags
|
37
|
+
@idempotency_key = idempotency_key
|
38
|
+
@device_fingerprints = device_fingerprints
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_json_api
|
42
|
+
payload = {
|
43
|
+
data: {
|
44
|
+
type: "trustApplication",
|
45
|
+
attributes: {
|
46
|
+
name: name,
|
47
|
+
stateOfIncorporation: state_of_incorporation,
|
48
|
+
revocability: revocability,
|
49
|
+
sourceOfFunds: source_of_funds,
|
50
|
+
taxId: tax_id,
|
51
|
+
grantor: grantor&.represent,
|
52
|
+
trustees: trustees,
|
53
|
+
beneficiaries: beneficiaries,
|
54
|
+
contact: contact&.represent,
|
55
|
+
ip: ip,
|
56
|
+
tags: tags,
|
57
|
+
idempotencyKey: idempotency_key,
|
58
|
+
deviceFingerprints: device_fingerprints
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
payload[:data][:attributes].compact!
|
63
|
+
payload.to_json
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|