Class: CityPayApiClient::PaymentIntentRequestModel

Inherits:
Object
  • Object
show all
Defined in:
lib/citypay_api_client/models/payment_intent_request_model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PaymentIntentRequestModel

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 129

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::PaymentIntentRequestModel` 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 `CityPayApiClient::PaymentIntentRequestModel`. 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?(:'adjustments')
    self.adjustments = attributes[:'adjustments']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'tag')
    if (value = attributes[:'tag']).is_a?(Array)
      self.tag = value
    end
  end

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

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

Instance Attribute Details

#adjustmentsObject

Returns the value of attribute adjustments.



18
19
20
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 18

def adjustments
  @adjustments
end

#amountObject

The amount to authorise in the lowest unit of currency with a variable length to a maximum of 12 digits. No decimal points are to be included and no divisional characters such as 1,024. The amount should be the total amount required for the transaction. For example with GBP £1,021.95 the amount value is 102195.



21
22
23
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 21

def amount
  @amount
end

#avs_postcode_policyObject

A policy value which determines whether an AVS postcode policy is enforced or bypassed. Values are: ‘0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the AVS postcode numeric value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the postcode did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send postcode details for authorisation.



24
25
26
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 24

def avs_postcode_policy
  @avs_postcode_policy
end

#bill_toObject

Returns the value of attribute bill_to.



26
27
28
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 26

def bill_to
  @bill_to
end

#csc_policyObject

A policy value which determines whether a CSC policy is enforced or bypassed. Values are: ‘0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the CSC value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the CSC did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send the CSC details for authorisation.



29
30
31
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 29

def csc_policy
  @csc_policy
end

#currencyObject

The processing currency for the transaction. Will default to the merchant account currency.



32
33
34
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 32

def currency
  @currency
end

#duplicate_policyObject

A policy value which determines whether a duplication policy is enforced or bypassed. A duplication check has a window of time set against your account within which it can action. If a previous transaction with matching values occurred within the window, any subsequent transaction will result in a T001 result. Values are ‘0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be checked for duplication within the duplication window. `2` to bypass. Transactions that are bypassed will not be checked for duplication within the duplication window. `3` to ignore. Transactions that are ignored will have the same affect as bypass.



35
36
37
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 35

def duplicate_policy
  @duplicate_policy
end

#external_refObject

A unique identifier, such as an order ID or invoice number, provided by your accounting or billing system to link the payment intent with an external system reference. This ensures traceability across systems for audits and transaction validation.



38
39
40
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 38

def external_ref
  @external_ref
end

#external_ref_sourceObject

Specifies the originating source or system of the external reference, helping to categorise and trace the context of the external identifier, whether it comes from an internal system, third-party vendor, or external financial platform.



41
42
43
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 41

def external_ref_source
  @external_ref_source
end

#identifierObject

The identifier of the transaction to process. The value should be a valid reference and may be used to perform post processing actions and to aid in reconciliation of transactions. The value should be a valid printable string with ASCII character ranges from 0x32 to 0x127. The identifier is recommended to be distinct for each transaction such as a [random unique identifier](en.wikipedia.org/wiki/Universally_unique_identifier) this will aid in ensuring each transaction is identifiable. When transactions are processed they are also checked for duplicate requests. Changing the identifier on a subsequent request will ensure that a transaction is considered as different.



44
45
46
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 44

def identifier
  @identifier
end

#match_avsaObject

A policy value which determines whether an AVS address policy is enforced, bypassed or ignored. Values are: ‘0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the AVS address numeric value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the address did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send address numeric details for authorisation.



47
48
49
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 47

def match_avsa
  @match_avsa
end

#merchantidObject

The merchant id of the intent, required if using the API key or not required if using a domain key.



50
51
52
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 50

def merchantid
  @merchantid
end

#pre_authObject

A policy value which determines whether a pre auth policy is enforced or bypassed. Values are: ‘0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Enforces pre-authorisation when it does not pre-auth by default. `2` to bypass. Bypasses pre-authorisation when it is enabled to pre auth by default. `3` to ignore. The same as the default policy (0). Although it currently mirrors the default, this option is included for compatibility with other policies.



53
54
55
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 53

def pre_auth
  @pre_auth
end

#ship_toObject

Returns the value of attribute ship_to.



55
56
57
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 55

def ship_to
  @ship_to
end

#tagObject

Returns the value of attribute tag.



57
58
59
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 57

def tag
  @tag
end

#trans_infoObject

Further information that can be added to the transaction will display in reporting. Can be used for flexible values such as operator id.



60
61
62
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 60

def trans_info
  @trans_info
end

#trans_typeObject

The type of transaction being submitted. Normally this value is not required and your account manager may request that you set this field.



63
64
65
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 63

def trans_type
  @trans_type
end

Class Method Details

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



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 405

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = CityPayApiClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



89
90
91
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 89

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



94
95
96
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 94

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 66

def self.attribute_map
  {
    :'adjustments' => :'adjustments',
    :'amount' => :'amount',
    :'avs_postcode_policy' => :'avs_postcode_policy',
    :'bill_to' => :'bill_to',
    :'csc_policy' => :'csc_policy',
    :'currency' => :'currency',
    :'duplicate_policy' => :'duplicate_policy',
    :'external_ref' => :'external-ref',
    :'external_ref_source' => :'external-ref-source',
    :'identifier' => :'identifier',
    :'match_avsa' => :'match_avsa',
    :'merchantid' => :'merchantid',
    :'pre_auth' => :'pre_auth',
    :'ship_to' => :'ship_to',
    :'tag' => :'tag',
    :'trans_info' => :'trans_info',
    :'trans_type' => :'trans_type'
  }
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



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 381

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



122
123
124
125
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 122

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

.openapi_typesObject

Attribute type mapping.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 99

def self.openapi_types
  {
    :'adjustments' => :'Adjustments',
    :'amount' => :'Integer',
    :'avs_postcode_policy' => :'String',
    :'bill_to' => :'ContactDetails',
    :'csc_policy' => :'String',
    :'currency' => :'String',
    :'duplicate_policy' => :'String',
    :'external_ref' => :'String',
    :'external_ref_source' => :'String',
    :'identifier' => :'String',
    :'match_avsa' => :'String',
    :'merchantid' => :'Integer',
    :'pre_auth' => :'String',
    :'ship_to' => :'ContactDetails',
    :'tag' => :'Array<String>',
    :'trans_info' => :'String',
    :'trans_type' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 344

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      adjustments == o.adjustments &&
      amount == o.amount &&
      avs_postcode_policy == o.avs_postcode_policy &&
      bill_to == o.bill_to &&
      csc_policy == o.csc_policy &&
      currency == o.currency &&
      duplicate_policy == o.duplicate_policy &&
      external_ref == o.external_ref &&
      external_ref_source == o.external_ref_source &&
      identifier == o.identifier &&
      match_avsa == o.match_avsa &&
      merchantid == o.merchantid &&
      pre_auth == o.pre_auth &&
      ship_to == o.ship_to &&
      tag == o.tag &&
      trans_info == o.trans_info &&
      trans_type == o.trans_type
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



476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 476

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


368
369
370
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 368

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



374
375
376
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 374

def hash
  [adjustments, amount, avs_postcode_policy, bill_to, csc_policy, currency, duplicate_policy, external_ref, external_ref_source, identifier, match_avsa, merchantid, pre_auth, ship_to, tag, trans_info, trans_type].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



220
221
222
223
224
225
226
227
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
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 220

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @amount.nil?
    invalid_properties.push('invalid value for "amount", amount cannot be nil.')
  end

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

  if !@currency.nil? && @currency.to_s.length < 3
    invalid_properties.push('invalid value for "currency", the character length must be greater than or equal to 3.')
  end

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

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

  if @identifier.to_s.length > 50
    invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 50.')
  end

  if @identifier.to_s.length < 4
    invalid_properties.push('invalid value for "identifier", the character length must be greater than or equal to 4.')
  end

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

  if !@trans_type.nil? && @trans_type.to_s.length > 1
    invalid_properties.push('invalid value for "trans_type", the character length must be smaller than or equal to 1.')
  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



452
453
454
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 452

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



458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 458

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



446
447
448
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 446

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



264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/citypay_api_client/models/payment_intent_request_model.rb', line 264

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @amount.nil?
  return false if !@currency.nil? && @currency.to_s.length > 3
  return false if !@currency.nil? && @currency.to_s.length < 3
  return false if !@external_ref.nil? && @external_ref.to_s.length > 256
  return false if @identifier.nil?
  return false if @identifier.to_s.length > 50
  return false if @identifier.to_s.length < 4
  return false if !@trans_info.nil? && @trans_info.to_s.length > 50
  return false if !@trans_type.nil? && @trans_type.to_s.length > 1
  true
end