Module: Unit::Payment

Defined in:
lib/unit/models/payment/payment.rb,
lib/unit/models/payment/patch_book_payment_request.rb,
lib/unit/models/payment/create_book_payment_request.rb

Defined Under Namespace

Classes: CreateBookPaymentRequest, PatchBookPaymentRequest

Class Method Summary collapse

Class Method Details

.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

Parameters:

  • amount (Integer)
  • description (String)
  • account_id (String)
  • counterparty_account_id (String)
  • transaction_summary_override (String) (defaults to: nil)
    • optional

  • idempotency_key (String) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional

Returns:

See Also:



19
20
21
22
23
24
# File 'lib/unit/models/payment/payment.rb', line 19

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, description, , , transaction_summary_override,
                                                        idempotency_key, tags)
  Unit::Resource::PaymentResource.create_payment(request)
end

.update_book_payment(payment_id:, tags: nil) ⇒ UnitResponse, UnitError

Update a book payment by calling Unit’s API

Parameters:

  • payment_id (String)
  • tags (Hash) (defaults to: nil)
    • optional

Returns:

See Also:



31
32
33
34
# File 'lib/unit/models/payment/payment.rb', line 31

def update_book_payment(payment_id:, tags: nil)
  request = Unit::Payment::PatchBookPaymentRequest.new(payment_id, tags)
  Unit::Resource::PaymentResource.update_payment(request)
end