Module: Unit::Payment
- Defined in:
- lib/unit/models/payment/payment.rb,
lib/unit/models/payment/get_request.rb,
lib/unit/models/payment/list_payment_params.rb,
lib/unit/models/payment/bulk_payment_request.rb,
lib/unit/models/payment/patch_ach_payment_request.rb,
lib/unit/models/payment/patch_book_payment_request.rb,
lib/unit/models/payment/create_book_payment_request.rb,
lib/unit/models/payment/create_wire_payment_request.rb,
lib/unit/models/payment/create_batch_release_request.rb,
lib/unit/models/payment/batch_release_request_builder.rb,
lib/unit/models/payment/create_payment_linked_request.rb,
lib/unit/models/payment/create_with_plaid_token_request.rb,
lib/unit/models/payment/create_ach_payment_inline_request.rb
Defined Under Namespace
Classes: BatchReleaseRequestBuilder, BulkPaymentRequest, CreateAchPaymentInlineRequest, CreateBatchReleaseRequest, CreateBookPaymentRequest, CreatePaymentLinkedRequest, CreateWirePaymentRequest, CreateWithPlaidTokenRequest, GetRequest, ListPaymentParams, PatchAchPaymentRequest, PatchBookPaymentRequest
Constant Summary collapse
- PAYMENT_LIMIT =
100
- PAYMENT_OFFSET =
0
Class Method Summary collapse
-
.cancel_payment(payment_id:) ⇒ Object
Cancel a payment by calling Unit’s API.
-
.create_ach_payment_inline(account_id:, amount:, direction:, counterparty:, description:, addenda: nil, idempotency_key: nil, tags: nil, same_day: nil, sec_code: nil) ⇒ Object
Create a new ach payment to inline counterparty by calling Unit’s API.
-
.create_ach_payment_linked(account_id:, counterparty_id:, amount:, direction:, description:, addenda: nil, idempotency_key: nil, tags: nil, verify_counterparty_balance: nil, same_day: nil, sec_code: nil) ⇒ Object
Create a new ach payment to linked counterparty by calling Unit’s API.
-
.create_ach_payment_with_plaid_token(account_id:, amount:, direction:, description:, plaid_processor_token:, addenda: nil, idempotency_key: nil, counterparty_name: nil, tags: nil, verify_counterparty_balance: nil, same_day: nil, sec_code: nil) ⇒ Object
Create a new ach payment with a plaid token by calling Unit’s API.
-
.create_batch_release(requests) ⇒ Object
Create a batch release.
-
.create_book_payment(amount:, description:, account_id:, counterparty_account_id:, transaction_summary_override: nil, idempotency_key: nil, tags: nil) ⇒ UnitResponse, UnitError
Create a new book payment by calling Unit’s API.
-
.create_bulk_payment(requests:) ⇒ Object
Create a bulk payment by calling Unit’s API.
-
.create_wire_payment(account_id:, amount:, description:, counterparty:, idempotency_key: nil, tags: nil) ⇒ Object
Create a wire payment by calling Unit’s API.
-
.get_payment(payment_id:, include: nil) ⇒ Object
Get a payment by calling Unit’s API.
-
.list_payments(limit: PAYMENT_LIMIT, offset: PAYMENT_OFFSET, account_id: nil, customer_id: nil, counterparty_account_id: nil, tags: nil, status: nil, type: nil, direction: nil, since: nil, until_: nil, from_amount: nil, to_amount: nil, recurring_payment_id: nil, feature: nil, sort: nil, include: nil) ⇒ Object
List payments by calling Unit’s API.
-
.update_ach_payment(payment_id:, tags: nil) ⇒ Object
Update an ACH payment by calling Unit’s API.
-
.update_book_payment(payment_id:, tags: nil) ⇒ UnitResponse, UnitError
Update a book payment by calling Unit’s API.
Class Method Details
.cancel_payment(payment_id:) ⇒ Object
Cancel a payment by calling Unit’s API
123 124 125 |
# File 'lib/unit/models/payment/payment.rb', line 123 def cancel_payment(payment_id:) Unit::Resource::PaymentResource.cancel_payment(payment_id) end |
.create_ach_payment_inline(account_id:, amount:, direction:, counterparty:, description:, addenda: nil, idempotency_key: nil, tags: nil, same_day: nil, sec_code: nil) ⇒ Object
Create a new ach payment to inline counterparty by calling Unit’s API
60 61 62 63 64 65 66 |
# File 'lib/unit/models/payment/payment.rb', line 60 def create_ach_payment_inline(account_id:, amount:, direction:, counterparty:, description:, addenda: nil, idempotency_key: nil, tags: nil, same_day: nil, sec_code: nil) request = Unit::Payment::CreateAchPaymentInlineRequest.new(account_id: account_id, amount: amount, direction: direction, counterparty: counterparty, description: description, addenda: addenda, idempotency_key: idempotency_key, tags: , same_day: same_day, sec_code: sec_code) Unit::Resource::PaymentResource.create_payment(request) end |
.create_ach_payment_linked(account_id:, counterparty_id:, amount:, direction:, description:, addenda: nil, idempotency_key: nil, tags: nil, verify_counterparty_balance: nil, same_day: nil, sec_code: nil) ⇒ Object
Create a new ach payment to linked counterparty by calling Unit’s API
81 82 83 84 85 86 87 |
# File 'lib/unit/models/payment/payment.rb', line 81 def create_ach_payment_linked(account_id:, counterparty_id:, amount:, direction:, description:, addenda: nil, idempotency_key: nil, tags: nil, verify_counterparty_balance: nil, same_day: nil, sec_code: nil) 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, tags: , verify_counterparty_balance: verify_counterparty_balance, same_day: same_day, sec_code: sec_code) Unit::Resource::PaymentResource.create_payment(request) end |
.create_ach_payment_with_plaid_token(account_id:, amount:, direction:, description:, plaid_processor_token:, addenda: nil, idempotency_key: nil, counterparty_name: nil, tags: nil, verify_counterparty_balance: nil, same_day: nil, sec_code: nil) ⇒ Object
Create a new ach payment with a plaid token by calling Unit’s API
103 104 105 106 107 108 109 |
# File 'lib/unit/models/payment/payment.rb', line 103 def create_ach_payment_with_plaid_token(account_id:, amount:, direction:, description:, plaid_processor_token:, addenda: nil, idempotency_key: nil, counterparty_name: nil, tags: nil, verify_counterparty_balance: nil, same_day: nil, sec_code: nil) 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, counterparty_name: counterparty_name, tags: , verify_counterparty_balance: verify_counterparty_balance, same_day: same_day, sec_code: sec_code) Unit::Resource::PaymentResource.create_payment(request) end |
.create_batch_release(requests) ⇒ Object
Create a batch release
197 198 199 200 201 202 203 |
# File 'lib/unit/models/payment/payment.rb', line 197 def create_batch_release(requests) payload = BatchReleaseRequestBuilder.new requests.each do |req| payload.add_request(req[:account_id], req[:batch_account_id], req[:amount], req[:description], req[:sender_name], req[:sender_address], req[:sender_account_number], req[:tags], req[:idempotency_key]) end Unit::Resource::PaymentResource.create_batch_release(payload.to_hash) end |
.create_book_payment(amount:, description:, account_id:, counterparty_account_id:, transaction_summary_override: nil, idempotency_key: nil, tags: nil) ⇒ UnitResponse, UnitError
Create a new book payment by calling Unit’s API
30 31 32 33 34 35 36 |
# File 'lib/unit/models/payment/payment.rb', line 30 def create_book_payment(amount:, description:, account_id:, counterparty_account_id:, transaction_summary_override: nil, idempotency_key: nil, tags: nil) 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, idempotency_key: idempotency_key, tags: ) Unit::Resource::PaymentResource.create_payment(request) end |
.create_bulk_payment(requests:) ⇒ Object
Create a bulk payment by calling Unit’s API
182 183 184 185 |
# File 'lib/unit/models/payment/payment.rb', line 182 def create_bulk_payment(requests:) request = Unit::Payment::BulkPaymentRequest.serialize(requests) Unit::Resource::PaymentResource.create_bulk_payment(request) end |
.create_wire_payment(account_id:, amount:, description:, counterparty:, idempotency_key: nil, tags: nil) ⇒ Object
Create a wire payment by calling Unit’s API
135 136 137 138 |
# File 'lib/unit/models/payment/payment.rb', line 135 def create_wire_payment(account_id:, amount:, description:, counterparty:, idempotency_key: nil, tags: nil) request = Unit::Payment::CreateWirePaymentRequest.new(account_id: account_id, amount: amount, description: description, counterparty: counterparty, idempotency_key: idempotency_key, tags: ) Unit::Resource::PaymentResource.create_payment(request) end |
.get_payment(payment_id:, include: nil) ⇒ Object
Get a payment by calling Unit’s API
174 175 176 177 |
# File 'lib/unit/models/payment/payment.rb', line 174 def get_payment(payment_id:, include: nil) request = Unit::Payment::GetRequest.new(payment_id, include) Unit::Resource::PaymentResource.get_payment(request) end |
.list_payments(limit: PAYMENT_LIMIT, offset: PAYMENT_OFFSET, account_id: nil, customer_id: nil, counterparty_account_id: nil, tags: nil, status: nil, type: nil, direction: nil, since: nil, until_: nil, from_amount: nil, to_amount: nil, recurring_payment_id: nil, feature: nil, sort: nil, include: nil) ⇒ Object
List payments by calling Unit’s API
159 160 161 162 163 164 165 166 167 168 |
# File 'lib/unit/models/payment/payment.rb', line 159 def list_payments(limit: PAYMENT_LIMIT, offset: PAYMENT_OFFSET, account_id: nil, customer_id: nil, counterparty_account_id: nil, tags: nil, status: nil, type: nil, direction: nil, since: nil, until_: nil, from_amount: nil, to_amount: nil, recurring_payment_id: nil, feature: nil, sort: nil, include: nil) request = Unit::Payment::ListPaymentParams.new(limit, offset, account_id, customer_id, counterparty_account_id, , status, type, direction, since, until_, from_amount, to_amount, recurring_payment_id, feature, sort, include) Unit::Resource::PaymentResource.list_payments(request) end |
.update_ach_payment(payment_id:, tags: nil) ⇒ Object
Update an ACH payment by calling Unit’s API
115 116 117 118 |
# File 'lib/unit/models/payment/payment.rb', line 115 def update_ach_payment(payment_id:, tags: nil) request = Unit::Payment::PatchAchPaymentRequest.new(payment_id, ) Unit::Resource::PaymentResource.update_payment(request) end |
.update_book_payment(payment_id:, tags: nil) ⇒ UnitResponse, UnitError
Update a book payment by calling Unit’s API
43 44 45 46 |
# File 'lib/unit/models/payment/payment.rb', line 43 def update_book_payment(payment_id:, tags: nil) request = Unit::Payment::PatchBookPaymentRequest.new(payment_id, ) Unit::Resource::PaymentResource.update_payment(request) end |