Module: Unit::Transaction

Defined in:
lib/unit/models/transaction/transaction.rb,
lib/unit/models/transaction/patch_tags_request.rb,
lib/unit/models/transaction/get_transaction_params.rb,
lib/unit/models/transaction/list_transaction_params.rb,
lib/unit/models/transaction/patch_book_transaction_request.rb,
lib/unit/models/transaction/patch_chargeback_transaction_request.rb

Defined Under Namespace

Classes: GetTransactionParams, ListTransactionParams, PatchBookTransactionRequest, PatchChargebackTransactionRequest, PatchTagsRequest

Constant Summary collapse

TRANSACTION_LIST_LIMIT =
100
TRANSACTION_LIST_OFFSET =
0

Class Method Summary collapse

Class Method Details

.get_transaction(transaction_id:, account_id:, customer_id: nil, include: nil) ⇒ Object

Get a transaction by id

Parameters:

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

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

See Also:



20
21
22
23
# File 'lib/unit/models/transaction/transaction.rb', line 20

def get_transaction(transaction_id:, account_id:, customer_id: nil, include: nil)
  params = GetTransactionParams.new(transaction_id, , customer_id, include)
  Unit::Resource::TransactionResource.get_transaction(params)
end

.list_transactions(limit: nil, offset: nil, account_id: nil, customer_id: nil, query: nil, tags: nil, since: nil, _until: nil, card_id: nil, type: nil, from_amount: nil, to_amount: nil, direction: nil, exclude_fees: nil, sort: nil, include: nil) ⇒ Object

List transactions

Parameters:

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

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

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

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

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

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

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

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

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

  • from_amount (Integer) (defaults to: nil)
    • optional

  • to_amount (Integer) (defaults to: nil)
    • optional

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

  • exclude_fees (Boolean) (defaults to: nil)
    • optional

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

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

See Also:



42
43
44
45
46
47
48
49
# File 'lib/unit/models/transaction/transaction.rb', line 42

def list_transactions(limit: nil, offset: nil, account_id: nil, customer_id: nil,
                      query: nil, tags: nil, since: nil, _until: nil, card_id: nil, type: nil, from_amount: nil, to_amount: nil,
                      direction: nil, exclude_fees: nil, sort: nil, include: nil)
  params = ListTransactionParams.new(limit, offset, , customer_id, query, tags, since,
                                     _until, card_id, type, from_amount, to_amount,
                                     direction, exclude_fees, sort, include)
  Unit::Resource::TransactionResource.list_transactions(params)
end

.update_book_transaction(account_id:, transaction_id:, summary:, tags: nil) ⇒ Object

Update a book transaction

Parameters:

  • account_id (String)
  • transaction_id (String)
  • summary (String)
    • optional

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

See Also:



67
68
69
70
# File 'lib/unit/models/transaction/transaction.rb', line 67

def update_book_transaction(account_id:, transaction_id:, summary:, tags: nil)
  request = PatchBookTransactionRequest.new(, transaction_id, summary, tags)
  Unit::Resource::TransactionResource.update_transaction(request)
end

.update_chargeback_transaction(account_id:, transaction_id:, summary:, tags: nil) ⇒ Object

Update a chargeback transaction

Parameters:

  • account_id (String)
  • transaction_id (String)
  • summary (String)
    • optional

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

See Also:



78
79
80
81
# File 'lib/unit/models/transaction/transaction.rb', line 78

def update_chargeback_transaction(account_id:, transaction_id:, summary:, tags: nil)
  request = PatchChargebackTransactionRequest.new(, transaction_id, summary, tags)
  Unit::Resource::TransactionResource.update_transaction(request)
end

.update_transaction(account_id:, transaction_id:, tags: nil) ⇒ Object

Update transaction tags

Parameters:

  • account_id (String)
  • transaction_id (String)
  • tags (Hash) (defaults to: nil)

See Also:



56
57
58
59
# File 'lib/unit/models/transaction/transaction.rb', line 56

def update_transaction(account_id:, transaction_id:, tags: nil)
  request = PatchTagsRequest.new(, transaction_id, tags)
  Unit::Resource::TransactionResource.update_tags(request)
end