unit_ruby_sdk 1.5.0 → 2.0.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 +27 -34
- data/lib/unit/api_resources/cash_deposit_resource.rb +47 -0
- data/lib/unit/api_resources/check_payment_resource.rb +17 -0
- data/lib/unit/api_resources/tax_form_resource.rb +39 -0
- data/lib/unit/models/application/application.rb +1 -29
- data/lib/unit/models/cash_deposit/cash_deposit.rb +53 -0
- data/lib/unit/models/cash_deposit/generate_barcode_request.rb +37 -0
- data/lib/unit/models/cash_deposit/list_by_coordinates_params.rb +33 -0
- data/lib/unit/models/cash_deposit/list_by_postal_code_params.rb +33 -0
- data/lib/unit/models/check_payment/check_payment.rb +25 -0
- data/lib/unit/models/check_payment/originate_check_payment_request.rb +57 -0
- data/lib/unit/models/tax_form/list_tax_form_params.rb +37 -0
- data/lib/unit/models/tax_form/tax_form.rb +39 -0
- data/lib/unit/types/check_payment_counterparty.rb +28 -0
- data/lib/unit/version.rb +1 -1
- data/lib/unit_ruby_sdk.rb +5 -7
- data/tax_form_1.pdf +0 -0
- metadata +13 -8
- data/lib/unit/models/application/create_trust_application_request.rb +0 -67
- data/lib/unit/models/application/patch_trust_application_request.rb +0 -31
- data/lib/unit/types/beneficiary.rb +0 -25
- data/lib/unit/types/grantor.rb +0 -37
- data/lib/unit/types/trust_contact.rb +0 -34
- data/lib/unit/types/trustee.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f637ade0b91b546e19ba9dfcc469869673505646fd991e395c4693ec79ba9a7d
|
4
|
+
data.tar.gz: 5cde210d03a1e829bb1daa89b15ac35d6f80d1ff2e58a702d28de9736818bf82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03e714af1bd2b100d9f9188cf86f0ac5d85dd6280c354f0b2b8a85ed4db1d3f7668c1f851a93b88c29c2fda25e00c5f7ff2d76bda284d4e4921815f3ea638bc0
|
7
|
+
data.tar.gz: 3adb4378919434296c6a106ad05efc6d77aa2e1940b18c436f6f2b14de008ad8aa024db50d302cebafc5910cfc7658a807f8b7d4d8d972f14ba65fead350f2a6
|
data/README.md
CHANGED
@@ -63,40 +63,6 @@ upload_document_request = Unit::Application.upload_document(
|
|
63
63
|
puts upload_document_request.data["id"]
|
64
64
|
```
|
65
65
|
|
66
|
-
### Creating a trust application
|
67
|
-
|
68
|
-
```ruby
|
69
|
-
full_name = Unit::Types::FullName.new('John', 'Doe')
|
70
|
-
date_of_birth = '1980-08-10'
|
71
|
-
address = Unit::Types::Address.new('123 Main St', 'San Francisco', 'CA', '94205', 'US')
|
72
|
-
phone = Unit::Types::Phone.new('380', '555123222')
|
73
|
-
email = 'jone.doe@unit-finance.com'
|
74
|
-
ssn = '123456789'
|
75
|
-
trust_contact = Unit::Types::TrustContact.new(full_name, email, phone, address)
|
76
|
-
beneficiaries = [Unit::Types::Beneficiary.new(full_name, date_of_birth).represent]
|
77
|
-
grantor = Unit::Types::Grantor.new(full_name, ssn, email, phone, address, date_of_birth)
|
78
|
-
trustees = [Unit::Types::Trustee.new(full_name, ssn, email, phone, address, date_of_birth).represent]
|
79
|
-
|
80
|
-
response = Unit::Application.create_trust_application(
|
81
|
-
name: "Trust me Inc.",
|
82
|
-
state_of_incorporation: "CA",
|
83
|
-
revocability: "Revocable",
|
84
|
-
source_of_funds: "Salary",
|
85
|
-
tax_id: "123456789",
|
86
|
-
grantor: grantor,
|
87
|
-
trustees: trustees,
|
88
|
-
beneficiaries: beneficiaries,
|
89
|
-
contact: trust_contact,
|
90
|
-
ip: "127.0.0.2",
|
91
|
-
tags: {
|
92
|
-
"userId": "106a75e9-de77-4e25-9561-faffe59d7814"
|
93
|
-
},
|
94
|
-
idempotency_key: "3a1a33be-4e12-4603-9ed0-820922389fb8")
|
95
|
-
|
96
|
-
trust_application = response.data
|
97
|
-
puts trust_application["id"]
|
98
|
-
```
|
99
|
-
|
100
66
|
### Creating a deposit account request
|
101
67
|
|
102
68
|
```ruby
|
@@ -273,6 +239,16 @@ recurring_payment = response.data
|
|
273
239
|
puts recurring_payment["id"]
|
274
240
|
```
|
275
241
|
|
242
|
+
### Creating a recurring payment
|
243
|
+
```ruby
|
244
|
+
schedule = Unit::Types::CreateSchedule.new("Monthly", 3)
|
245
|
+
response = Unit::RecurringPayment.create_recurring_credit_book_payment(account_id: "27573", counterparty_id: "36099", amount: 1000,
|
246
|
+
description: "test payme", schedule: schedule)
|
247
|
+
recurring_payment = response.data
|
248
|
+
puts recurring_payment.id
|
249
|
+
```
|
250
|
+
|
251
|
+
|
276
252
|
### Creating a wire payment
|
277
253
|
|
278
254
|
```ruby
|
@@ -348,6 +324,23 @@ control_agreement = response.data
|
|
348
324
|
puts control_agreement["id"]
|
349
325
|
```
|
350
326
|
|
327
|
+
### Originate a check payment
|
328
|
+
|
329
|
+
```ruby
|
330
|
+
address = Unit::Types::Address.new('123 Main St', 'San Francisco', 'CA', '94205', 'US')
|
331
|
+
check_payment_counterparty = Unit::Types::CheckPaymentCounterparty.new("Jane Doe", address)
|
332
|
+
response = Unit::CheckPayment.originate_check_payment(
|
333
|
+
account_id: "123",
|
334
|
+
customer_id: "123",
|
335
|
+
customer_type: "individualCustomer",
|
336
|
+
amount: 100,
|
337
|
+
counterparty: check_payment_counterparty,
|
338
|
+
description: "test",
|
339
|
+
idempotency_key: "test")
|
340
|
+
check_payment = response.data
|
341
|
+
puts check_payment["id"]
|
342
|
+
```
|
343
|
+
|
351
344
|
### Get a check payment by id
|
352
345
|
|
353
346
|
```ruby
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "./base_resource"
|
4
|
+
require_relative "../utils/http_helper"
|
5
|
+
require "json"
|
6
|
+
# class for creating requests for cash deposits to Unit API and parsing responses
|
7
|
+
# @see https://unit.co/docs/api/payments/cash-deposits/
|
8
|
+
module Unit
|
9
|
+
module Resource
|
10
|
+
class CashDepositResource < Unit::Resource::BaseResource
|
11
|
+
class << self
|
12
|
+
# Generate a barcode for cash deposit
|
13
|
+
# @param request [GenerateBarcodeRequest]
|
14
|
+
# @return [UnitResponse, UnitError]
|
15
|
+
def generate_barcode(request)
|
16
|
+
payload = request.to_json_api
|
17
|
+
response = HttpHelper.post("#{api_url}/cash-deposits/barcodes", body: payload, headers: headers)
|
18
|
+
response_handler(response)
|
19
|
+
end
|
20
|
+
|
21
|
+
# List cash deposit store locations by coordinates
|
22
|
+
# @param request [ListByCoordinatesParams]
|
23
|
+
# @return [UnitResponse, UnitError]
|
24
|
+
def list_by_coordinates(params = nil)
|
25
|
+
response = HttpHelper.get("#{api_url}/store-locations", params: params&.to_hash, headers: headers)
|
26
|
+
response_handler(response)
|
27
|
+
end
|
28
|
+
|
29
|
+
# List cash deposit store locations by postal code
|
30
|
+
# @param request [ListByPostalCodeParams]
|
31
|
+
# @return [UnitResponse, UnitError]
|
32
|
+
def list_by_postal_code(params = nil)
|
33
|
+
response = HttpHelper.get("#{api_url}/store-locations", params: params.to_hash, headers: headers)
|
34
|
+
response_handler(response)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Get cash deposit image by barcode number
|
38
|
+
# @param barcode_number [String]
|
39
|
+
# @return [UnitResponse, UnitError]
|
40
|
+
def get_image_by_barcode_number(barcode_number)
|
41
|
+
response = HttpHelper.get("#{api_url}/cash-deposits/barcodes/#{barcode_number}/image", headers: headers, response_type: "image")
|
42
|
+
file_response_handler(response)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -10,6 +10,15 @@ module Unit
|
|
10
10
|
module Resource
|
11
11
|
class CheckPaymentResource < Unit::Resource::BaseResource
|
12
12
|
class << self
|
13
|
+
# Originate a check payment by calling Unit's API
|
14
|
+
# @param request [OriginateCheckPaymentRequest]
|
15
|
+
# @return [UnitResponse, UnitError]
|
16
|
+
def originate_payment(request)
|
17
|
+
payload = request.to_json_api
|
18
|
+
response = HttpHelper.post("#{api_url}/check-payments", body: payload, headers: headers)
|
19
|
+
response_handler(response)
|
20
|
+
end
|
21
|
+
|
13
22
|
# Get a check payment by id by calling Unit's API
|
14
23
|
# @param params [GetRequest]
|
15
24
|
# @return [UnitResponse, UnitError]
|
@@ -53,6 +62,14 @@ module Unit
|
|
53
62
|
response = HttpHelper.post("#{api_url}/check-payments/#{payment_id}/approve", body: payload, headers: headers)
|
54
63
|
response_handler(response)
|
55
64
|
end
|
65
|
+
|
66
|
+
# Cancel check payment
|
67
|
+
# @param payment_id [String]
|
68
|
+
# @return [UnitResponse, UnitError]
|
69
|
+
def cancel_payment(payment_id)
|
70
|
+
response = HttpHelper.post("#{api_url}/check-payments/#{payment_id}/cancel", headers: headers)
|
71
|
+
response_handler(response)
|
72
|
+
end
|
56
73
|
end
|
57
74
|
end
|
58
75
|
end
|
@@ -0,0 +1,39 @@
|
|
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 statements to Unit API and parsing responses
|
8
|
+
# @see https://unit.co/docs/api/tax-forms/
|
9
|
+
module Unit
|
10
|
+
module Resource
|
11
|
+
class TaxFormResource < Unit::Resource::BaseResource
|
12
|
+
class << self
|
13
|
+
# Get tax_forms by calling Unit's API
|
14
|
+
# @param params [ListTaxFormParams]
|
15
|
+
# @return [UnitResponse, UnitError]
|
16
|
+
def list(params = nil)
|
17
|
+
response = HttpHelper.get("#{api_url}/tax-forms", params: params&.to_hash, headers: headers)
|
18
|
+
response_handler(response)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get a tax form by id by calling Unit's API
|
22
|
+
# @param tax_form_id [String]
|
23
|
+
# @return [UnitResponse, UnitError]
|
24
|
+
def get_tax_form_by_id(tax_form_id)
|
25
|
+
response = HttpHelper.get("#{api_url}/tax-forms/#{tax_form_id}", headers: headers)
|
26
|
+
response_handler(response)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Get a tax form pdf by id by calling Unit's API
|
30
|
+
# @param tax_form_id [String]
|
31
|
+
# @return [UnitResponse, UnitError]
|
32
|
+
def get_tax_form_pdf_by_id(tax_form_id)
|
33
|
+
response = HttpHelper.get("#{api_url}/tax-forms/#{tax_form_id}/pdf", headers: headers)
|
34
|
+
file_response_handler(response)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -10,8 +10,7 @@ module Unit
|
|
10
10
|
autoload :ListApplicationParams, "unit/models/application/list_application_params"
|
11
11
|
autoload :PatchApplicationRequest, "unit/models/application/patch_application_request"
|
12
12
|
autoload :UploadDocumentRequest, "unit/models/application/upload_document_request"
|
13
|
-
|
14
|
-
autoload :PatchTrustApplicationRequest, "unit/models/application/patch_trust_application_request"
|
13
|
+
|
15
14
|
class << self
|
16
15
|
# Create a new business application by calling Unit's API
|
17
16
|
# @see https://docs.unit.co/applications#create-business-application
|
@@ -175,33 +174,6 @@ module Unit
|
|
175
174
|
request = UploadDocumentRequest.new(application_id, document_id, file, file_type, is_back_side: is_back_side)
|
176
175
|
Unit::Resource::ApplicationResource.upload(request)
|
177
176
|
end
|
178
|
-
|
179
|
-
# Create a trust application
|
180
|
-
# @see https://docs.unit.co/applications/#create-trust-application
|
181
|
-
# @param name [String]
|
182
|
-
# @param state_of_incorporation [String]
|
183
|
-
# @param revocability [String]
|
184
|
-
# @param source_of_funds [String]
|
185
|
-
# @param tax_id [String]
|
186
|
-
# @param grantor [Grantor]
|
187
|
-
# @param trustees [Array<Trustee>]
|
188
|
-
# @param beneficiaries [Array<Beneficiary>]
|
189
|
-
# @param contact [TrustContact]
|
190
|
-
# @param ip [String] - optional
|
191
|
-
# @param tags [Hash] - optional
|
192
|
-
# @param idempotency_key [String] - optional
|
193
|
-
# @param device_fingerprints [Array<DeviceFingerprint>] - optional
|
194
|
-
def create_trust_application(name:, state_of_incorporation:, revocability:, source_of_funds:, tax_id:,
|
195
|
-
grantor:, trustees:, beneficiaries:, contact:, ip: nil, tags: nil, idempotency_key: nil, device_fingerprints: nil)
|
196
|
-
request = CreateTrustApplicationRequest.new(name, state_of_incorporation, revocability, source_of_funds, tax_id,
|
197
|
-
grantor, trustees, beneficiaries, contact, ip, tags, idempotency_key, device_fingerprints)
|
198
|
-
Unit::Resource::ApplicationResource.create_application(request)
|
199
|
-
end
|
200
|
-
|
201
|
-
def update_trust_application(application_id:, tags: nil)
|
202
|
-
request = PatchTrustApplicationRequest.new(application_id, tags)
|
203
|
-
Unit::Resource::ApplicationResource.update(request)
|
204
|
-
end
|
205
177
|
end
|
206
178
|
end
|
207
179
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Unit
|
4
|
+
module CashDeposit
|
5
|
+
CASH_DEPOSIT_LIMIT = 100
|
6
|
+
CASH_DEPOSIT_OFFSET = 0
|
7
|
+
|
8
|
+
autoload :GenerateBarcodeRequest, "unit/models/cash_deposit/generate_barcode_request"
|
9
|
+
autoload :ListByCoordinatesParams, "unit/models/cash_deposit/list_by_coordinates_params"
|
10
|
+
autoload :ListByPostalCodeParams, "unit/models/cash_deposit/list_by_postal_code_params"
|
11
|
+
|
12
|
+
class << self
|
13
|
+
# Generate a barcode for cash deposit
|
14
|
+
# @see https://unit.co/docs/api/payments/cash-deposits/#post-cash-deposit-generate-barcode
|
15
|
+
# @param store_id [String]
|
16
|
+
# @param account_id [String]
|
17
|
+
# @param customer_id [String]
|
18
|
+
def generate_barcode(store_id:, account_id:, customer_id:)
|
19
|
+
request = GenerateBarcodeRequest.new(store_id, account_id, customer_id)
|
20
|
+
Unit::Resource::CashDepositResource.generate_barcode(request)
|
21
|
+
end
|
22
|
+
|
23
|
+
# List cash deposit store locations by coordinates
|
24
|
+
# @see https://unit.co/docs/api/payments/cash-deposits/#list-cash-deposit-store-locations-by-coordinates
|
25
|
+
# @param coordinates [Coordinates]
|
26
|
+
# @param limit [Integer] - optional
|
27
|
+
# @param offset [Integer] - optional
|
28
|
+
# @param service_type [String] - optional
|
29
|
+
def list_by_coordinates(coordinates:, limit: CASH_DEPOSIT_LIMIT, offset: CASH_DEPOSIT_OFFSET, service_type: nil)
|
30
|
+
request = ListByCoordinatesParams.new(coordinates, limit, offset, service_type)
|
31
|
+
Unit::Resource::CashDepositResource.list_by_coordinates(request)
|
32
|
+
end
|
33
|
+
|
34
|
+
# List cash deposit store locations by postal code
|
35
|
+
# @see https://unit.co/docs/api/payments/cash-deposits/#list-cash-deposit-store-locations-by-postal-code
|
36
|
+
# @param postal_code [String]
|
37
|
+
# @param limit [Integer] - optional
|
38
|
+
# @param offset [Integer] - optional
|
39
|
+
# @param service_type [String] - optional
|
40
|
+
def list_by_postal_code(postal_code:, limit: CASH_DEPOSIT_LIMIT, offset: CASH_DEPOSIT_OFFSET, service_type: nil)
|
41
|
+
request = ListByPostalCodeParams.new(postal_code, limit, offset, service_type)
|
42
|
+
Unit::Resource::CashDepositResource.list_by_postal_code(request)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Get image by barcode number
|
46
|
+
# @see https://unit.co/docs/api/payments/cash-deposits/#get-barcode-image-by-barcode-number
|
47
|
+
# @param barcode_number [String]
|
48
|
+
def get_image_by_barcode_number(barcode_number:)
|
49
|
+
Unit::Resource::CashDepositResource.get_image_by_barcode_number(barcode_number)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Request to generate a barcode for cash deposit
|
4
|
+
# @see https://unit.co/docs/api/payments/cash-deposits/#post-cash-deposit-generate-barcode
|
5
|
+
module Unit
|
6
|
+
module CashDeposit
|
7
|
+
class GenerateBarcodeRequest
|
8
|
+
attr_reader :store_id, :account_id, :customer_id
|
9
|
+
|
10
|
+
# @param store_id [String]
|
11
|
+
# @param account_id [String]
|
12
|
+
# @param customer_id [String]
|
13
|
+
def initialize(store_id, account_id, customer_id)
|
14
|
+
@store_id = store_id
|
15
|
+
@account_id = account_id
|
16
|
+
@customer_id = customer_id
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_json_api
|
20
|
+
payload = {
|
21
|
+
"data": {
|
22
|
+
"type": "cashDepositBarcode",
|
23
|
+
"attributes": {
|
24
|
+
storeId: store_id
|
25
|
+
},
|
26
|
+
"relationships": {
|
27
|
+
"account": Unit::Types::Relationship.new("account", account_id).to_hash,
|
28
|
+
"customer": Unit::Types::Relationship.new("customer", customer_id).to_hash
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
payload[:data][:attributes].compact!
|
33
|
+
payload.to_json
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Request to list cash deposits
|
4
|
+
# @see https://unit.co/docs/api/payments/cash-deposits/#list-cash-deposit-store-locations-by-coordinates
|
5
|
+
module Unit
|
6
|
+
module CashDeposit
|
7
|
+
class ListByCoordinatesParams
|
8
|
+
attr_reader :limit, :offset, :coordinates, :service_type
|
9
|
+
|
10
|
+
# @param coordinates [Coordinates]
|
11
|
+
# @param limit [Integer] - optional
|
12
|
+
# @param offset [Integer] - optional
|
13
|
+
# @param service_type [String] - optional
|
14
|
+
def initialize(coordinates, limit = CASH_DEPOSIT_LIMIT, offset = CASH_DEPOSIT_OFFSET,
|
15
|
+
service_type = nil)
|
16
|
+
@limit = limit
|
17
|
+
@offset = offset
|
18
|
+
@coordinates = coordinates
|
19
|
+
@service_type = service_type
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_hash
|
23
|
+
params = {
|
24
|
+
"page[limit]": limit,
|
25
|
+
"page[offset]": offset,
|
26
|
+
"filter[coordinates]": coordinates.represent,
|
27
|
+
"filter[serviceType]": service_type
|
28
|
+
}
|
29
|
+
params.compact
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Request to list cash deposits by postal code
|
4
|
+
# @see https://unit.co/docs/api/payments/cash-deposits/#list-cash-deposit-store-locations-by-postal-code
|
5
|
+
module Unit
|
6
|
+
module CashDeposit
|
7
|
+
class ListByPostalCodeParams
|
8
|
+
attr_reader :limit, :offset, :postal_code, :service_type
|
9
|
+
|
10
|
+
# @param postal_code [String]
|
11
|
+
# @param limit [Integer] - optional
|
12
|
+
# @param offset [Integer] - optional
|
13
|
+
# @param service_type [String] - optional
|
14
|
+
def initialize(postal_code, limit = CASH_DEPOSIT_LIMIT, offset = CASH_DEPOSIT_OFFSET,
|
15
|
+
service_type = nil)
|
16
|
+
@limit = limit
|
17
|
+
@offset = offset
|
18
|
+
@postal_code = postal_code
|
19
|
+
@service_type = service_type
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_hash
|
23
|
+
params = {
|
24
|
+
"page[limit]": limit,
|
25
|
+
"page[offset]": offset,
|
26
|
+
"filter[postalCode]": postal_code,
|
27
|
+
"filter[serviceType]": service_type
|
28
|
+
}
|
29
|
+
params.compact
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -6,11 +6,29 @@ module Unit
|
|
6
6
|
CHECK_PAYMENT_OFFSET = 0
|
7
7
|
|
8
8
|
autoload :GetRequest, "unit/models/check_payment/get_request"
|
9
|
+
autoload :OriginateCheckPaymentRequest, "unit/models/check_payment/originate_check_payment_request"
|
9
10
|
autoload :ListPaymentParams, "unit/models/check_payment/list_check_payment_params"
|
10
11
|
autoload :GetImageRequest, "unit/models/check_payment/get_image_request"
|
11
12
|
autoload :ReturnCheckPaymentRequest, "unit/models/check_payment/return_check_payment_request"
|
12
13
|
|
13
14
|
class << self
|
15
|
+
# Originate a check payment by id
|
16
|
+
# @see https://docs.unit.co/originate-check-payments/#check-payments
|
17
|
+
# @param account_id [String]
|
18
|
+
# @param customer_id [String]
|
19
|
+
# @param customer_type [String]
|
20
|
+
# @param amount [Integer]
|
21
|
+
# @param counterparty [CheckPaymentCounterparty]
|
22
|
+
# @param description [String]
|
23
|
+
# @param idempotency_key [String]
|
24
|
+
# @param memo [String] - optional
|
25
|
+
# @param send_date [String] - optional
|
26
|
+
# @param tags [Hash] - optional
|
27
|
+
def originate_check_payment(account_id:, customer_id:, customer_type:, amount:, counterparty:, description:, idempotency_key:, memo: nil, send_date: nil, tags: nil)
|
28
|
+
request = OriginateCheckPaymentRequest.new(account_id, customer_id, customer_type, amount, counterparty, description, idempotency_key, memo, send_date, tags)
|
29
|
+
Unit::Resource::CheckPaymentResource.originate_payment(request)
|
30
|
+
end
|
31
|
+
|
14
32
|
# Get a check payment by id
|
15
33
|
# @see https://docs.unit.co/check-payments#get-specific-check-payment
|
16
34
|
# @param payment_id [String]
|
@@ -69,6 +87,13 @@ module Unit
|
|
69
87
|
def approve_payment_verification(payment_id:)
|
70
88
|
Unit::Resource::CheckPaymentResource.approve_payment_verification(payment_id)
|
71
89
|
end
|
90
|
+
|
91
|
+
# Cancel Check Payment
|
92
|
+
# @see https://docs.unit.co/originate-check-payments/#cancel-check-payment
|
93
|
+
# @param payment_id [String]
|
94
|
+
def cancel_check_payment(payment_id:)
|
95
|
+
Unit::Resource::CheckPaymentResource.cancel_payment(payment_id)
|
96
|
+
end
|
72
97
|
end
|
73
98
|
end
|
74
99
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Request to originate check payments
|
4
|
+
# @see https://docs.unit.co/originate-check-payments/#check-payments
|
5
|
+
module Unit
|
6
|
+
module CheckPayment
|
7
|
+
class OriginateCheckPaymentRequest
|
8
|
+
attr_reader :account_id, :customer_id, :customer_type, :amount, :counterparty, :description, :memo, :idempotency_key, :send_date, :tags
|
9
|
+
|
10
|
+
# @param account_id [String]
|
11
|
+
# @param customer_id [String]
|
12
|
+
# @param customer_type [String]
|
13
|
+
# @param amount [Integer]
|
14
|
+
# @param counterparty [CheckPaymentCounterparty]
|
15
|
+
# @param description [String]
|
16
|
+
# @param idempotency_key [String]
|
17
|
+
# @param memo [String] - optional
|
18
|
+
# @param send_date [String] - optional
|
19
|
+
# @param tags [Hash] - optional
|
20
|
+
def initialize(account_id, customer_id, customer_type, amount, counterparty, description, idempotency_key, memo, send_date, tags = nil)
|
21
|
+
@account_id = account_id
|
22
|
+
@customer_id = customer_id
|
23
|
+
@customer_type = customer_type
|
24
|
+
@amount = amount
|
25
|
+
@counterparty = counterparty
|
26
|
+
@description = description
|
27
|
+
@idempotency_key = idempotency_key
|
28
|
+
@memo = memo
|
29
|
+
@send_date = send_date
|
30
|
+
@tags = tags
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_json_api
|
34
|
+
payload = {
|
35
|
+
"data": {
|
36
|
+
"type": "checkPayment",
|
37
|
+
"attributes": {
|
38
|
+
"amount": amount,
|
39
|
+
"counterparty": counterparty.represent,
|
40
|
+
"description": description,
|
41
|
+
"memo": memo,
|
42
|
+
"sendDate": send_date,
|
43
|
+
"idempotencyKey": idempotency_key,
|
44
|
+
"tags": tags
|
45
|
+
},
|
46
|
+
"relationships": {
|
47
|
+
"account": Unit::Types::Relationship.new("depositAccount", account_id).to_hash,
|
48
|
+
"customer": Unit::Types::Relationship.new(customer_type, customer_id).to_hash
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
payload[:data][:attributes].compact!
|
53
|
+
payload.to_json
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Request to list tax forms
|
4
|
+
# @see https://unit.co/docs/api/tax-forms/#list-tax-forms
|
5
|
+
module Unit
|
6
|
+
module TaxForm
|
7
|
+
class ListTaxFormParams
|
8
|
+
attr_reader :limit, :offset, :account_id, :customer_id, :tax_years, :tax_form_types
|
9
|
+
|
10
|
+
# @param limit [Integer] - optional
|
11
|
+
# @param offset [Integer] - optional
|
12
|
+
# @param account_id [String] - optional
|
13
|
+
# @param customer_id [String] - optional
|
14
|
+
# @param tax_years [String] - optional
|
15
|
+
# @param tax_form_types [String] - optional
|
16
|
+
def initialize(limit = TAX_FORM_LIMIT, offset = TAX_FORM_OFFSET,
|
17
|
+
account_id = nil, customer_id = nil, tax_years = nil, tax_form_types = nil)
|
18
|
+
@limit = limit
|
19
|
+
@offset = offset
|
20
|
+
@account_id = account_id
|
21
|
+
@customer_id = customer_id
|
22
|
+
@tax_years = tax_years
|
23
|
+
@tax_form_types = tax_form_types
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_hash
|
27
|
+
params = { "page[limit]": limit,
|
28
|
+
"page[offset]": offset,
|
29
|
+
"filter[accountId]": account_id,
|
30
|
+
"filter[customerId]": customer_id,
|
31
|
+
"filter[taxYears]": tax_years,
|
32
|
+
"filter[taxFormTypes]": tax_form_types }
|
33
|
+
params.compact
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Unit
|
4
|
+
module TaxForm
|
5
|
+
TAX_FORM_LIMIT = 100
|
6
|
+
TAX_FORM_OFFSET = 0
|
7
|
+
autoload :ListTaxFormParams, "unit/models/tax_form/list_tax_form_params"
|
8
|
+
|
9
|
+
class << self
|
10
|
+
# List tax forms
|
11
|
+
# @see https://unit.co/docs/api/tax-forms/#list-tax-forms
|
12
|
+
# @param limit [Integer]
|
13
|
+
# @param offset [Integer]
|
14
|
+
# @param account_id [String]
|
15
|
+
# @param customer_id [String]
|
16
|
+
# @param tax_years [String]
|
17
|
+
# @param tax_form_types [String]
|
18
|
+
def list_tax_forms(limit: TAX_FORM_LIMIT, offset: TAX_FORM_OFFSET,
|
19
|
+
account_id: nil, customer_id: nil, tax_years: nil, tax_form_types: nil)
|
20
|
+
params = ListTaxFormParams.new(limit, offset, account_id, customer_id, tax_years, tax_form_types)
|
21
|
+
Unit::Resource::TaxFormResource.list(params)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Get tax form by id
|
25
|
+
# @see https://unit.co/docs/api/tax-forms/#get-tax-form
|
26
|
+
# @param tax_form_id [String]
|
27
|
+
def get_by_id(tax_form_id:)
|
28
|
+
Unit::Resource::TaxFormResource.get_tax_form_by_id(tax_form_id)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get tax form pdf by id
|
32
|
+
# @see https://unit.co/docs/api/tax-forms/#get-tax-form-pdf
|
33
|
+
# @param tax_form_id [String]
|
34
|
+
def get_pdf_by_id(tax_form_id:)
|
35
|
+
Unit::Resource::TaxFormResource.get_tax_form_pdf_by_id(tax_form_id)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @see https://docs.unit.co/types#check-payment-counterparty
|
4
|
+
module Unit
|
5
|
+
module Types
|
6
|
+
class CheckPaymentCounterparty
|
7
|
+
attr_reader :name, :address, :counterparty_moved
|
8
|
+
|
9
|
+
# @param name [String]
|
10
|
+
# @param address [Address]
|
11
|
+
# @param counterparty_moved [Boolean]
|
12
|
+
def initialize(name, address, counterparty_moved = nil)
|
13
|
+
@name = name
|
14
|
+
@address = address
|
15
|
+
@counterparty_moved = counterparty_moved
|
16
|
+
end
|
17
|
+
|
18
|
+
def represent
|
19
|
+
params = {
|
20
|
+
name: name,
|
21
|
+
address: address&.represent,
|
22
|
+
counterpartyMoved: counterparty_moved
|
23
|
+
}
|
24
|
+
params.compact
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/unit/version.rb
CHANGED
data/lib/unit_ruby_sdk.rb
CHANGED
@@ -18,7 +18,6 @@ module Unit
|
|
18
18
|
autoload :AtmLocation, "unit/models/atm_location/atm_location"
|
19
19
|
autoload :CheckDeposit, "unit/models/check_deposit/check_deposit"
|
20
20
|
autoload :Counterparty, "unit/models/counterparty/counterparty"
|
21
|
-
autoload :RecurringPayment, "unit/models/recurring_payment/recurring_payment"
|
22
21
|
autoload :Institution, "unit/models/institution/institution"
|
23
22
|
autoload :Repayment, "unit/models/repayment/repayment"
|
24
23
|
autoload :Event, "unit/models/event/event"
|
@@ -28,6 +27,8 @@ module Unit
|
|
28
27
|
autoload :Authorization, "unit/models/authorization/authorization"
|
29
28
|
autoload :AuthorizationRequest, "unit/models/authorization_request/authorization_request"
|
30
29
|
autoload :RecurringPayment, "unit/models/recurring_payment/recurring_payment"
|
30
|
+
autoload :TaxForm, "unit/models/tax_form/tax_form"
|
31
|
+
autoload :CashDeposit, "unit/models/cash_deposit/cash_deposit"
|
31
32
|
|
32
33
|
module Resource
|
33
34
|
autoload :ApplicationResource, "unit/api_resources/application_resource"
|
@@ -45,7 +46,6 @@ module Unit
|
|
45
46
|
autoload :AtmLocationResource, "unit/api_resources/atm_location_resource"
|
46
47
|
autoload :CheckDepositResource, "unit/api_resources/check_deposit_resource"
|
47
48
|
autoload :CounterpartyResource, "unit/api_resources/counterparty_resource"
|
48
|
-
autoload :RecurringPaymentResource, "unit/api_resources/recurring_payment_resource"
|
49
49
|
autoload :InstitutionResource, "unit/api_resources/institution_resource"
|
50
50
|
autoload :RepaymentResource, "unit/api_resources/repayment_resource"
|
51
51
|
autoload :EventResource, "unit/api_resources/event_resource"
|
@@ -55,6 +55,8 @@ module Unit
|
|
55
55
|
autoload :AuthorizationResource, "unit/api_resources/authorization_resource"
|
56
56
|
autoload :AuthorizationRequestResource, "unit/api_resources/authorization_request_resource"
|
57
57
|
autoload :RecurringPaymentResource, "unit/api_resources/recurring_payment_resource"
|
58
|
+
autoload :TaxFormResource, "unit/api_resources/tax_form_resource"
|
59
|
+
autoload :CashDepositResource, "unit/api_resources/cash_deposit_resource"
|
58
60
|
end
|
59
61
|
|
60
62
|
module Types
|
@@ -66,6 +68,7 @@ module Unit
|
|
66
68
|
autoload :EvaluationParams, "unit/types/evaluation_params"
|
67
69
|
autoload :Counterparty, "unit/types/counterparty"
|
68
70
|
autoload :WireCounterparty, "unit/types/wire_counterparty"
|
71
|
+
autoload :CheckPaymentCounterparty, "unit/types/check_payment_counterparty"
|
69
72
|
autoload :FullName, "unit/types/full_name"
|
70
73
|
autoload :Officer, "unit/types/officer"
|
71
74
|
autoload :Phone, "unit/types/phone"
|
@@ -76,11 +79,6 @@ module Unit
|
|
76
79
|
autoload :DocumentFileType, "unit/types/document_file_type"
|
77
80
|
autoload :Coordinates, "unit/types/coordinates"
|
78
81
|
autoload :CreateSchedule, "unit/types/create_schedule"
|
79
|
-
autoload :TrustContact, "unit/types/trust_contact"
|
80
|
-
autoload :Trustee, "unit/types/trustee"
|
81
|
-
autoload :Grantor, "unit/types/grantor"
|
82
|
-
autoload :Beneficiary, "unit/types/beneficiary"
|
83
|
-
autoload :CreateSchedule, "unit/types/create_schedule"
|
84
82
|
autoload :ApplicationFormSettingsOverride, "unit/types/application_form_settings_override"
|
85
83
|
autoload :ApplicationFormPrefill, "unit/types/application_form_prefill"
|
86
84
|
autoload :RequireIdVerification, "unit/types/require_id_verification"
|
data/tax_form_1.pdf
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unit_ruby_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Unit
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_bot_rails
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/unit/api_resources/authorization_resource.rb
|
104
104
|
- lib/unit/api_resources/base_resource.rb
|
105
105
|
- lib/unit/api_resources/card_resource.rb
|
106
|
+
- lib/unit/api_resources/cash_deposit_resource.rb
|
106
107
|
- lib/unit/api_resources/check_deposit_resource.rb
|
107
108
|
- lib/unit/api_resources/check_payment_resource.rb
|
108
109
|
- lib/unit/api_resources/counterparty_resource.rb
|
@@ -117,6 +118,7 @@ files:
|
|
117
118
|
- lib/unit/api_resources/reward_resource.rb
|
118
119
|
- lib/unit/api_resources/statement_resource.rb
|
119
120
|
- lib/unit/api_resources/stop_payment_resource.rb
|
121
|
+
- lib/unit/api_resources/tax_form_resource.rb
|
120
122
|
- lib/unit/api_resources/transaction_resource.rb
|
121
123
|
- lib/unit/api_resources/webhook_resource.rb
|
122
124
|
- lib/unit/errors/unit_error.rb
|
@@ -144,10 +146,8 @@ files:
|
|
144
146
|
- lib/unit/models/application/create_business_application_request.rb
|
145
147
|
- lib/unit/models/application/create_individual_application_request.rb
|
146
148
|
- lib/unit/models/application/create_sole_proprietor_application_request.rb
|
147
|
-
- lib/unit/models/application/create_trust_application_request.rb
|
148
149
|
- lib/unit/models/application/list_application_params.rb
|
149
150
|
- lib/unit/models/application/patch_application_request.rb
|
150
|
-
- lib/unit/models/application/patch_trust_application_request.rb
|
151
151
|
- lib/unit/models/application/upload_document_request.rb
|
152
152
|
- lib/unit/models/application_form/application_form.rb
|
153
153
|
- lib/unit/models/application_form/create_application_form_request.rb
|
@@ -176,6 +176,10 @@ files:
|
|
176
176
|
- lib/unit/models/card/patch_business_virtual_card_request.rb
|
177
177
|
- lib/unit/models/card/patch_business_virtual_credit_card_request.rb
|
178
178
|
- lib/unit/models/card/replace_card_request.rb
|
179
|
+
- lib/unit/models/cash_deposit/cash_deposit.rb
|
180
|
+
- lib/unit/models/cash_deposit/generate_barcode_request.rb
|
181
|
+
- lib/unit/models/cash_deposit/list_by_coordinates_params.rb
|
182
|
+
- lib/unit/models/cash_deposit/list_by_postal_code_params.rb
|
179
183
|
- lib/unit/models/check_deposit/check_deposit.rb
|
180
184
|
- lib/unit/models/check_deposit/create_check_deposit_request.rb
|
181
185
|
- lib/unit/models/check_deposit/get_image_request.rb
|
@@ -187,6 +191,7 @@ files:
|
|
187
191
|
- lib/unit/models/check_payment/get_image_request.rb
|
188
192
|
- lib/unit/models/check_payment/get_request.rb
|
189
193
|
- lib/unit/models/check_payment/list_check_payment_params.rb
|
194
|
+
- lib/unit/models/check_payment/originate_check_payment_request.rb
|
190
195
|
- lib/unit/models/check_payment/return_check_payment_request.rb
|
191
196
|
- lib/unit/models/counterparty/counterparty.rb
|
192
197
|
- lib/unit/models/counterparty/create_counterparty_request.rb
|
@@ -243,6 +248,8 @@ files:
|
|
243
248
|
- lib/unit/models/stop_payment/create_stop_payment_request.rb
|
244
249
|
- lib/unit/models/stop_payment/list_stop_payment_params.rb
|
245
250
|
- lib/unit/models/stop_payment/stop_payment.rb
|
251
|
+
- lib/unit/models/tax_form/list_tax_form_params.rb
|
252
|
+
- lib/unit/models/tax_form/tax_form.rb
|
246
253
|
- lib/unit/models/transaction/get_transaction_params.rb
|
247
254
|
- lib/unit/models/transaction/list_transaction_params.rb
|
248
255
|
- lib/unit/models/transaction/patch_book_transaction_request.rb
|
@@ -260,8 +267,8 @@ files:
|
|
260
267
|
- lib/unit/types/application_form_settings_override.rb
|
261
268
|
- lib/unit/types/authorized_user.rb
|
262
269
|
- lib/unit/types/beneficial_owner.rb
|
263
|
-
- lib/unit/types/beneficiary.rb
|
264
270
|
- lib/unit/types/business_contact.rb
|
271
|
+
- lib/unit/types/check_payment_counterparty.rb
|
265
272
|
- lib/unit/types/coordinates.rb
|
266
273
|
- lib/unit/types/counterparty.rb
|
267
274
|
- lib/unit/types/create_schedule.rb
|
@@ -269,7 +276,6 @@ files:
|
|
269
276
|
- lib/unit/types/document_file_type.rb
|
270
277
|
- lib/unit/types/evaluation_params.rb
|
271
278
|
- lib/unit/types/full_name.rb
|
272
|
-
- lib/unit/types/grantor.rb
|
273
279
|
- lib/unit/types/officer.rb
|
274
280
|
- lib/unit/types/phone.rb
|
275
281
|
- lib/unit/types/power_of_attorney_agent.rb
|
@@ -277,12 +283,11 @@ files:
|
|
277
283
|
- lib/unit/types/relationship_array.rb
|
278
284
|
- lib/unit/types/require_id_verification.rb
|
279
285
|
- lib/unit/types/restricted_resource.rb
|
280
|
-
- lib/unit/types/trust_contact.rb
|
281
|
-
- lib/unit/types/trustee.rb
|
282
286
|
- lib/unit/types/wire_counterparty.rb
|
283
287
|
- lib/unit/utils/http_helper.rb
|
284
288
|
- lib/unit/version.rb
|
285
289
|
- lib/unit_ruby_sdk.rb
|
290
|
+
- tax_form_1.pdf
|
286
291
|
homepage: https://github.com/unit-finance/unit-ruby-sdk
|
287
292
|
licenses:
|
288
293
|
- Mozilla Public License 2.0
|
@@ -1,67 +0,0 @@
|
|
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
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Request to update a trust application
|
4
|
-
# @see https://docs.unit.co/applications/#update-trust-application
|
5
|
-
module Unit
|
6
|
-
module Application
|
7
|
-
class PatchTrustApplicationRequest
|
8
|
-
attr_reader :application_id, :tags
|
9
|
-
|
10
|
-
# @param application_id [String]
|
11
|
-
# @param tags [Hash] - optional
|
12
|
-
def initialize(application_id, tags = nil)
|
13
|
-
@application_id = application_id
|
14
|
-
@tags = tags
|
15
|
-
end
|
16
|
-
|
17
|
-
def to_json_api
|
18
|
-
payload = {
|
19
|
-
data: {
|
20
|
-
type: "trustApplication",
|
21
|
-
attributes: {
|
22
|
-
tags: tags
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
payload[:data][:attributes].compact!
|
27
|
-
payload.to_json
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# @see https://docs.unit.co/types#beneficiary
|
4
|
-
module Unit
|
5
|
-
module Types
|
6
|
-
class Beneficiary
|
7
|
-
attr_reader :full_name, :date_of_birth
|
8
|
-
|
9
|
-
# @param full_name [FullName]
|
10
|
-
# @param date_of_birth [Date]
|
11
|
-
def initialize(full_name, date_of_birth = nil)
|
12
|
-
@full_name = full_name
|
13
|
-
@date_of_birth = date_of_birth
|
14
|
-
end
|
15
|
-
|
16
|
-
def represent
|
17
|
-
payload = {
|
18
|
-
fullName: full_name.represent,
|
19
|
-
dateOfBirth: date_of_birth
|
20
|
-
}
|
21
|
-
payload.compact
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/unit/types/grantor.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# @see https://docs.unit.co/types#grantor
|
4
|
-
module Unit
|
5
|
-
module Types
|
6
|
-
class Grantor
|
7
|
-
attr_reader :full_name, :date_of_birth, :ssn, :email, :phone, :address
|
8
|
-
|
9
|
-
# @param full_name [FullName]
|
10
|
-
# @param ssn [String]
|
11
|
-
# @param email [String]
|
12
|
-
# @param phone [Phone]
|
13
|
-
# @param address [Address]
|
14
|
-
# @param date_of_birth [Date] - optional
|
15
|
-
def initialize(full_name, ssn, email, phone, address, date_of_birth = nil)
|
16
|
-
@full_name = full_name
|
17
|
-
@date_of_birth = date_of_birth
|
18
|
-
@ssn = ssn
|
19
|
-
@email = email
|
20
|
-
@phone = phone
|
21
|
-
@address = address
|
22
|
-
end
|
23
|
-
|
24
|
-
def represent
|
25
|
-
payload = {
|
26
|
-
fullName: full_name.represent,
|
27
|
-
dateOfBirth: date_of_birth,
|
28
|
-
ssn: ssn,
|
29
|
-
email: email,
|
30
|
-
phone: phone.represent,
|
31
|
-
address: address.represent
|
32
|
-
}
|
33
|
-
payload.compact
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# @see https://docs.unit.co/types#trustcontact
|
4
|
-
module Unit
|
5
|
-
module Types
|
6
|
-
class TrustContact
|
7
|
-
attr_reader :full_name, :email, :phone, :address, :jwt_subject
|
8
|
-
|
9
|
-
# @param full_name [FullName]
|
10
|
-
# @param email [String]
|
11
|
-
# @param phone [Phone]
|
12
|
-
# @param address [Address]
|
13
|
-
# @param jwt_subject [String] - optional
|
14
|
-
def initialize(full_name, email, phone, address, jwt_subject = nil)
|
15
|
-
@full_name = full_name
|
16
|
-
@email = email
|
17
|
-
@phone = phone
|
18
|
-
@address = address
|
19
|
-
@jwt_subject = jwt_subject
|
20
|
-
end
|
21
|
-
|
22
|
-
def represent
|
23
|
-
payload = {
|
24
|
-
fullName: full_name.represent,
|
25
|
-
email: email,
|
26
|
-
phone: phone.represent,
|
27
|
-
address: address.represent,
|
28
|
-
jwtSubject: jwt_subject
|
29
|
-
}
|
30
|
-
payload.compact
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/lib/unit/types/trustee.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# @see https://docs.unit.co/types#trustee
|
4
|
-
module Unit
|
5
|
-
module Types
|
6
|
-
class Trustee
|
7
|
-
attr_reader :full_name, :ssn, :email, :phone, :address, :date_of_birth
|
8
|
-
|
9
|
-
# @param full_name [FullName]
|
10
|
-
# @param ssn [String]
|
11
|
-
# @param email [String]
|
12
|
-
# @param phone [Phone]
|
13
|
-
# @param address [Address]
|
14
|
-
# @param date_of_birth [Date] - optional
|
15
|
-
def initialize(full_name, ssn, email, phone, address, date_of_birth = nil)
|
16
|
-
@full_name = full_name
|
17
|
-
@ssn = ssn
|
18
|
-
@email = email
|
19
|
-
@phone = phone
|
20
|
-
@address = address
|
21
|
-
@date_of_birth = date_of_birth
|
22
|
-
end
|
23
|
-
|
24
|
-
def represent
|
25
|
-
payload = {
|
26
|
-
fullName: full_name.represent,
|
27
|
-
ssn: ssn,
|
28
|
-
email: email,
|
29
|
-
phone: phone.represent,
|
30
|
-
address: address.represent,
|
31
|
-
dateOfBirth: date_of_birth
|
32
|
-
}
|
33
|
-
payload.compact
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|