Class: ModernTreasury::Resources::PaymentFlows

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/resources/payment_flows.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PaymentFlows

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 PaymentFlows.

Parameters:



120
121
122
# File 'lib/modern_treasury/resources/payment_flows.rb', line 120

def initialize(client:)
  @client = client
end

Instance Method Details

#create(amount: , counterparty_id: , currency: , direction: , originating_account_id: , due_date: nil, request_options: {}) ⇒ ModernTreasury::Models::PaymentFlow

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

create payment_flow

Parameters:

  • amount (Integer)

    Required. Value in specified currency’s smallest unit. e.g. $10 would be represe

  • counterparty_id (String)

    Required. The ID of a counterparty associated with the payment. As part of the p

  • currency (String)

    Required. The currency of the payment.

  • direction (Symbol, ModernTreasury::Models::PaymentFlowCreateParams::Direction)

    Required. Describes the direction money is flowing in the transaction. Can only

  • originating_account_id (String)

    Required. The ID of one of your organization’s internal accounts.

  • due_date (Date)

    Optional. Can only be passed in when ‘effective_date_selection_enabled` is `true

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

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/modern_treasury/resources/payment_flows.rb', line 30

def create(params)
  parsed, options = ModernTreasury::PaymentFlowCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/payment_flows",
    body: parsed,
    model: ModernTreasury::PaymentFlow,
    options: options
  )
end

#list(after_cursor: nil, client_token: nil, counterparty_id: nil, originating_account_id: nil, payment_order_id: nil, per_page: nil, receiving_account_id: nil, status: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::PaymentFlow>

list payment_flows

Parameters:

  • after_cursor (String, nil)
  • client_token (String)
  • counterparty_id (String)
  • originating_account_id (String)
  • payment_order_id (String)
  • per_page (Integer)
  • receiving_account_id (String)
  • status (String)
  • request_options (ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



105
106
107
108
109
110
111
112
113
114
115
# File 'lib/modern_treasury/resources/payment_flows.rb', line 105

def list(params = {})
  parsed, options = ModernTreasury::PaymentFlowListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "api/payment_flows",
    query: parsed,
    page: ModernTreasury::Internal::Page,
    model: ModernTreasury::PaymentFlow,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ ModernTreasury::Models::PaymentFlow

get payment_flow

Parameters:

Returns:

See Also:



52
53
54
55
56
57
58
59
# File 'lib/modern_treasury/resources/payment_flows.rb', line 52

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["api/payment_flows/%1$s", id],
    model: ModernTreasury::PaymentFlow,
    options: params[:request_options]
  )
end

#update(id, status: , request_options: {}) ⇒ ModernTreasury::Models::PaymentFlow

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

update payment_flow

Parameters:

Returns:

See Also:



77
78
79
80
81
82
83
84
85
86
# File 'lib/modern_treasury/resources/payment_flows.rb', line 77

def update(id, params)
  parsed, options = ModernTreasury::PaymentFlowUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["api/payment_flows/%1$s", id],
    body: parsed,
    model: ModernTreasury::PaymentFlow,
    options: options
  )
end