unit_ruby_sdk 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/unit/api_resources/payment_resource.rb +8 -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_book_payment_request.rb +25 -16
- 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 +19 -11
- data/lib/unit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d20a17ad0586962f7984a43e052bbe2f8a1637adf318b91cbb35c2bd65268efe
|
4
|
+
data.tar.gz: 113eeaae42a13b4d89d31b870c935fc36d6221c4a09c3e4e8770c19e6b96a724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0178fda07e7f4f9b3011c8e5b1dfa7a5fc4efffdc9d77b50bfabdab34c174293a2ca4cc90b77cb521646bba08d34b52732509c1652f96f3eab8bd0d38e573976'
|
7
|
+
data.tar.gz: 8a2b410f41503b00a1cd23637e8f332d96b4116e7a06d980894adff0f8e5ebf9343652629b6177e1890077805b88bcaded6e5dd525590671bacbae77870dc5ab
|
data/README.md
CHANGED
@@ -181,6 +181,22 @@ puts counterparty.id
|
|
181
181
|
puts wire_payment.id
|
182
182
|
```
|
183
183
|
|
184
|
+
### Creating a bulk payment
|
185
|
+
```ruby
|
186
|
+
address = Unit::Types::Address.new('123 Main St', 'San Francisco', 'CA', '94205', 'US')
|
187
|
+
wire_counterparty = Unit::Types::WireCounterparty.new("Jane Doe", "27573", "812345678", address)
|
188
|
+
counterparty = Unit::Types::Counterparty.new("Jane Doe", "27573", "812345678", "Checking")
|
189
|
+
book_payment_request = Unit::Payment::CreateBookPaymentRequest.new(amount: 1000, description: "test payment", account_id: "27573", counterparty_account_id: "36981", tags: { "test": "test-tag" })
|
190
|
+
wire_payment_request = Unit::Payment::CreateWirePaymentRequest.new(amount: 1000, description: "test payment", account_id: "27573", counterparty: wire_counterparty, tags: { "test": "test-tag" })
|
191
|
+
ach_payment_inline_request = Unit::Payment::CreateAchPaymentInlineRequest.new(amount: 1000, direction: "Credit", counterparty: counterparty, description: "test payment", account_id: "27573", tags: { "test": "test-tag" })
|
192
|
+
ach_payment_linked_request = Unit::Payment::CreatePaymentLinkedRequest.new(amount: 1000, direction: "Credit", description: "test payment", account_id: "27573", counterparty_id: "313118", tags: { "test": "test-tag" })
|
193
|
+
ach_payment_plaid_token_request = Unit::Payment::CreateWithPlaidTokenRequest.new(amount: 1000, direction: "Credit", description: "test payment", account_id: "27573", plaid_processor_token: "processor-sandbox-fc8b9c23-b400-40f9-8ee8-c2cabd719721", tags: { "test": "test-tag" })
|
194
|
+
|
195
|
+
response = Unit::Payment.create_bulk_payment(
|
196
|
+
requests: [book_payment_request, wire_payment_request, ach_payment_inline_request, ach_payment_linked_request, ach_payment_plaid_token_request])
|
197
|
+
bulk_payment = response.data
|
198
|
+
puts bulk_payment.id
|
199
|
+
```
|
184
200
|
### Logging Errors
|
185
201
|
|
186
202
|
```ruby
|
@@ -19,6 +19,14 @@ module Unit
|
|
19
19
|
response_handler(response)
|
20
20
|
end
|
21
21
|
|
22
|
+
# Create a new bulk payment by calling Unit's API
|
23
|
+
# @param request [BulkPaymentRequest]
|
24
|
+
# @return [UnitResponse, UnitError]
|
25
|
+
def create_bulk_payment(request)
|
26
|
+
response = HttpHelper.post("#{api_url}/payments/bulk", body: request, headers: headers)
|
27
|
+
response_handler(response)
|
28
|
+
end
|
29
|
+
|
22
30
|
# Update a payment by calling Unit's API
|
23
31
|
# @param request [PatchBookPaymentRequest, PatchAchPaymentRequest]
|
24
32
|
# @return [UnitResponse, UnitError]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
# class for serializing payment requests
|
6
|
+
module Unit
|
7
|
+
module Payment
|
8
|
+
class BulkPaymentRequest
|
9
|
+
def self.serialize(requests)
|
10
|
+
payload = requests.map(&:change_attributes)
|
11
|
+
{ "data": payload }.to_json
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -18,8 +18,8 @@ module Unit
|
|
18
18
|
# @param tags [Hash] - optional
|
19
19
|
# @param same_day [Boolean] - optional
|
20
20
|
# @param sec_code [String] - optional
|
21
|
-
def initialize(account_id
|
22
|
-
addenda
|
21
|
+
def initialize(account_id:, amount:, direction:, counterparty:, description:,
|
22
|
+
addenda: nil, idempotency_key: nil, tags: nil, same_day: nil, sec_code: nil)
|
23
23
|
@account_id = account_id
|
24
24
|
@amount = amount
|
25
25
|
@direction = direction
|
@@ -34,27 +34,37 @@ module Unit
|
|
34
34
|
|
35
35
|
def to_json_api
|
36
36
|
payload = {
|
37
|
-
"data":
|
38
|
-
"type": "achPayment",
|
39
|
-
"attributes": {
|
40
|
-
amount: amount,
|
41
|
-
direction: direction,
|
42
|
-
counterparty: counterparty.represent,
|
43
|
-
description: description,
|
44
|
-
addenda: addenda,
|
45
|
-
idempotencyKey: idempotency_key,
|
46
|
-
tags: tags,
|
47
|
-
sameDay: same_day,
|
48
|
-
secCode: sec_code
|
49
|
-
},
|
50
|
-
"relationships": {
|
51
|
-
"account": Unit::Types::Relationship.new("account", account_id).to_hash
|
52
|
-
}
|
53
|
-
}
|
37
|
+
"data": to_hash
|
54
38
|
}
|
55
39
|
payload[:data][:attributes].compact!
|
56
40
|
payload.to_json
|
57
41
|
end
|
42
|
+
|
43
|
+
def to_hash
|
44
|
+
{
|
45
|
+
"type": "achPayment",
|
46
|
+
"attributes": {
|
47
|
+
amount: amount,
|
48
|
+
direction: direction,
|
49
|
+
counterparty: counterparty.represent,
|
50
|
+
description: description,
|
51
|
+
addenda: addenda,
|
52
|
+
idempotencyKey: idempotency_key,
|
53
|
+
tags: tags,
|
54
|
+
sameDay: same_day,
|
55
|
+
secCode: sec_code
|
56
|
+
},
|
57
|
+
"relationships": {
|
58
|
+
"account": Unit::Types::Relationship.new("account", account_id).to_hash
|
59
|
+
}
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def change_attributes
|
64
|
+
payload = to_hash
|
65
|
+
payload[:attributes].compact!
|
66
|
+
payload
|
67
|
+
end
|
58
68
|
end
|
59
69
|
end
|
60
70
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
module Unit
|
6
6
|
module Payment
|
7
7
|
class CreateBookPaymentRequest
|
8
|
-
attr_reader :amount, :description, :account_id, :counterparty_account_id, :transaction_summary_override, :idempotency_key, :tags
|
8
|
+
attr_reader :amount, :description, :account_id, :counterparty_account_id, :transaction_summary_override, :idempotency_key, :tags
|
9
9
|
|
10
10
|
# @param amount [Integer]
|
11
11
|
# @param description [String]
|
@@ -14,13 +14,12 @@ module Unit
|
|
14
14
|
# @param transaction_summary_override [String] - optional
|
15
15
|
# @param idempotency_key [String] - optional
|
16
16
|
# @param tags [Hash] - optional
|
17
|
-
def initialize(amount
|
18
|
-
idempotency_key
|
17
|
+
def initialize(amount:, description:, account_id:, counterparty_account_id:, transaction_summary_override: nil,
|
18
|
+
idempotency_key: nil, tags: nil)
|
19
19
|
@amount = amount
|
20
20
|
@description = description
|
21
21
|
@account_id = account_id
|
22
22
|
@counterparty_account_id = counterparty_account_id
|
23
|
-
@relationships = relationships
|
24
23
|
@transaction_summary_override = transaction_summary_override
|
25
24
|
@idempotency_key = idempotency_key
|
26
25
|
@tags = tags
|
@@ -28,22 +27,32 @@ module Unit
|
|
28
27
|
|
29
28
|
def to_json_api
|
30
29
|
payload = {
|
31
|
-
data:
|
32
|
-
type: "bookPayment",
|
33
|
-
attributes: {
|
34
|
-
amount: amount,
|
35
|
-
description: description,
|
36
|
-
transactionSummaryOverride: transaction_summary_override,
|
37
|
-
idempotencyKey: idempotency_key,
|
38
|
-
tags: tags
|
39
|
-
},
|
40
|
-
relationships: { account: Unit::Types::Relationship.new("depositAccount", account_id).to_hash,
|
41
|
-
counterpartyAccount: Unit::Types::Relationship.new("depositAccount", counterparty_account_id).to_hash }
|
42
|
-
}
|
30
|
+
data: to_hash
|
43
31
|
}
|
44
32
|
payload[:data][:attributes].compact!
|
45
33
|
payload.to_json
|
46
34
|
end
|
35
|
+
|
36
|
+
def to_hash
|
37
|
+
{
|
38
|
+
type: "bookPayment",
|
39
|
+
attributes: {
|
40
|
+
amount: amount,
|
41
|
+
description: description,
|
42
|
+
transactionSummaryOverride: transaction_summary_override,
|
43
|
+
idempotencyKey: idempotency_key,
|
44
|
+
tags: tags
|
45
|
+
},
|
46
|
+
relationships: { account: Unit::Types::Relationship.new("depositAccount", account_id).to_hash,
|
47
|
+
counterpartyAccount: Unit::Types::Relationship.new("depositAccount", counterparty_account_id).to_hash }
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def change_attributes
|
52
|
+
payload = to_hash
|
53
|
+
payload[:attributes].compact!
|
54
|
+
payload
|
55
|
+
end
|
47
56
|
end
|
48
57
|
end
|
49
58
|
end
|
@@ -20,9 +20,9 @@ module Unit
|
|
20
20
|
# @param verify_counterparty_balance [Boolean] - optional
|
21
21
|
# @param same_day [Boolean] - optional
|
22
22
|
# @param sec_code [String] - optional
|
23
|
-
def initialize(account_id
|
24
|
-
addenda
|
25
|
-
same_day
|
23
|
+
def initialize(account_id:, counterparty_id:, amount:, direction:, description:,
|
24
|
+
addenda: nil, idempotency_key: nil, tags: nil, verify_counterparty_balance: nil,
|
25
|
+
same_day: nil, sec_code: nil)
|
26
26
|
@account_id = account_id
|
27
27
|
@counterparty_id = counterparty_id
|
28
28
|
@amount = amount
|
@@ -38,28 +38,38 @@ module Unit
|
|
38
38
|
|
39
39
|
def to_json_api
|
40
40
|
payload = {
|
41
|
-
"data":
|
42
|
-
"type": "achPayment",
|
43
|
-
"attributes": {
|
44
|
-
amount: amount,
|
45
|
-
direction: direction,
|
46
|
-
description: description,
|
47
|
-
addenda: addenda,
|
48
|
-
idempotencyKey: idempotency_key,
|
49
|
-
tags: tags,
|
50
|
-
verifyCounterpartyBalance: verify_counterparty_balance,
|
51
|
-
sameDay: same_day,
|
52
|
-
secCode: sec_code
|
53
|
-
},
|
54
|
-
"relationships": {
|
55
|
-
"account": Unit::Types::Relationship.new("account", account_id).to_hash,
|
56
|
-
"counterparty": Unit::Types::Relationship.new("counterparty", counterparty_id).to_hash
|
57
|
-
}
|
58
|
-
}
|
41
|
+
"data": to_hash
|
59
42
|
}
|
60
43
|
payload[:data][:attributes].compact!
|
61
44
|
payload.to_json
|
62
45
|
end
|
46
|
+
|
47
|
+
def to_hash
|
48
|
+
{
|
49
|
+
"type": "achPayment",
|
50
|
+
"attributes": {
|
51
|
+
amount: amount,
|
52
|
+
direction: direction,
|
53
|
+
description: description,
|
54
|
+
addenda: addenda,
|
55
|
+
idempotencyKey: idempotency_key,
|
56
|
+
tags: tags,
|
57
|
+
verifyCounterpartyBalance: verify_counterparty_balance,
|
58
|
+
sameDay: same_day,
|
59
|
+
secCode: sec_code
|
60
|
+
},
|
61
|
+
"relationships": {
|
62
|
+
"account": Unit::Types::Relationship.new("account", account_id).to_hash,
|
63
|
+
"counterparty": Unit::Types::Relationship.new("counterparty", counterparty_id).to_hash
|
64
|
+
}
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
def change_attributes
|
69
|
+
payload = to_hash
|
70
|
+
payload[:attributes].compact!
|
71
|
+
payload
|
72
|
+
end
|
63
73
|
end
|
64
74
|
end
|
65
75
|
end
|
@@ -13,7 +13,7 @@ module Unit
|
|
13
13
|
# @param counterparty [WireCounterparty]
|
14
14
|
# @param idempotency_key [String] - optional
|
15
15
|
# @param tags [Hash] - optional
|
16
|
-
def initialize(account_id
|
16
|
+
def initialize(account_id:, amount:, description:, counterparty:, idempotency_key: nil, tags: nil)
|
17
17
|
@account_id = account_id
|
18
18
|
@amount = amount
|
19
19
|
@description = description
|
@@ -24,21 +24,31 @@ module Unit
|
|
24
24
|
|
25
25
|
def to_json_api
|
26
26
|
payload = {
|
27
|
-
data:
|
28
|
-
type: "wirePayment",
|
29
|
-
attributes: {
|
30
|
-
amount: amount,
|
31
|
-
description: description,
|
32
|
-
counterparty: counterparty.represent,
|
33
|
-
idempotencyKey: idempotency_key,
|
34
|
-
tags: tags
|
35
|
-
},
|
36
|
-
relationships: { account: Unit::Types::Relationship.new("account", account_id).to_hash }
|
37
|
-
}
|
27
|
+
data: to_hash
|
38
28
|
}
|
39
29
|
payload[:data][:attributes].compact!
|
40
30
|
payload.to_json
|
41
31
|
end
|
32
|
+
|
33
|
+
def to_hash
|
34
|
+
{
|
35
|
+
type: "wirePayment",
|
36
|
+
attributes: {
|
37
|
+
amount: amount,
|
38
|
+
description: description,
|
39
|
+
counterparty: counterparty.represent,
|
40
|
+
idempotencyKey: idempotency_key,
|
41
|
+
tags: tags
|
42
|
+
},
|
43
|
+
relationships: { account: Unit::Types::Relationship.new("account", account_id).to_hash }
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def change_attributes
|
48
|
+
payload = to_hash
|
49
|
+
payload[:attributes].compact!
|
50
|
+
payload
|
51
|
+
end
|
42
52
|
end
|
43
53
|
end
|
44
54
|
end
|
@@ -22,9 +22,9 @@ module Unit
|
|
22
22
|
# @param verify_counterparty_balance [Boolean] - optional
|
23
23
|
# @param same_day [Boolean] - optional
|
24
24
|
# @param sec_code [String] - optional
|
25
|
-
def initialize(account_id
|
26
|
-
addenda
|
27
|
-
verify_counterparty_balance
|
25
|
+
def initialize(account_id:, amount:, direction:, description:, plaid_processor_token:,
|
26
|
+
addenda: nil, idempotency_key: nil, counterparty_name: nil, tags: nil,
|
27
|
+
verify_counterparty_balance: nil, same_day: nil, sec_code: nil)
|
28
28
|
@account_id = account_id
|
29
29
|
@amount = amount
|
30
30
|
@direction = direction
|
@@ -41,29 +41,39 @@ module Unit
|
|
41
41
|
|
42
42
|
def to_json_api
|
43
43
|
payload = {
|
44
|
-
"data":
|
45
|
-
"type": "achPayment",
|
46
|
-
"attributes": {
|
47
|
-
amount: amount,
|
48
|
-
direction: direction,
|
49
|
-
description: description,
|
50
|
-
plaidProcessorToken: plaid_processor_token,
|
51
|
-
addenda: addenda,
|
52
|
-
idempotencyKey: idempotency_key,
|
53
|
-
counterpartyName: counterparty_name,
|
54
|
-
tags: tags,
|
55
|
-
verifyCounterpartyBalance: verify_counterparty_balance,
|
56
|
-
sameDay: same_day,
|
57
|
-
secCode: sec_code
|
58
|
-
},
|
59
|
-
"relationships": {
|
60
|
-
"account": Unit::Types::Relationship.new("account", account_id).to_hash
|
61
|
-
}
|
62
|
-
}
|
44
|
+
"data": to_hash
|
63
45
|
}
|
64
46
|
payload[:data][:attributes].compact!
|
65
47
|
payload.to_json
|
66
48
|
end
|
49
|
+
|
50
|
+
def to_hash
|
51
|
+
{
|
52
|
+
"type": "achPayment",
|
53
|
+
"attributes": {
|
54
|
+
amount: amount,
|
55
|
+
direction: direction,
|
56
|
+
description: description,
|
57
|
+
plaidProcessorToken: plaid_processor_token,
|
58
|
+
addenda: addenda,
|
59
|
+
idempotencyKey: idempotency_key,
|
60
|
+
counterpartyName: counterparty_name,
|
61
|
+
tags: tags,
|
62
|
+
verifyCounterpartyBalance: verify_counterparty_balance,
|
63
|
+
sameDay: same_day,
|
64
|
+
secCode: sec_code
|
65
|
+
},
|
66
|
+
"relationships": {
|
67
|
+
"account": Unit::Types::Relationship.new("account", account_id).to_hash
|
68
|
+
}
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
def change_attributes
|
73
|
+
payload = to_hash
|
74
|
+
payload[:attributes].compact!
|
75
|
+
payload
|
76
|
+
end
|
67
77
|
end
|
68
78
|
end
|
69
79
|
end
|
@@ -13,6 +13,7 @@ module Unit
|
|
13
13
|
autoload :CreateWirePaymentRequest, "unit/models/payment/create_wire_payment_request"
|
14
14
|
autoload :ListPaymentParams, "unit/models/payment/list_payment_params"
|
15
15
|
autoload :GetRequest, "unit/models/payment/get_request"
|
16
|
+
autoload :BulkPaymentRequest, "unit/models/payment/bulk_payment_request"
|
16
17
|
class << self
|
17
18
|
# Create a new book payment by calling Unit's API
|
18
19
|
# @see https://docs.unit.co/book-payments#book-payments
|
@@ -26,8 +27,9 @@ module Unit
|
|
26
27
|
# @return [UnitResponse, UnitError]
|
27
28
|
def create_book_payment(amount:, description:, account_id:, counterparty_account_id:, transaction_summary_override: nil,
|
28
29
|
idempotency_key: nil, tags: nil)
|
29
|
-
request = Unit::Payment::CreateBookPaymentRequest.new(amount, description, account_id, counterparty_account_id, transaction_summary_override,
|
30
|
-
idempotency_key, tags)
|
30
|
+
request = Unit::Payment::CreateBookPaymentRequest.new(amount: amount, description: description, account_id: account_id, counterparty_account_id: counterparty_account_id, transaction_summary_override: transaction_summary_override,
|
31
|
+
idempotency_key: idempotency_key, tags: tags)
|
32
|
+
|
31
33
|
Unit::Resource::PaymentResource.create_payment(request)
|
32
34
|
end
|
33
35
|
|
@@ -56,8 +58,8 @@ module Unit
|
|
56
58
|
def create_ach_payment_inline(account_id:, amount:, direction:, counterparty:,
|
57
59
|
description:, addenda: nil, idempotency_key: nil, tags: nil,
|
58
60
|
same_day: nil, sec_code: nil)
|
59
|
-
request = Unit::Payment::CreateAchPaymentInlineRequest.new(account_id, amount, direction, counterparty, description,
|
60
|
-
|
61
|
+
request = Unit::Payment::CreateAchPaymentInlineRequest.new(account_id: account_id, amount: amount, direction: direction, counterparty: counterparty, description: description, addenda: addenda, idempotency_key: idempotency_key,
|
62
|
+
tags: tags, same_day: same_day, sec_code: sec_code)
|
61
63
|
Unit::Resource::PaymentResource.create_payment(request)
|
62
64
|
end
|
63
65
|
|
@@ -77,9 +79,8 @@ module Unit
|
|
77
79
|
def create_ach_payment_linked(account_id:, counterparty_id:, amount:, direction:,
|
78
80
|
description:, addenda: nil, idempotency_key: nil, tags: nil,
|
79
81
|
verify_counterparty_balance: nil, same_day: nil, sec_code: nil)
|
80
|
-
request = Unit::Payment::CreatePaymentLinkedRequest.new(account_id, counterparty_id, amount, direction,
|
81
|
-
|
82
|
-
verify_counterparty_balance, same_day, sec_code)
|
82
|
+
request = Unit::Payment::CreatePaymentLinkedRequest.new(account_id: account_id, counterparty_id: counterparty_id, amount: amount, direction: direction, description: description, addenda: addenda, idempotency_key: idempotency_key,
|
83
|
+
tags: tags, verify_counterparty_balance: verify_counterparty_balance, same_day: same_day, sec_code: sec_code)
|
83
84
|
Unit::Resource::PaymentResource.create_payment(request)
|
84
85
|
end
|
85
86
|
|
@@ -100,9 +101,8 @@ module Unit
|
|
100
101
|
def create_ach_payment_with_plaid_token(account_id:, amount:, direction:, description:, plaid_processor_token:,
|
101
102
|
addenda: nil, idempotency_key: nil, counterparty_name: nil, tags: nil,
|
102
103
|
verify_counterparty_balance: nil, same_day: nil, sec_code: nil)
|
103
|
-
request = Unit::Payment::CreateWithPlaidTokenRequest.new(account_id, amount, direction, description, plaid_processor_token,
|
104
|
-
|
105
|
-
verify_counterparty_balance, same_day, sec_code)
|
104
|
+
request = Unit::Payment::CreateWithPlaidTokenRequest.new(account_id: account_id, amount: amount, direction: direction, description: description, plaid_processor_token: plaid_processor_token, addenda: addenda, idempotency_key: idempotency_key,
|
105
|
+
counterparty_name: counterparty_name, tags: tags, verify_counterparty_balance: verify_counterparty_balance, same_day: same_day, sec_code: sec_code)
|
106
106
|
Unit::Resource::PaymentResource.create_payment(request)
|
107
107
|
end
|
108
108
|
|
@@ -131,7 +131,7 @@ module Unit
|
|
131
131
|
# @param idempotency_key [String] - optional
|
132
132
|
# @param tags [Hash] - optional
|
133
133
|
def create_wire_payment(account_id:, amount:, description:, counterparty:, idempotency_key: nil, tags: nil)
|
134
|
-
request = Unit::Payment::CreateWirePaymentRequest.new(account_id, amount, description, counterparty, idempotency_key, tags)
|
134
|
+
request = Unit::Payment::CreateWirePaymentRequest.new(account_id: account_id, amount: amount, description: description, counterparty: counterparty, idempotency_key: idempotency_key, tags: tags)
|
135
135
|
Unit::Resource::PaymentResource.create_payment(request)
|
136
136
|
end
|
137
137
|
|
@@ -173,6 +173,14 @@ module Unit
|
|
173
173
|
request = Unit::Payment::GetRequest.new(payment_id, include)
|
174
174
|
Unit::Resource::PaymentResource.get_payment(request)
|
175
175
|
end
|
176
|
+
|
177
|
+
# Create a bulk payment by calling Unit's API
|
178
|
+
# @see https://docs.unit.co/payments/#bulk-payments
|
179
|
+
# @param requests [Array<CreateAchPaymentInlineRequest, CreatePaymentLinkedRequest, CreateBookPaymentRequest, CreateWithPlaidTokenRequest, CreateWirePaymentRequest>]
|
180
|
+
def create_bulk_payment(requests:)
|
181
|
+
request = Unit::Payment::BulkPaymentRequest.serialize(requests)
|
182
|
+
Unit::Resource::PaymentResource.create_bulk_payment(request)
|
183
|
+
end
|
176
184
|
end
|
177
185
|
end
|
178
186
|
end
|
data/lib/unit/version.rb
CHANGED
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: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Unit
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_bot_rails
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/unit/models/customer/patch_business_customer_request.rb
|
164
164
|
- lib/unit/models/customer/patch_individual_customer_request.rb
|
165
165
|
- lib/unit/models/customer/remove_authorized_users_request.rb
|
166
|
+
- lib/unit/models/payment/bulk_payment_request.rb
|
166
167
|
- lib/unit/models/payment/create_ach_payment_inline_request.rb
|
167
168
|
- lib/unit/models/payment/create_book_payment_request.rb
|
168
169
|
- lib/unit/models/payment/create_payment_linked_request.rb
|