Class: ThePlaidApi::PaymentInitiationPaymentReverseRequest

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

Overview

PaymentInitiationPaymentReverseRequest defines the request schema for ‘/payment_initiation/payment/reverse`

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(payment_id:, idempotency_key:, reference:, client_id: SKIP, secret: SKIP, amount: SKIP, counterparty_date_of_birth: SKIP, counterparty_address: SKIP, additional_properties: nil) ⇒ PaymentInitiationPaymentReverseRequest

Returns a new instance of PaymentInitiationPaymentReverseRequest.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 94

def initialize(payment_id:, idempotency_key:, reference:, client_id: SKIP,
               secret: SKIP, amount: SKIP, counterparty_date_of_birth: SKIP,
               counterparty_address: 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
  @payment_id = payment_id
  @idempotency_key = idempotency_key
  @reference = reference
  @amount = amount unless amount == SKIP
  unless counterparty_date_of_birth == SKIP
    @counterparty_date_of_birth =
      counterparty_date_of_birth
  end
  @counterparty_address = counterparty_address unless counterparty_address == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountPaymentAmountToRefund

The amount and currency of a payment



48
49
50
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 48

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/payment_initiation_payment_reverse_request.rb', line 17

def client_id
  @client_id
end

#counterparty_addressPaymentInitiationAddress

The optional address of the payment recipient’s bank account. Required by most institutions outside of the UK.



58
59
60
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 58

def counterparty_address
  @counterparty_address
end

#counterparty_date_of_birthDate

The counterparty’s birthdate, in [ISO 8601](wikipedia.org/wiki/ISO_8601) (YYYY-MM-DD) format.

Returns:

  • (Date)


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

def counterparty_date_of_birth
  @counterparty_date_of_birth
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)


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

def idempotency_key
  @idempotency_key
end

#payment_idString

The ID of the payment to reverse

Returns:

  • (String)


26
27
28
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 26

def payment_id
  @payment_id
end

#referenceString

A reference for the refund. This must be an alphanumeric string with 6 to 18 characters and must not contain any special characters or spaces.

Returns:

  • (String)


44
45
46
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 44

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/payment_initiation_payment_reverse_request.rb', line 22

def secret
  @secret
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
143
144
145
146
147
148
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 115

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_id = hash.key?('payment_id') ? hash['payment_id'] : nil
  idempotency_key =
    hash.key?('idempotency_key') ? hash['idempotency_key'] : nil
  reference = hash.key?('reference') ? hash['reference'] : nil
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  amount = PaymentAmountToRefund.from_hash(hash['amount']) if hash['amount']
  counterparty_date_of_birth =
    hash.key?('counterparty_date_of_birth') ? hash['counterparty_date_of_birth'] : SKIP
  counterparty_address = PaymentInitiationAddress.from_hash(hash['counterparty_address']) if
    hash['counterparty_address']

  # 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.
  PaymentInitiationPaymentReverseRequest.new(payment_id: payment_id,
                                             idempotency_key: idempotency_key,
                                             reference: reference,
                                             client_id: client_id,
                                             secret: secret,
                                             amount: amount,
                                             counterparty_date_of_birth: counterparty_date_of_birth,
                                             counterparty_address: counterparty_address,
                                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['payment_id'] = 'payment_id'
  @_hash['idempotency_key'] = 'idempotency_key'
  @_hash['reference'] = 'reference'
  @_hash['amount'] = 'amount'
  @_hash['counterparty_date_of_birth'] = 'counterparty_date_of_birth'
  @_hash['counterparty_address'] = 'counterparty_address'
  @_hash
end

.nullablesObject

An array for nullable fields



86
87
88
89
90
91
92
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 86

def self.nullables
  %w[
    amount
    counterparty_date_of_birth
    counterparty_address
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    client_id
    secret
    amount
    counterparty_date_of_birth
    counterparty_address
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



160
161
162
163
164
165
166
167
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 160

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

#to_sObject

Provides a human-readable string representation of the object.



151
152
153
154
155
156
157
# File 'lib/the_plaid_api/models/payment_initiation_payment_reverse_request.rb', line 151

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