Class: DevDraftAI::CreateStablePaymentIntentDto

Inherits:
Object
  • Object
show all
Defined in:
lib/devdraft/models/create_stable_payment_intent_dto.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateStablePaymentIntentDto

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 111

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `DevDraftAI::CreateStablePaymentIntentDto` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `DevDraftAI::CreateStablePaymentIntentDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'source_currency')
    self.source_currency = attributes[:'source_currency']
  end

  if attributes.key?(:'source_network')
    self.source_network = attributes[:'source_network']
  end

  if attributes.key?(:'destination_currency')
    self.destination_currency = attributes[:'destination_currency']
  end

  if attributes.key?(:'destination_network')
    self.destination_network = attributes[:'destination_network']
  end

  if attributes.key?(:'destination_address')
    self.destination_address = attributes[:'destination_address']
  end

  if attributes.key?(:'amount')
    self.amount = attributes[:'amount']
  end

  if attributes.key?(:'customer_first_name')
    self.customer_first_name = attributes[:'customer_first_name']
  end

  if attributes.key?(:'customer_last_name')
    self.customer_last_name = attributes[:'customer_last_name']
  end

  if attributes.key?(:'customer_email')
    self.customer_email = attributes[:'customer_email']
  end

  if attributes.key?(:'customer_address')
    self.customer_address = attributes[:'customer_address']
  end

  if attributes.key?(:'customer_country')
    self.customer_country = attributes[:'customer_country']
  end

  if attributes.key?(:'customer_country_iso')
    self.customer_country_iso = attributes[:'customer_country_iso']
  end

  if attributes.key?(:'customer_province')
    self.customer_province = attributes[:'customer_province']
  end

  if attributes.key?(:'customer_province_iso')
    self.customer_province_iso = attributes[:'customer_province_iso']
  end

  if attributes.key?(:'phone_number')
    self.phone_number = attributes[:'phone_number']
  end
end

Instance Attribute Details

#amountObject

Payment amount in the source currency. Omit for flexible amount payments where users specify the amount during checkout.



32
33
34
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 32

def amount
  @amount
end

#customer_addressObject

Customer’s full address. Required for compliance in certain jurisdictions and high-value transactions.



44
45
46
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 44

def customer_address
  @customer_address
end

#customer_countryObject

Customer’s country of residence. Used for compliance and tax reporting.



47
48
49
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 47

def customer_country
  @customer_country
end

#customer_country_isoObject

Customer’s country ISO 3166-1 alpha-2 code. Used for automated compliance checks.



50
51
52
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 50

def customer_country_iso
  @customer_country_iso
end

#customer_emailObject

Customer’s email address. Used for transaction notifications and receipts. Highly recommended for all transactions.



41
42
43
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 41

def customer_email
  @customer_email
end

#customer_first_nameObject

Customer’s first name. Used for transaction records and compliance. Required for amounts over $1000.



35
36
37
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 35

def customer_first_name
  @customer_first_name
end

#customer_last_nameObject

Customer’s last name. Used for transaction records and compliance. Required for amounts over $1000.



38
39
40
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 38

def customer_last_name
  @customer_last_name
end

#customer_provinceObject

Customer’s state or province. Required for US and Canadian customers.



53
54
55
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 53

def customer_province
  @customer_province
end

#customer_province_isoObject

Customer’s state or province ISO code. Used for automated tax calculations.



56
57
58
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 56

def customer_province_iso
  @customer_province_iso
end

#destination_addressObject

The wallet address where converted funds will be sent. Supports Ethereum (0x…) and Solana address formats.



29
30
31
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 29

def destination_address
  @destination_address
end

#destination_currencyObject

The stablecoin currency to convert TO. If omitted, defaults to the same as source currency (cross-chain transfer).



23
24
25
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 23

def destination_currency
  @destination_currency
end

#destination_networkObject

The blockchain network where the converted currency will be delivered. Must support the destination currency.



26
27
28
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 26

def destination_network
  @destination_network
end

#phone_numberObject

Customer’s phone number with country code. Used for SMS notifications and verification.



59
60
61
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 59

def phone_number
  @phone_number
end

#source_currencyObject

The stablecoin currency to convert FROM. This is the currency the customer will pay with.



17
18
19
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 17

def source_currency
  @source_currency
end

#source_networkObject

The blockchain network where the source currency resides. Determines gas fees and transaction speed.



20
21
22
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 20

def source_network
  @source_network
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 62

def self.attribute_map
  {
    :'source_currency' => :'sourceCurrency',
    :'source_network' => :'sourceNetwork',
    :'destination_currency' => :'destinationCurrency',
    :'destination_network' => :'destinationNetwork',
    :'destination_address' => :'destinationAddress',
    :'amount' => :'amount',
    :'customer_first_name' => :'customer_first_name',
    :'customer_last_name' => :'customer_last_name',
    :'customer_email' => :'customer_email',
    :'customer_address' => :'customer_address',
    :'customer_country' => :'customer_country',
    :'customer_country_iso' => :'customer_countryISO',
    :'customer_province' => :'customer_province',
    :'customer_province_iso' => :'customer_provinceISO',
    :'phone_number' => :'phoneNumber'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



250
251
252
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 250

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



104
105
106
107
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 104

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 83

def self.openapi_types
  {
    :'source_currency' => :'Object',
    :'source_network' => :'Object',
    :'destination_currency' => :'Object',
    :'destination_network' => :'Object',
    :'destination_address' => :'Object',
    :'amount' => :'Object',
    :'customer_first_name' => :'Object',
    :'customer_last_name' => :'Object',
    :'customer_email' => :'Object',
    :'customer_address' => :'Object',
    :'customer_country' => :'Object',
    :'customer_country_iso' => :'Object',
    :'customer_province' => :'Object',
    :'customer_province_iso' => :'Object',
    :'phone_number' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 215

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      source_currency == o.source_currency &&
      source_network == o.source_network &&
      destination_currency == o.destination_currency &&
      destination_network == o.destination_network &&
      destination_address == o.destination_address &&
      amount == o.amount &&
      customer_first_name == o.customer_first_name &&
      customer_last_name == o.customer_last_name &&
      customer_email == o.customer_email &&
      customer_address == o.customer_address &&
      customer_country == o.customer_country &&
      customer_country_iso == o.customer_country_iso &&
      customer_province == o.customer_province &&
      customer_province_iso == o.customer_province_iso &&
      phone_number == o.phone_number
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 280

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    DevDraftAI.const_get(type).build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 349

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 257

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


237
238
239
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 237

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



243
244
245
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 243

def hash
  [source_currency, source_network, destination_currency, destination_network, destination_address, amount, customer_first_name, customer_last_name, customer_email, customer_address, customer_country, customer_country_iso, customer_province, customer_province_iso, phone_number].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 187

def list_invalid_properties
  invalid_properties = Array.new
  if @source_currency.nil?
    invalid_properties.push('invalid value for "source_currency", source_currency cannot be nil.')
  end

  if @source_network.nil?
    invalid_properties.push('invalid value for "source_network", source_network cannot be nil.')
  end

  if @destination_network.nil?
    invalid_properties.push('invalid value for "destination_network", destination_network cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



325
326
327
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 325

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 331

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



319
320
321
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 319

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



206
207
208
209
210
211
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 206

def valid?
  return false if @source_currency.nil?
  return false if @source_network.nil?
  return false if @destination_network.nil?
  true
end