Class: Increase::Resources::PendingTransactions

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

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:



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

def initialize(client:)
  @client = client
end

Instance Method Details

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

Some parameter documentations has been truncated, see Models::PendingTransactionCreateParams for more details.

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

  • 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>

Some parameter documentations has been truncated, see Models::PendingTransactionListParams for more details.

List Pending Transactions

Parameters:

Returns:

See Also:



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

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:



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

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