Module: Unit::Repayment

Defined in:
lib/unit/models/repayment/repayment.rb,
lib/unit/models/repayment/list_repayment_params.rb,
lib/unit/models/repayment/create_ach_repayment_request.rb,
lib/unit/models/repayment/create_book_repayment_request.rb

Defined Under Namespace

Classes: CreateAchRepaymentRequest, CreateBookRepaymentRequest, ListRepaymentParams

Constant Summary collapse

REPAYMENT_LIMIT =
100
REPAYMENT_OFFSET =
0

Class Method Summary collapse

Class Method Details

.create_ach_repayment(account_id:, credit_account_id:, counterparty_id:, description:, amount:, addenda: nil, tags: nil, idempotency_key: nil, same_day: false) ⇒ Object

Create an ach repayment by calling Unit’s API

Parameters:

  • account_id (String)
  • credit_account_id (String)
  • counterparty_id (String)
  • description (String)
  • amount (Integer)
  • addenda (String) (defaults to: nil)
    • optional

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

  • same_day (Boolean) (defaults to: false)
    • optional

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

See Also:



46
47
48
49
# File 'lib/unit/models/repayment/repayment.rb', line 46

def create_ach_repayment(account_id:, credit_account_id:, counterparty_id:, description:, amount:, addenda: nil, tags: nil, idempotency_key: nil, same_day: false)
  request = Unit::Repayment::CreateAchRepaymentRequest.new(, , counterparty_id, description, amount, addenda, tags, idempotency_key, same_day: same_day)
  Unit::Resource::RepaymentResource.create(request)
end

.create_book_repayment(account_id:, credit_account_id:, counterparty_account_id:, description:, amount:, transaction_summary_override:, tags: nil, idempotency_key: nil) ⇒ Object

Create a book repayment by calling Unit’s API

Parameters:

  • account_id (String)
  • credit_account_id (String)
  • counterparty_account_id (String)
  • description (String)
  • amount (Integer)
  • transaction_summary_override (String)
  • tags (Array<String>) (defaults to: nil)
    • optional

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

See Also:



30
31
32
33
# File 'lib/unit/models/repayment/repayment.rb', line 30

def create_book_repayment(account_id:, credit_account_id:, counterparty_account_id:, description:, amount:, transaction_summary_override:, tags: nil, idempotency_key: nil)
  request = Unit::Repayment::CreateBookRepaymentRequest.new(, , , description, amount, transaction_summary_override, tags, idempotency_key)
  Unit::Resource::RepaymentResource.create(request)
end

.get_repayment(repayment_id:) ⇒ Object

Get a repayment by calling Unit’s API

Parameters:

  • repayment_id (String)

See Also:



16
17
18
# File 'lib/unit/models/repayment/repayment.rb', line 16

def get_repayment(repayment_id:)
  Unit::Resource::RepaymentResource.get(repayment_id)
end

.list_repayments(limit: REPAYMENT_LIMIT, offset: REPAYMENT_OFFSET, account_id: nil, credit_account_id: nil, customer_id: nil, status: nil, type: nil) ⇒ Object

List repayments by calling Unit’s API

Parameters:

  • limit (Integer) (defaults to: REPAYMENT_LIMIT)
    • optional

  • offset (Integer) (defaults to: REPAYMENT_OFFSET)
    • optional

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

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

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

  • status (Array<String>) (defaults to: nil)
    • optional

  • type (Array<String>) (defaults to: nil)
    • optional

See Also:



60
61
62
63
64
# File 'lib/unit/models/repayment/repayment.rb', line 60

def list_repayments(limit: REPAYMENT_LIMIT, offset: REPAYMENT_OFFSET, account_id: nil,
                    credit_account_id: nil, customer_id: nil, status: nil, type: nil)
  request = Unit::Repayment::ListRepaymentParams.new(limit, offset, , , customer_id, status, type)
  Unit::Resource::RepaymentResource.list(request)
end