Class: MethodRuby::Resources::Simulate::Accounts::Transactions

Inherits:
Object
  • Object
show all
Defined in:
lib/method_ruby/resources/simulate/accounts/transactions.rb

Overview

Sandbox account simulation

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Transactions

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

Parameters:



53
54
55
# File 'lib/method_ruby/resources/simulate/accounts/transactions.rb', line 53

def initialize(client:)
  @client = client
end

Instance Method Details

#create(account_id, amount:, method_version:, merchant_name: nil, type: nil, request_options: {}) ⇒ MethodRuby::Models::Simulate::Accounts::TransactionCreateResponse

Some parameter documentations has been truncated, see Models::Simulate::Accounts::TransactionCreateParams for more details.

Creates a simulated transaction on an account in the sandbox environment. Use this to test transaction-related flows during development.

**Development only** - This endpoint is only available in the sandbox environment.

Parameters:

  • account_id (String)

    Path param: Unique identifier for the account.

  • amount (Integer)

    Body param: Transaction amount in cents.

  • method_version (Symbol, MethodRuby::Models::Simulate::Accounts::TransactionCreateParams::MethodVersion)

    Header param: API version to use for this request. This spec targets ‘2025-12-01

  • merchant_name (String)

    Body param: Merchant name for the simulated transaction.

  • type (String)

    Body param: The type of transaction to simulate.

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

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/method_ruby/resources/simulate/accounts/transactions.rb', line 36

def create(, params)
  parsed, options = MethodRuby::Simulate::Accounts::TransactionCreateParams.dump_request(params)
  header_params = {method_version: "method-version"}
  @client.request(
    method: :post,
    path: ["simulate/accounts/%1$s/transactions", ],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: MethodRuby::Models::Simulate::Accounts::TransactionCreateResponse,
    security: {secret_key: true},
    options: options
  )
end