unit_ruby_sdk 1.4.1 → 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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/README.md +113 -93
  4. data/lib/unit/api_resources/cash_deposit_resource.rb +47 -0
  5. data/lib/unit/api_resources/check_payment_resource.rb +17 -0
  6. data/lib/unit/api_resources/stop_payment_resource.rb +48 -0
  7. data/lib/unit/api_resources/tax_form_resource.rb +39 -0
  8. data/lib/unit/models/application/application.rb +5 -38
  9. data/lib/unit/models/application/create_business_application_request.rb +3 -3
  10. data/lib/unit/models/application/create_sole_proprietor_application_request.rb +5 -18
  11. data/lib/unit/models/cash_deposit/cash_deposit.rb +53 -0
  12. data/lib/unit/models/cash_deposit/generate_barcode_request.rb +37 -0
  13. data/lib/unit/models/cash_deposit/list_by_coordinates_params.rb +33 -0
  14. data/lib/unit/models/cash_deposit/list_by_postal_code_params.rb +33 -0
  15. data/lib/unit/models/check_deposit/create_check_deposit_request.rb +1 -1
  16. data/lib/unit/models/check_payment/check_payment.rb +25 -0
  17. data/lib/unit/models/check_payment/originate_check_payment_request.rb +57 -0
  18. data/lib/unit/models/customer/patch_business_customer_request.rb +1 -1
  19. data/lib/unit/models/customer/patch_individual_customer_request.rb +1 -1
  20. data/lib/unit/models/payment/payment.rb +2 -1
  21. data/lib/unit/models/recurring_payment/create_recurring_credit_book_payment_request.rb +1 -1
  22. data/lib/unit/models/stop_payment/create_stop_payment_request.rb +43 -0
  23. data/lib/unit/models/stop_payment/list_stop_payment_params.rb +63 -0
  24. data/lib/unit/models/stop_payment/stop_payment.rb +61 -0
  25. data/lib/unit/models/tax_form/list_tax_form_params.rb +37 -0
  26. data/lib/unit/models/tax_form/tax_form.rb +39 -0
  27. data/lib/unit/models/webhook/patch_webhook_request.rb +3 -3
  28. data/lib/unit/models/webhook/webhook.rb +6 -6
  29. data/lib/unit/types/check_payment_counterparty.rb +28 -0
  30. data/lib/unit/version.rb +1 -1
  31. data/lib/unit_ruby_sdk.rb +7 -7
  32. data/tax_form_1.pdf +0 -0
  33. metadata +17 -8
  34. data/lib/unit/models/application/create_trust_application_request.rb +0 -67
  35. data/lib/unit/models/application/patch_trust_application_request.rb +0 -31
  36. data/lib/unit/types/beneficiary.rb +0 -25
  37. data/lib/unit/types/grantor.rb +0 -37
  38. data/lib/unit/types/trust_contact.rb +0 -34
  39. data/lib/unit/types/trustee.rb +0 -37
@@ -6,9 +6,9 @@ module Unit
6
6
  module Application
7
7
  class CreateSoleProprietorApplicationRequest
8
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,
9
+ :address, :phone, :email, :sole_proprietorship, :ein,
10
+ :dba, :power_of_attorney_agent, :evaluation_params,
11
+ :annual_revenue, :number_of_employees,
12
12
  :business_vertical, :website, :ip, :tags, :idempotency_key,
13
13
  :device_fingerprints, :jwt_subject
14
14
 
@@ -19,16 +19,12 @@ module Unit
19
19
  # @param phone [Phone]
20
20
  # @param email [String]
21
21
  # @param sole_proprietorship [Boolean]
22
- # @param industry [String]
23
22
  # @param ssn [String] - optional
24
23
  # @param passport [String] - optional
25
24
  # @param ein [String] - optional
26
25
  # @param dba [String] - optional
27
26
  # @param power_of_attorney_agent [PowerOfAttorneyAgent] - optional
28
27
  # @param evaluation_params [EvaluationParams] - optional
29
- # @param occupation [String] - optional
30
- # @param annual_income [String] - optional
31
- # @param source_of_income [String] - optional
32
28
  # @param annual_revenue [String] - optional
33
29
  # @param number_of_employees [String] - optional
34
30
  # @param business_vertical [String] - optional
@@ -39,9 +35,8 @@ module Unit
39
35
  # @param device_fingerprints [Array<DeviceFingerprint>] - optional
40
36
  # @param jwt_subject [String] - optional
41
37
  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,
38
+ email, ssn = nil, passport = nil, ein = nil, dba = nil, power_of_attorney_agent = nil, evaluation_params = nil,
39
+ annual_revenue = nil, number_of_employees = nil, business_vertical = nil, website = nil, ip = nil, tags = nil,
45
40
  idempotency_key = nil, device_fingerprints = nil, jwt_subject = nil, sole_proprietorship: true)
46
41
  @ssn = ssn
47
42
  @passport = passport
@@ -53,13 +48,9 @@ module Unit
53
48
  @email = email
54
49
  @sole_proprietorship = sole_proprietorship
55
50
  @ein = ein
56
- @industry = industry
57
51
  @dba = dba
58
52
  @power_of_attorney_agent = power_of_attorney_agent
59
53
  @evaluation_params = evaluation_params
60
- @occupation = occupation
61
- @annual_income = annual_income
62
- @source_of_income = source_of_income
63
54
  @annual_revenue = annual_revenue
64
55
  @number_of_employees = number_of_employees
65
56
  @business_vertical = business_vertical
@@ -86,13 +77,9 @@ module Unit
86
77
  email: email,
87
78
  soleProprietorship: sole_proprietorship,
88
79
  ein: ein,
89
- industry: industry,
90
80
  dba: dba,
91
81
  powerOfAttorneyAgent: power_of_attorney_agent&.represent,
92
82
  evaluationParams: evaluation_params&.represent,
93
- occupation: occupation,
94
- annualIncome: annual_income,
95
- sourceOfIncome: source_of_income,
96
83
  annualRevenue: annual_revenue,
97
84
  numberOfEmployees: number_of_employees,
98
85
  businessVertical: business_vertical,
@@ -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
@@ -28,7 +28,7 @@ module Unit
28
28
  amount: amount,
29
29
  description: description,
30
30
  tags: tags,
31
- idempotency_key: idempotency_key
31
+ idempotencyKey: idempotency_key
32
32
  },
33
33
  "relationships": {
34
34
  "account": Unit::Types::Relationship.new("account", account_id).to_hash
@@ -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
@@ -34,7 +34,7 @@ module Unit
34
34
  address: address&.represent,
35
35
  phone: phone&.represent,
36
36
  contact: contact&.represent,
37
- authorized_users: authorized_users&.map(&:represent),
37
+ authorizedUsers: authorized_users&.map(&:represent),
38
38
  dba: dba,
39
39
  tags: tags
40
40
  }
@@ -35,7 +35,7 @@ module Unit
35
35
  phone: phone&.represent,
36
36
  email: email,
37
37
  dba: dba,
38
- authorized_users: authorized_users&.map(&:represent),
38
+ authorizedUsers: authorized_users&.map(&:represent),
39
39
  tags: tags
40
40
  }
41
41
  }
@@ -16,6 +16,7 @@ module Unit
16
16
  autoload :BulkPaymentRequest, "unit/models/payment/bulk_payment_request"
17
17
  autoload :CreateBatchReleaseRequest, "unit/models/payment/create_batch_release_request"
18
18
  autoload :BatchReleaseRequestBuilder, "unit/models/payment/batch_release_request_builder"
19
+
19
20
  class << self
20
21
  # Create a new book payment by calling Unit's API
21
22
  # @see https://docs.unit.co/book-payments#book-payments
@@ -201,6 +202,6 @@ module Unit
201
202
  end
202
203
  Unit::Resource::PaymentResource.create_batch_release(payload.to_hash)
203
204
  end
204
- end
205
+ end
205
206
  end
206
207
  end
@@ -35,7 +35,7 @@ module Unit
35
35
  "amount": amount,
36
36
  "description": description,
37
37
  "schedule": schedule&.represent,
38
- "transaction_summary_override": transaction_summary_override,
38
+ "transactionSummaryOverride": transaction_summary_override,
39
39
  "idempotencyKey": idempotency_key,
40
40
  "tags": tags
41
41
  },
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Request to create a stop payment
4
+ # @see https://docs.unit.co/stop-payments#create-stop-payment
5
+ module Unit
6
+ module StopPayment
7
+ class CreateStopPaymentRequest
8
+ attr_reader :account_id, :amount, :check_number, :tags, :idempotency_key
9
+
10
+ # @param account_id [String]
11
+ # @param amount [Integer]
12
+ # @param check_number [String]
13
+ # @param tags [Hash] - optional
14
+ # @param idempotency_key [String] - optional
15
+ def initialize(account_id, amount, check_number, tags = nil, idempotency_key = nil)
16
+ @account_id = account_id
17
+ @amount = amount
18
+ @check_number = check_number
19
+ @tags = tags
20
+ @idempotency_key = idempotency_key
21
+ end
22
+
23
+ def to_json_api
24
+ payload = {
25
+ data: {
26
+ type: "stopPayment",
27
+ attributes: {
28
+ amount: amount,
29
+ checkNumber: check_number,
30
+ tags: tags,
31
+ idempotencyKey: idempotency_key
32
+ },
33
+ "relationships": {
34
+ "account": Unit::Types::Relationship.new("depositAccount", account_id).to_hash
35
+ }
36
+ }
37
+ }
38
+ payload[:data][:attributes].compact!
39
+ payload.to_json
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Request to list stop payments
4
+ # @see https://docs.unit.co/stop-payments#list-stop-payments
5
+ module Unit
6
+ module StopPayment
7
+ class ListStopPaymentParams
8
+ attr_reader :limit, :offset, :account_id, :customer_id, :tags, :sort,
9
+ :since, :_until, :status, :from_amount, :to_amount, :check_number, :include
10
+
11
+ # @param limit [Integer] - optional
12
+ # @param offset [Integer] - optional
13
+ # @param account_id [String] - optional
14
+ # @param customer_id [String] - optional
15
+ # @param tags [Hash] - optional
16
+ # @param sort [String] - optional
17
+ # @param since [String] - optional
18
+ # @param _until [String] - optional
19
+ # @param status [Array<String>] - optional
20
+ # @param from_amount [String] - optional
21
+ # @param to_amount [String] - optional
22
+ # @param check_number [String] - optional
23
+ # @param include [Array<String>] - optional
24
+ def initialize(limit = STOP_PAYMENT_LIMIT, offset = STOP_PAYMENT_OFFSET, account_id = nil,
25
+ customer_id = nil, tags = nil, sort = nil, since = nil, _until = nil, status = nil, from_amount = nil,
26
+ to_amount = nil, check_number = nil, include = nil)
27
+ @limit = limit
28
+ @offset = offset
29
+ @account_id = account_id
30
+ @customer_id = customer_id
31
+ @tags = tags
32
+ @sort = sort
33
+ @since = since
34
+ @until = _until
35
+ @status = status
36
+ @from_amount = from_amount
37
+ @to_amount = to_amount
38
+ @check_number = check_number
39
+ @include = include
40
+ end
41
+
42
+ def to_hash
43
+ params = {
44
+ "page[limit]": limit,
45
+ "page[offset]": offset,
46
+ "filter[accountId]": account_id,
47
+ "filter[customerId]": customer_id,
48
+ "filter[tags]": tags,
49
+ "sort": sort,
50
+ "filter[since]": since,
51
+ "filter[until]": _until,
52
+ "filter[fromAmount]": from_amount,
53
+ "filter[toAmount]": to_amount,
54
+ "filter[checkNumber]": check_number,
55
+ "include": include&.join(",")
56
+ }
57
+ status&.each_with_index&.map do |val, index|
58
+ params.merge!({ "filter[status][#{index}]": val })
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unit
4
+ module StopPayment
5
+ STOP_PAYMENT_LIMIT = 100
6
+ STOP_PAYMENT_OFFSET = 0
7
+
8
+ autoload :CreateStopPaymentRequest, "unit/models/stop_payment/create_stop_payment_request"
9
+ autoload :ListStopPaymentParams, "unit/models/stop_payment/list_stop_payment_params"
10
+
11
+ class << self
12
+ # Create a stop payment
13
+ # @see https://docs.unit.co/stop-payments#create-stop-payment
14
+ # @param amount [Integer]
15
+ # @param check_number [String]
16
+ # @param tags [Hash] - optional
17
+ # @param idempotency_key [String] - optional
18
+ def create_stop_payment(account_id:, amount:, check_number:, tags: nil, idempotency_key: nil)
19
+ request = CreateStopPaymentRequest.new(account_id, amount, check_number, tags, idempotency_key)
20
+ Unit::Resource::StopPaymentResource.create_payment(request)
21
+ end
22
+
23
+ # Get a stop payment
24
+ # @see https://docs.unit.co/stop-payments#get-specific-stop-payment
25
+ # @param payment_id [String]
26
+ def get_payment(payment_id:)
27
+ Unit::Resource::StopPaymentResource.get(payment_id)
28
+ end
29
+
30
+ # Request to list stop payments
31
+ # @see https://docs.unit.co/stop-payments#list-stop-payments
32
+ # @param limit [Integer] - optional
33
+ # @param offset [Integer] - optional
34
+ # @param account_id [String] - optional
35
+ # @param customer_id [String] - optional
36
+ # @param tags [Hash] - optional
37
+ # @param sort [String] - optional
38
+ # @param since [String] - optional
39
+ # @param _until [String] - optional
40
+ # @param status [Array<String>] - optional
41
+ # @param from_amount [String] - optional
42
+ # @param to_amount [String] - optional
43
+ # @param check_number [String] - optional
44
+ # @param include [Array<String>] - optional
45
+ def list_stop_payment(limit: STOP_PAYMENT_LIMIT, offset: STOP_PAYMENT_OFFSET, account_id: nil,
46
+ customer_id: nil, tags: nil, sort: nil, since: nil, _until: nil, status: nil,
47
+ from_amount: nil, to_amount: nil, check_number: nil, include: nil)
48
+ request = ListStopPaymentParams.new(limit, offset, account_id, customer_id, tags, sort, since, _until,
49
+ status, from_amount, to_amount, check_number, include)
50
+ Unit::Resource::StopPaymentResource.list(request)
51
+ end
52
+
53
+ # Disable a stop payment
54
+ # @see https://docs.unit.co/stop-payments#disable-stop-payment
55
+ # @param payment_id [String]
56
+ def disable_stop_payment(payment_id:)
57
+ Unit::Resource::StopPaymentResource.disable_payment(payment_id)
58
+ end
59
+ end
60
+ end
61
+ 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
@@ -32,10 +32,10 @@ module Unit
32
32
  attributes: {
33
33
  label: label,
34
34
  url: url,
35
- content_type: content_type,
35
+ contentType: content_type,
36
36
  token: token,
37
- include_resources: include_resources,
38
- subscription_type: subscription_type
37
+ includeResources: include_resources,
38
+ subscriptionType: subscription_type
39
39
  }
40
40
  }
41
41
  }
@@ -2,13 +2,13 @@
2
2
 
3
3
  module Unit
4
4
  module Webhook
5
- class << self
6
- WEBHOOK_LIMIT = 100
7
- WEBHOOK_OFFSET = 0
8
- autoload :CreateWebhookRequest, "unit/models/webhook/create_webhook_request"
9
- autoload :ListWebhookParams, "unit/models/webhook/list_webhook_params"
10
- autoload :PatchWebhookRequest, "unit/models/webhook/patch_webhook_request"
5
+ WEBHOOK_LIMIT = 100
6
+ WEBHOOK_OFFSET = 0
7
+ autoload :CreateWebhookRequest, "unit/models/webhook/create_webhook_request"
8
+ autoload :ListWebhookParams, "unit/models/webhook/list_webhook_params"
9
+ autoload :PatchWebhookRequest, "unit/models/webhook/patch_webhook_request"
11
10
 
11
+ class << self
12
12
  # Create a webhook
13
13
  # @see https://docs.unit.co/webhooks#create-webhook
14
14
  # @param label [String]