Class: Devdraft::CreateStablePaymentIntentDto

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CreateStablePaymentIntentDto

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 145

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

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

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

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

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

  if attributes.key?(:'destination_network')
    self.destination_network = attributes[:'destination_network']
  else
    self.destination_network = nil
  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.



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

def amount
  @amount
end

#customer_addressObject

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



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

def customer_address
  @customer_address
end

#customer_countryObject

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



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

def customer_country
  @customer_country
end

#customer_country_isoObject

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



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

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.



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

def customer_email
  @customer_email
end

#customer_first_nameObject

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



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

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.



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

def customer_last_name
  @customer_last_name
end

#customer_provinceObject

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



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

def customer_province
  @customer_province
end

#customer_province_isoObject

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



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

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.



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

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



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

def destination_currency
  @destination_currency
end

#destination_networkObject

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



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

def destination_network
  @destination_network
end

#phone_numberObject

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



61
62
63
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 61

def phone_number
  @phone_number
end

#source_currencyObject

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



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

def source_currency
  @source_currency
end

#source_networkObject

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



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

def source_network
  @source_network
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



107
108
109
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 107

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 112

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

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



537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 537

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif 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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



138
139
140
141
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 138

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

.openapi_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 117

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

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 502

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


524
525
526
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 524

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



530
531
532
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 530

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



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 228

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  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

  pattern = Regexp.new(/^\d+(\.\d{1,6})?$/)
  if !@amount.nil? && @amount !~ pattern
    invalid_properties.push("invalid value for \"amount\", must conform to the pattern #{pattern}.")
  end

  if !@customer_first_name.nil? && @customer_first_name.to_s.length > 100
    invalid_properties.push('invalid value for "customer_first_name", the character length must be smaller than or equal to 100.')
  end

  if !@customer_last_name.nil? && @customer_last_name.to_s.length > 100
    invalid_properties.push('invalid value for "customer_last_name", the character length must be smaller than or equal to 100.')
  end

  if !@customer_email.nil? && @customer_email.to_s.length > 255
    invalid_properties.push('invalid value for "customer_email", the character length must be smaller than or equal to 255.')
  end

  if !@customer_address.nil? && @customer_address.to_s.length > 500
    invalid_properties.push('invalid value for "customer_address", the character length must be smaller than or equal to 500.')
  end

  if !@customer_country.nil? && @customer_country.to_s.length > 100
    invalid_properties.push('invalid value for "customer_country", the character length must be smaller than or equal to 100.')
  end

  if !@customer_country_iso.nil? && @customer_country_iso.to_s.length > 2
    invalid_properties.push('invalid value for "customer_country_iso", the character length must be smaller than or equal to 2.')
  end

  pattern = Regexp.new(/^[A-Z]{2}$/)
  if !@customer_country_iso.nil? && @customer_country_iso !~ pattern
    invalid_properties.push("invalid value for \"customer_country_iso\", must conform to the pattern #{pattern}.")
  end

  if !@customer_province.nil? && @customer_province.to_s.length > 100
    invalid_properties.push('invalid value for "customer_province", the character length must be smaller than or equal to 100.')
  end

  if !@customer_province_iso.nil? && @customer_province_iso.to_s.length > 10
    invalid_properties.push('invalid value for "customer_province_iso", the character length must be smaller than or equal to 10.')
  end

  if !@phone_number.nil? && @phone_number.to_s.length > 20
    invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 20.')
  end

  pattern = Regexp.new(/^[+]?[\d\s\-\(\)]+$/)
  if !@phone_number.nil? && @phone_number !~ pattern
    invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 559

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/devdraft/models/create_stable_payment_intent_dto.rb', line 299

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @source_currency.nil?
  return false if @source_network.nil?
  return false if @destination_network.nil?
  return false if !@amount.nil? && @amount !~ Regexp.new(/^\d+(\.\d{1,6})?$/)
  return false if !@customer_first_name.nil? && @customer_first_name.to_s.length > 100
  return false if !@customer_last_name.nil? && @customer_last_name.to_s.length > 100
  return false if !@customer_email.nil? && @customer_email.to_s.length > 255
  return false if !@customer_address.nil? && @customer_address.to_s.length > 500
  return false if !@customer_country.nil? && @customer_country.to_s.length > 100
  return false if !@customer_country_iso.nil? && @customer_country_iso.to_s.length > 2
  return false if !@customer_country_iso.nil? && @customer_country_iso !~ Regexp.new(/^[A-Z]{2}$/)
  return false if !@customer_province.nil? && @customer_province.to_s.length > 100
  return false if !@customer_province_iso.nil? && @customer_province_iso.to_s.length > 10
  return false if !@phone_number.nil? && @phone_number.to_s.length > 20
  return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^[+]?[\d\s\-\(\)]+$/)
  true
end