Class: ModernTreasury::Resources::PaymentOrders

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/resources/payment_orders.rb,
lib/modern_treasury/resources/payment_orders/reversals.rb

Defined Under Namespace

Classes: Reversals

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PaymentOrders

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

Parameters:



378
379
380
381
# File 'lib/modern_treasury/resources/payment_orders.rb', line 378

def initialize(client:)
  @client = client
  @reversals = ModernTreasury::Resources::PaymentOrders::Reversals.new(client: client)
end

Instance Attribute Details

#reversalsModernTreasury::Resources::PaymentOrders::Reversals (readonly)



7
8
9
# File 'lib/modern_treasury/resources/payment_orders.rb', line 7

def reversals
  @reversals
end

Instance Method Details

#create(amount: , direction: , originating_account_id: , type: , accounting: nil, accounting_category_id: nil, accounting_ledger_class_id: nil, charge_bearer: nil, currency: nil, description: nil, documents: nil, effective_date: nil, expires_at: nil, fallback_type: nil, foreign_exchange_contract: nil, foreign_exchange_indicator: nil, ledger_transaction: nil, ledger_transaction_id: nil, line_items: nil, metadata: nil, nsf_protected: nil, originating_party_name: nil, priority: nil, process_after: nil, purpose: nil, receiving_account: nil, receiving_account_id: nil, reconciliation_status: nil, remittance_information: nil, send_remittance_advice: nil, statement_descriptor: nil, subtype: nil, transaction_monitoring_enabled: nil, ultimate_originating_party_identifier: nil, ultimate_originating_party_name: nil, ultimate_receiving_party_identifier: nil, ultimate_receiving_party_name: nil, request_options: {}) ⇒ ModernTreasury::Models::PaymentOrder

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

Create a new Payment Order

Parameters:

  • amount (Integer)

    Value in specified currency’s smallest unit. e.g. $10 would be represented as 10

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

    One of ‘credit`, `debit`. Describes the direction money is flowing in the transa

  • originating_account_id (String)

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

  • type (Symbol, ModernTreasury::Models::PaymentOrderType)

    One of ‘ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sep

  • accounting (ModernTreasury::Models::PaymentOrderCreateParams::Accounting)
  • accounting_category_id (String, nil)

    The ID of one of your accounting categories. Note that these will only be access

  • accounting_ledger_class_id (String, nil)

    The ID of one of your accounting ledger classes. Note that these will only be ac

  • charge_bearer (Symbol, ModernTreasury::Models::PaymentOrderCreateParams::ChargeBearer, nil)

    The party that will pay the fees for the payment order. See docs.modernt

  • currency (Symbol, ModernTreasury::Models::Currency)

    Defaults to the currency of the originating account.

  • description (String, nil)

    An optional description for internal use.

  • documents (Array<ModernTreasury::Models::PaymentOrderCreateParams::Document>)

    An array of documents to be attached to the payment order. Note that if you atta

  • effective_date (Date)

    Date transactions are to be posted to the participants’ account. Defaults to the

  • expires_at (Time, nil)

    RFP payments require an expires_at. This value must be past the effective_date.

  • fallback_type (Symbol, ModernTreasury::Models::PaymentOrderCreateParams::FallbackType)

    A payment type to fallback to if the original type is not valid for the receivin

  • foreign_exchange_contract (String, nil)

    If present, indicates a specific foreign exchange contract number that has been

  • foreign_exchange_indicator (Symbol, ModernTreasury::Models::PaymentOrderCreateParams::ForeignExchangeIndicator, nil)

    Indicates the type of FX transfer to initiate, can be either ‘variable_to_fixed`

  • ledger_transaction (ModernTreasury::Models::LedgerTransactionCreateRequest)

    Specifies a ledger transaction object that will be created with the payment orde

  • ledger_transaction_id (String)

    Either ledger_transaction or ledger_transaction_id can be provided. Only a pendi

  • line_items (Array<ModernTreasury::Models::PaymentOrderCreateParams::LineItem>)

    An array of line items that must sum up to the amount of the payment order.

  • metadata (Hash{Symbol=>String})

    Additional data represented as key-value pairs. Both the key and value must be s

  • nsf_protected (Boolean)

    A boolean to determine if NSF Protection is enabled for this payment order. Note

  • originating_party_name (String, nil)

    If present, this will replace your default company name on receiver’s bank state

  • priority (Symbol, ModernTreasury::Models::PaymentOrderCreateParams::Priority)

    Either ‘normal` or `high`. For ACH and EFT payments, `high` represents a same-da

  • process_after (Time, nil)

    If present, Modern Treasury will not process the payment until after this time.

  • purpose (String, nil)

    For ‘wire`, this is usually the purpose which is transmitted via the “InstrForDb

  • receiving_account (ModernTreasury::Models::PaymentOrderCreateParams::ReceivingAccount)

    Either ‘receiving_account` or `receiving_account_id` must be present. When using

  • receiving_account_id (String)

    Either ‘receiving_account` or `receiving_account_id` must be present. When using

  • reconciliation_status (Symbol, ModernTreasury::Models::PaymentOrderCreateParams::ReconciliationStatus)

    One of ‘unreconciled`, `tentatively_reconciled` or `reconciled`.

  • remittance_information (String, nil)

    For ‘ach`, this field will be passed through on an addenda record. For `wire` pa

  • send_remittance_advice (Boolean, nil)

    Send an email to the counterparty when the payment order is sent to the bank. If

  • statement_descriptor (String, nil)

    An optional descriptor which will appear in the receiver’s statement. For ‘check

  • subtype (Symbol, ModernTreasury::Models::PaymentOrderSubtype, nil)

    An additional layer of classification for the type of payment order you are doin

  • transaction_monitoring_enabled (Boolean)

    A flag that determines whether a payment order should go through transaction mon

  • ultimate_originating_party_identifier (String, nil)

    Identifier of the ultimate originator of the payment order.

  • ultimate_originating_party_name (String, nil)

    Name of the ultimate originator of the payment order.

  • ultimate_receiving_party_identifier (String, nil)

    Identifier of the ultimate funds recipient.

  • ultimate_receiving_party_name (String, nil)

    Name of the ultimate funds recipient.

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

Returns:

See Also:



95
96
97
98
99
100
101
102
103
104
# File 'lib/modern_treasury/resources/payment_orders.rb', line 95

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

#create_async(amount: , direction: , originating_account_id: , type: , accounting: nil, accounting_category_id: nil, accounting_ledger_class_id: nil, charge_bearer: nil, currency: nil, description: nil, effective_date: nil, expires_at: nil, fallback_type: nil, foreign_exchange_contract: nil, foreign_exchange_indicator: nil, ledger_transaction: nil, ledger_transaction_id: nil, line_items: nil, metadata: nil, nsf_protected: nil, originating_party_name: nil, priority: nil, process_after: nil, purpose: nil, receiving_account: nil, receiving_account_id: nil, reconciliation_status: nil, remittance_information: nil, send_remittance_advice: nil, statement_descriptor: nil, subtype: nil, transaction_monitoring_enabled: nil, ultimate_originating_party_identifier: nil, ultimate_originating_party_name: nil, ultimate_receiving_party_identifier: nil, ultimate_receiving_party_name: nil, request_options: {}) ⇒ ModernTreasury::Models::AsyncResponse

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

Create a new payment order asynchronously

Parameters:

  • amount (Integer)

    Value in specified currency’s smallest unit. e.g. $10 would be represented as 10

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

    One of ‘credit`, `debit`. Describes the direction money is flowing in the transa

  • originating_account_id (String)

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

  • type (Symbol, ModernTreasury::Models::PaymentOrderType)

    One of ‘ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sep

  • accounting (ModernTreasury::Models::PaymentOrderCreateAsyncParams::Accounting)
  • accounting_category_id (String, nil)

    The ID of one of your accounting categories. Note that these will only be access

  • accounting_ledger_class_id (String, nil)

    The ID of one of your accounting ledger classes. Note that these will only be ac

  • charge_bearer (Symbol, ModernTreasury::Models::PaymentOrderCreateAsyncParams::ChargeBearer, nil)

    The party that will pay the fees for the payment order. See docs.modernt

  • currency (Symbol, ModernTreasury::Models::Currency)

    Defaults to the currency of the originating account.

  • description (String, nil)

    An optional description for internal use.

  • effective_date (Date)

    Date transactions are to be posted to the participants’ account. Defaults to the

  • expires_at (Time, nil)

    RFP payments require an expires_at. This value must be past the effective_date.

  • fallback_type (Symbol, ModernTreasury::Models::PaymentOrderCreateAsyncParams::FallbackType)

    A payment type to fallback to if the original type is not valid for the receivin

  • foreign_exchange_contract (String, nil)

    If present, indicates a specific foreign exchange contract number that has been

  • foreign_exchange_indicator (Symbol, ModernTreasury::Models::PaymentOrderCreateAsyncParams::ForeignExchangeIndicator, nil)

    Indicates the type of FX transfer to initiate, can be either ‘variable_to_fixed`

  • ledger_transaction (ModernTreasury::Models::LedgerTransactionCreateRequest)

    Specifies a ledger transaction object that will be created with the payment orde

  • ledger_transaction_id (String)

    Either ledger_transaction or ledger_transaction_id can be provided. Only a pendi

  • line_items (Array<ModernTreasury::Models::PaymentOrderCreateAsyncParams::LineItem>)

    An array of line items that must sum up to the amount of the payment order.

  • metadata (Hash{Symbol=>String})

    Additional data represented as key-value pairs. Both the key and value must be s

  • nsf_protected (Boolean)

    A boolean to determine if NSF Protection is enabled for this payment order. Note

  • originating_party_name (String, nil)

    If present, this will replace your default company name on receiver’s bank state

  • priority (Symbol, ModernTreasury::Models::PaymentOrderCreateAsyncParams::Priority)

    Either ‘normal` or `high`. For ACH and EFT payments, `high` represents a same-da

  • process_after (Time, nil)

    If present, Modern Treasury will not process the payment until after this time.

  • purpose (String, nil)

    For ‘wire`, this is usually the purpose which is transmitted via the “InstrForDb

  • receiving_account (ModernTreasury::Models::PaymentOrderCreateAsyncParams::ReceivingAccount)

    Either ‘receiving_account` or `receiving_account_id` must be present. When using

  • receiving_account_id (String)

    Either ‘receiving_account` or `receiving_account_id` must be present. When using

  • reconciliation_status (Symbol, ModernTreasury::Models::PaymentOrderCreateAsyncParams::ReconciliationStatus)

    One of ‘unreconciled`, `tentatively_reconciled` or `reconciled`.

  • remittance_information (String, nil)

    For ‘ach`, this field will be passed through on an addenda record. For `wire` pa

  • send_remittance_advice (Boolean, nil)

    Send an email to the counterparty when the payment order is sent to the bank. If

  • statement_descriptor (String, nil)

    An optional descriptor which will appear in the receiver’s statement. For ‘check

  • subtype (Symbol, ModernTreasury::Models::PaymentOrderSubtype, nil)

    An additional layer of classification for the type of payment order you are doin

  • transaction_monitoring_enabled (Boolean)

    A flag that determines whether a payment order should go through transaction mon

  • ultimate_originating_party_identifier (String, nil)

    Identifier of the ultimate originator of the payment order.

  • ultimate_originating_party_name (String, nil)

    Name of the ultimate originator of the payment order.

  • ultimate_receiving_party_identifier (String, nil)

    Identifier of the ultimate funds recipient.

  • ultimate_receiving_party_name (String, nil)

    Name of the ultimate funds recipient.

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

Returns:

See Also:



364
365
366
367
368
369
370
371
372
373
# File 'lib/modern_treasury/resources/payment_orders.rb', line 364

def create_async(params)
  parsed, options = ModernTreasury::PaymentOrderCreateAsyncParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/payment_orders/create_async",
    body: parsed,
    model: ModernTreasury::AsyncResponse,
    options: options
  )
end

#list(after_cursor: nil, counterparty_id: nil, created_at_end: nil, created_at_start: nil, direction: nil, effective_date_end: nil, effective_date_start: nil, external_id: nil, metadata: nil, originating_account_id: nil, per_page: nil, priority: nil, process_after_end: nil, process_after_start: nil, reference_number: nil, status: nil, transaction_id: nil, type: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::PaymentOrder>

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

Get a list of all payment orders

Parameters:

  • after_cursor (String, nil)
  • counterparty_id (String)
  • created_at_end (Date)

    An inclusive upper bound for searching created_at

  • created_at_start (Date)

    An inclusive lower bound for searching created_at

  • direction (Symbol, ModernTreasury::Models::TransactionDirection)
  • effective_date_end (Date)

    An inclusive upper bound for searching effective_date

  • effective_date_start (Date)

    An inclusive lower bound for searching effective_date

  • external_id (String)
  • metadata (Hash{Symbol=>String})

    For example, if you want to query for records with metadata key ‘Type` and value

  • originating_account_id (String)
  • per_page (Integer)
  • priority (Symbol, ModernTreasury::Models::PaymentOrderListParams::Priority)

    Either ‘normal` or `high`. For ACH and EFT payments, `high` represents a same-da

  • process_after_end (Time)

    An inclusive upper bound for searching process_after

  • process_after_start (Time)

    An inclusive lower bound for searching process_after

  • reference_number (String)

    Query for records with the provided reference number

  • status (Symbol, ModernTreasury::Models::PaymentOrderListParams::Status)
  • transaction_id (String)

    The ID of a transaction that the payment order has been reconciled to.

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

Returns:

See Also:



268
269
270
271
272
273
274
275
276
277
278
# File 'lib/modern_treasury/resources/payment_orders.rb', line 268

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

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

Get details on a single payment order

Parameters:

Returns:

See Also:



116
117
118
119
120
121
122
123
# File 'lib/modern_treasury/resources/payment_orders.rb', line 116

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

#update(id, accounting: nil, accounting_category_id: nil, accounting_ledger_class_id: nil, amount: nil, charge_bearer: nil, counterparty_id: nil, currency: nil, description: nil, direction: nil, effective_date: nil, expires_at: nil, fallback_type: nil, foreign_exchange_contract: nil, foreign_exchange_indicator: nil, line_items: nil, metadata: nil, nsf_protected: nil, originating_account_id: nil, originating_party_name: nil, priority: nil, process_after: nil, purpose: nil, receiving_account: nil, receiving_account_id: nil, reconciliation_status: nil, remittance_information: nil, send_remittance_advice: nil, statement_descriptor: nil, status: nil, subtype: nil, type: nil, ultimate_originating_party_identifier: nil, ultimate_originating_party_name: nil, ultimate_receiving_party_identifier: nil, ultimate_receiving_party_name: nil, request_options: {}) ⇒ ModernTreasury::Models::PaymentOrder

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

Update a payment order

Parameters:

  • id (String)
  • accounting (ModernTreasury::Models::PaymentOrderUpdateParams::Accounting)
  • accounting_category_id (String, nil)

    The ID of one of your accounting categories. Note that these will only be access

  • accounting_ledger_class_id (String, nil)

    The ID of one of your accounting ledger classes. Note that these will only be ac

  • amount (Integer)

    Value in specified currency’s smallest unit. e.g. $10 would be represented as 10

  • charge_bearer (Symbol, ModernTreasury::Models::PaymentOrderUpdateParams::ChargeBearer, nil)

    The party that will pay the fees for the payment order. See docs.modernt

  • counterparty_id (String, nil)

    Required when receiving_account_id is passed the ID of an external account.

  • currency (Symbol, ModernTreasury::Models::Currency)

    Defaults to the currency of the originating account.

  • description (String, nil)

    An optional description for internal use.

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

    One of ‘credit`, `debit`. Describes the direction money is flowing in the transa

  • effective_date (Date)

    Date transactions are to be posted to the participants’ account. Defaults to the

  • expires_at (Time, nil)

    RFP payments require an expires_at. This value must be past the effective_date.

  • fallback_type (Symbol, ModernTreasury::Models::PaymentOrderUpdateParams::FallbackType)

    A payment type to fallback to if the original type is not valid for the receivin

  • foreign_exchange_contract (String, nil)

    If present, indicates a specific foreign exchange contract number that has been

  • foreign_exchange_indicator (Symbol, ModernTreasury::Models::PaymentOrderUpdateParams::ForeignExchangeIndicator, nil)

    Indicates the type of FX transfer to initiate, can be either ‘variable_to_fixed`

  • line_items (Array<ModernTreasury::Models::PaymentOrderUpdateParams::LineItem>)

    An array of line items that must sum up to the amount of the payment order.

  • metadata (Hash{Symbol=>String})

    Additional data represented as key-value pairs. Both the key and value must be s

  • nsf_protected (Boolean)

    A boolean to determine if NSF Protection is enabled for this payment order. Note

  • originating_account_id (String)

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

  • originating_party_name (String, nil)

    If present, this will replace your default company name on receiver’s bank state

  • priority (Symbol, ModernTreasury::Models::PaymentOrderUpdateParams::Priority)

    Either ‘normal` or `high`. For ACH and EFT payments, `high` represents a same-da

  • process_after (Time, nil)

    If present, Modern Treasury will not process the payment until after this time.

  • purpose (String, nil)

    For ‘wire`, this is usually the purpose which is transmitted via the “InstrForDb

  • receiving_account (ModernTreasury::Models::PaymentOrderUpdateParams::ReceivingAccount)

    Either ‘receiving_account` or `receiving_account_id` must be present. When using

  • receiving_account_id (String)

    Either ‘receiving_account` or `receiving_account_id` must be present. When using

  • reconciliation_status (Symbol, ModernTreasury::Models::PaymentOrderUpdateParams::ReconciliationStatus)

    One of ‘unreconciled`, `tentatively_reconciled` or `reconciled`.

  • remittance_information (String, nil)

    For ‘ach`, this field will be passed through on an addenda record. For `wire` pa

  • send_remittance_advice (Boolean, nil)

    Send an email to the counterparty when the payment order is sent to the bank. If

  • statement_descriptor (String, nil)

    An optional descriptor which will appear in the receiver’s statement. For ‘check

  • status (Symbol, ModernTreasury::Models::PaymentOrderUpdateParams::Status)

    To cancel a payment order, use ‘cancelled`. To redraft a returned payment order,

  • subtype (Symbol, ModernTreasury::Models::PaymentOrderSubtype, nil)

    An additional layer of classification for the type of payment order you are doin

  • type (Symbol, ModernTreasury::Models::PaymentOrderType)

    One of ‘ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sep

  • ultimate_originating_party_identifier (String, nil)

    This represents the identifier by which the person is known to the receiver when

  • ultimate_originating_party_name (String, nil)

    This represents the name of the person that the payment is on behalf of when usi

  • ultimate_receiving_party_identifier (String, nil)

    This represents the name of the merchant that the payment is being sent to when

  • ultimate_receiving_party_name (String, nil)

    This represents the identifier by which the merchant is known to the person init

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

Returns:

See Also:



209
210
211
212
213
214
215
216
217
218
# File 'lib/modern_treasury/resources/payment_orders.rb', line 209

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