Class: ThePlaidApi::WalletTransactionExecuteRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/wallet_transaction_execute_request.rb

Overview

WalletTransactionExecuteRequest defines the request schema for ‘/wallet/transaction/execute`

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(idempotency_key:, wallet_id:, counterparty:, amount:, reference:, client_id: SKIP, secret: SKIP, originating_fund_source: SKIP, additional_properties: nil) ⇒ WalletTransactionExecuteRequest

Returns a new instance of WalletTransactionExecuteRequest.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 91

def initialize(idempotency_key:, wallet_id:, counterparty:, amount:,
               reference:, client_id: SKIP, secret: SKIP,
               originating_fund_source: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @client_id = client_id unless client_id == SKIP
  @secret = secret unless secret == SKIP
  @idempotency_key = idempotency_key
  @wallet_id = wallet_id
  @counterparty = counterparty
  @amount = amount
  @reference = reference
  @originating_fund_source = originating_fund_source unless originating_fund_source == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountWalletTransactionAmount

The amount and currency of a transaction



47
48
49
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 47

def amount
  @amount
end

#client_idString

Your Plaid API ‘client_id`. The `client_id` is required and may be provided either in the `PLAID-CLIENT-ID` header or as part of a request body.

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 17

def client_id
  @client_id
end

#counterpartyWalletTransactionCounterparty

An object representing the e-wallet transaction’s counterparty



43
44
45
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 43

def counterparty
  @counterparty
end

#idempotency_keyString

A random key provided by the client, per unique wallet transaction. Maximum of 128 characters. The API supports idempotency for safely retrying requests without accidentally performing the same operation twice. If a request to execute a wallet transaction fails due to a network connection error, then after a minimum delay of one minute, you can retry the request with the same idempotency key to guarantee that only a single wallet transaction is created. If the request was successfully processed, it will prevent any transaction that uses the same idempotency key, and was received within 24 hours of the first request, from being processed.

Returns:

  • (String)


35
36
37
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 35

def idempotency_key
  @idempotency_key
end

#originating_fund_sourceOriginatingFundSource

The original source of the funds. This field is required by local regulation for certain businesses (e.g. money remittance) to send payouts to recipients in the EU and UK.



59
60
61
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 59

def originating_fund_source
  @originating_fund_source
end

#referenceString

A reference for the transaction. This must be an alphanumeric string with 6 to 18 characters and must not contain any special characters or spaces. Ensure that the ‘reference` field is unique for each transaction.

Returns:

  • (String)


53
54
55
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 53

def reference
  @reference
end

#secretString

Your Plaid API ‘secret`. The `secret` is required and may be provided either in the `PLAID-SECRET` header or as part of a request body.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 22

def secret
  @secret
end

#wallet_idString

The ID of the e-wallet to debit from

Returns:

  • (String)


39
40
41
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 39

def wallet_id
  @wallet_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 109

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  idempotency_key =
    hash.key?('idempotency_key') ? hash['idempotency_key'] : nil
  wallet_id = hash.key?('wallet_id') ? hash['wallet_id'] : nil
  counterparty = WalletTransactionCounterparty.from_hash(hash['counterparty']) if
    hash['counterparty']
  amount = WalletTransactionAmount.from_hash(hash['amount']) if hash['amount']
  reference = hash.key?('reference') ? hash['reference'] : nil
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  originating_fund_source = OriginatingFundSource.from_hash(hash['originating_fund_source']) if
    hash['originating_fund_source']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  WalletTransactionExecuteRequest.new(idempotency_key: idempotency_key,
                                      wallet_id: wallet_id,
                                      counterparty: counterparty,
                                      amount: amount,
                                      reference: reference,
                                      client_id: client_id,
                                      secret: secret,
                                      originating_fund_source: originating_fund_source,
                                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 62

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['idempotency_key'] = 'idempotency_key'
  @_hash['wallet_id'] = 'wallet_id'
  @_hash['counterparty'] = 'counterparty'
  @_hash['amount'] = 'amount'
  @_hash['reference'] = 'reference'
  @_hash['originating_fund_source'] = 'originating_fund_source'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
88
89
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 85

def self.nullables
  %w[
    originating_fund_source
  ]
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
82
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 76

def self.optionals
  %w[
    client_id
    secret
    originating_fund_source
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



154
155
156
157
158
159
160
161
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 154

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id.inspect}, secret: #{@secret.inspect},"\
  " idempotency_key: #{@idempotency_key.inspect}, wallet_id: #{@wallet_id.inspect},"\
  " counterparty: #{@counterparty.inspect}, amount: #{@amount.inspect}, reference:"\
  " #{@reference.inspect}, originating_fund_source: #{@originating_fund_source.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



145
146
147
148
149
150
151
# File 'lib/the_plaid_api/models/wallet_transaction_execute_request.rb', line 145

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id}, secret: #{@secret}, idempotency_key:"\
  " #{@idempotency_key}, wallet_id: #{@wallet_id}, counterparty: #{@counterparty}, amount:"\
  " #{@amount}, reference: #{@reference}, originating_fund_source:"\
  " #{@originating_fund_source}, additional_properties: #{@additional_properties}>"
end