Class: Increase::Resources::PendingTransactions

Inherits:
Object
  • Object
show all
Defined in:
lib/increase/resources/pending_transactions.rb,
sig/increase/resources/pending_transactions.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PendingTransactions

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PendingTransactions.

Parameters:



123
124
125
# File 'lib/increase/resources/pending_transactions.rb', line 123

def initialize(client:)
  @client = client
end

Instance Method Details

#create(account_id:, amount:, description: nil, request_options: {}) ⇒ Increase::Models::PendingTransaction

Creates a pending transaction on an account. This can be useful to hold funds for an external payment or known future transaction outside of Increase (only negative amounts are supported). The resulting Pending Transaction will have a category of user_initiated_hold and can be released via the API to unlock the held funds.

Parameters:

  • account_id (String)

    The Account to place the hold on.

  • amount (Integer)

    The amount to hold in the minor unit of the account's currency. For dollars, for example, this is cents. This should be a negative amount: To hold $1.00 from the account, pass -100 as amount.

  • description (String)

    The description you choose to give the hold.

  • request_options (Increase::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
# File 'lib/increase/resources/pending_transactions.rb', line 28

def create(params)
  parsed, options = Increase::PendingTransactionCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "pending_transactions",
    body: parsed,
    model: Increase::PendingTransaction,
    options: options
  )
end

#list(account_id: nil, category: nil, created_at: nil, cursor: nil, limit: nil, route_id: nil, status: nil, request_options: {}) ⇒ Increase::Internal::Page<Increase::Models::PendingTransaction>

List Pending Transactions

Parameters:

Returns:

See Also:



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/increase/resources/pending_transactions.rb', line 84

def list(params = {})
  parsed, options = Increase::PendingTransactionListParams.dump_request(params)
  query = Increase::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "pending_transactions",
    query: query,
    page: Increase::Internal::Page,
    model: Increase::PendingTransaction,
    options: options
  )
end

#release(pending_transaction_id, request_options: {}) ⇒ Increase::Models::PendingTransaction

Release a Pending Transaction you had previously created. The Pending Transaction must have a category of user_initiated_hold and a status of pending. This will unlock the held funds and mark the Pending Transaction as complete.

Parameters:

  • pending_transaction_id (String)

    The identifier of the Pending Transaction to release.

  • request_options (Increase::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



111
112
113
114
115
116
117
118
# File 'lib/increase/resources/pending_transactions.rb', line 111

def release(pending_transaction_id, params = {})
  @client.request(
    method: :post,
    path: ["pending_transactions/%1$s/release", pending_transaction_id],
    model: Increase::PendingTransaction,
    options: params[:request_options]
  )
end

#retrieve(pending_transaction_id, request_options: {}) ⇒ Increase::Models::PendingTransaction

Retrieve a Pending Transaction

Parameters:

  • pending_transaction_id (String)

    The identifier of the Pending Transaction.

  • request_options (Increase::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



50
51
52
53
54
55
56
57
# File 'lib/increase/resources/pending_transactions.rb', line 50

def retrieve(pending_transaction_id, params = {})
  @client.request(
    method: :get,
    path: ["pending_transactions/%1$s", pending_transaction_id],
    model: Increase::PendingTransaction,
    options: params[:request_options]
  )
end