Class: CityPayApiClient::DirectPostRequest

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DirectPostRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
261
262
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 148

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

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

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

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

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

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

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

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

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

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

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



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

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.



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

def avs_postcode_policy
  @avs_postcode_policy
end

#bill_toObject

Returns the value of attribute bill_to.



23
24
25
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 23

def bill_to
  @bill_to
end

#cardnumberObject

The card number (PAN) with a variable length to a maximum of 21 digits in numerical form. Any non numeric characters will be stripped out of the card number, this includes whitespace or separators internal of the provided value. The card number must be treated as sensitive data. We only provide an obfuscated value in logging and reporting. The plaintext value is encrypted in our database using AES 256 GMC bit encryption for settlement or refund purposes. When providing the card number to our gateway through the authorisation API you will be handling the card data on your application. This will require further PCI controls to be in place and this value must never be stored.



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

def cardnumber
  @cardnumber
end

#cscObject

The Card Security Code (CSC) (also known as CV2/CVV2) is normally found on the back of the card (American Express has it on the front). The value helps to identify possession of the card as it is not available within the chip or magnetic swipe. When forwarding the CSC, please ensure the value is a string as some values start with 0 and this will be stripped out by any integer parsing. The CSC number aids fraud prevention in Mail Order and Internet payments. Business rules are available on your account to identify whether to accept or decline transactions based on mismatched results of the CSC. The Payment Card Industry (PCI) requires that at no stage of a transaction should the CSC be stored. This applies to all entities handling card data. It should also not be used in any hashing process. CityPay do not store the value and have no method of retrieving the value once the transaction has been processed. For this reason, duplicate checking is unable to determine the CSC in its duplication check algorithm.



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

def csc
  @csc
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.



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

def csc_policy
  @csc_policy
end

#currencyObject

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



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

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.



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

def duplicate_policy
  @duplicate_policy
end

#expmonthObject

The month of expiry of the card. The month value should be a numerical value between 1 and 12.



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

def expmonth
  @expmonth
end

#expyearObject

The year of expiry of the card.



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

def expyear
  @expyear
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.



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

def identifier
  @identifier
end

#macObject

A message authentication code ensures the data is authentic and that the intended amount has not been tampered with. The mac value is generated using a hash-based mac value. The following algorithm is used. - A key (k) is derived from your licence key - A value (v) is produced by concatenating the nonce, amount value and identifier, such as a purchase with nonce ‘0123456789ABCDEF` an amount of £275.95 and an identifier of OD-12345678 would become `0123456789ABCDEF27595OD-12345678` and extracting the UTF-8 byte values - The result from HMAC_SHA256(k, v) is hex-encoded (upper-case) - For instance, a licence key of `LK123456789`, a nonce of `0123456789ABCDEF`, an amount of `27595` and an identifier of `OD-12345678` would generate a MAC of `163DBAB194D743866A9BCC7FC9C8A88FCD99C6BBBF08D619291212D1B91EE12E`.



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

def mac
  @mac
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.



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

def match_avsa
  @match_avsa
end

#name_on_cardObject

The card holder name as appears on the card such as MR N E BODY. Required for some acquirers.



56
57
58
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 56

def name_on_card
  @name_on_card
end

#nonceObject

A random value Hex string (uppercase) which is provided to the API to perform a digest. The value will be used in any digest function.



59
60
61
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 59

def nonce
  @nonce
end

#redirect_failureObject

The URL used to redirect back to your site when a transaction has been rejected or declined. Required if a url-encoded request.



62
63
64
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 62

def redirect_failure
  @redirect_failure
end

#redirect_successObject

The URL used to redirect back to your site when a transaction has been tokenised or authorised. Required if a url-encoded request.



65
66
67
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 65

def redirect_success
  @redirect_success
end

#ship_toObject

Returns the value of attribute ship_to.



67
68
69
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 67

def ship_to
  @ship_to
end

#tagObject

Returns the value of attribute tag.



69
70
71
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 69

def tag
  @tag
end

#threedsecureObject

Returns the value of attribute threedsecure.



71
72
73
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 71

def threedsecure
  @threedsecure
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.



74
75
76
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 74

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.



77
78
79
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 77

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



621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 621

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_attributesObject

Returns all the JSON keys this model knows about



108
109
110
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 108

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 80

def self.attribute_map
  {
    :'amount' => :'amount',
    :'avs_postcode_policy' => :'avs_postcode_policy',
    :'bill_to' => :'bill_to',
    :'cardnumber' => :'cardnumber',
    :'csc' => :'csc',
    :'csc_policy' => :'csc_policy',
    :'currency' => :'currency',
    :'duplicate_policy' => :'duplicate_policy',
    :'expmonth' => :'expmonth',
    :'expyear' => :'expyear',
    :'identifier' => :'identifier',
    :'mac' => :'mac',
    :'match_avsa' => :'match_avsa',
    :'name_on_card' => :'name_on_card',
    :'nonce' => :'nonce',
    :'redirect_failure' => :'redirect_failure',
    :'redirect_success' => :'redirect_success',
    :'ship_to' => :'ship_to',
    :'tag' => :'tag',
    :'threedsecure' => :'threedsecure',
    :'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



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 597

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



141
142
143
144
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 141

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'amount' => :'Integer',
    :'avs_postcode_policy' => :'String',
    :'bill_to' => :'ContactDetails',
    :'cardnumber' => :'String',
    :'csc' => :'String',
    :'csc_policy' => :'String',
    :'currency' => :'String',
    :'duplicate_policy' => :'String',
    :'expmonth' => :'Integer',
    :'expyear' => :'Integer',
    :'identifier' => :'String',
    :'mac' => :'String',
    :'match_avsa' => :'String',
    :'name_on_card' => :'String',
    :'nonce' => :'String',
    :'redirect_failure' => :'String',
    :'redirect_success' => :'String',
    :'ship_to' => :'ContactDetails',
    :'tag' => :'Array<String>',
    :'threedsecure' => :'ThreeDSecure',
    :'trans_info' => :'String',
    :'trans_type' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 555

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      amount == o.amount &&
      avs_postcode_policy == o.avs_postcode_policy &&
      bill_to == o.bill_to &&
      cardnumber == o.cardnumber &&
      csc == o.csc &&
      csc_policy == o.csc_policy &&
      currency == o.currency &&
      duplicate_policy == o.duplicate_policy &&
      expmonth == o.expmonth &&
      expyear == o.expyear &&
      identifier == o.identifier &&
      mac == o.mac &&
      match_avsa == o.match_avsa &&
      name_on_card == o.name_on_card &&
      nonce == o.nonce &&
      redirect_failure == o.redirect_failure &&
      redirect_success == o.redirect_success &&
      ship_to == o.ship_to &&
      tag == o.tag &&
      threedsecure == o.threedsecure &&
      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



692
693
694
695
696
697
698
699
700
701
702
703
704
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 692

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


584
585
586
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 584

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



590
591
592
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 590

def hash
  [amount, avs_postcode_policy, bill_to, cardnumber, csc, csc_policy, currency, duplicate_policy, expmonth, expyear, identifier, mac, match_avsa, name_on_card, nonce, redirect_failure, redirect_success, ship_to, tag, threedsecure, 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



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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 266

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 @cardnumber.nil?
    invalid_properties.push('invalid value for "cardnumber", cardnumber cannot be nil.')
  end

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

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

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

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

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

  if @expmonth > 12
    invalid_properties.push('invalid value for "expmonth", must be smaller than or equal to 12.')
  end

  if @expmonth < 1
    invalid_properties.push('invalid value for "expmonth", must be greater than or equal to 1.')
  end

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

  if @expyear > 2100
    invalid_properties.push('invalid value for "expyear", must be smaller than or equal to 2100.')
  end

  if @expyear < 2000
    invalid_properties.push('invalid value for "expyear", must be greater than or equal to 2000.')
  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 great than or equal to 4.')
  end

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

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

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



668
669
670
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 668

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



674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 674

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



662
663
664
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 662

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



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/citypay_api_client/models/direct_post_request.rb', line 362

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @amount.nil?
  return false if @cardnumber.nil?
  return false if @cardnumber.to_s.length > 22
  return false if @cardnumber.to_s.length < 12
  return false if !@csc.nil? && @csc.to_s.length > 4
  return false if !@csc.nil? && @csc.to_s.length < 3
  return false if !@currency.nil? && @currency.to_s.length > 3
  return false if !@currency.nil? && @currency.to_s.length < 3
  return false if @expmonth.nil?
  return false if @expmonth > 12
  return false if @expmonth < 1
  return false if @expyear.nil?
  return false if @expyear > 2100
  return false if @expyear < 2000
  return false if @identifier.nil?
  return false if @identifier.to_s.length > 50
  return false if @identifier.to_s.length < 4
  return false if @mac.nil?
  return false if !@name_on_card.nil? && @name_on_card.to_s.length > 45
  return false if !@name_on_card.nil? && @name_on_card.to_s.length < 2
  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