Class: CyberSourceMergedSpec::JapanPaymentOptions

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/japan_payment_options.rb

Overview

JapanPaymentOptions Model.

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_method: SKIP, bonuses: SKIP, preapproval_type: SKIP, installments: SKIP, terminal_id: SKIP, first_billing_month: SKIP, business_name: SKIP, business_name_katakana: SKIP, jis2_track_data: SKIP, business_name_alpha_numeric: SKIP, additional_properties: nil) ⇒ JapanPaymentOptions

Returns a new instance of JapanPaymentOptions.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 130

def initialize(payment_method: SKIP, bonuses: SKIP, preapproval_type: SKIP,
               installments: SKIP, terminal_id: SKIP,
               first_billing_month: SKIP, business_name: SKIP,
               business_name_katakana: SKIP, jis2_track_data: SKIP,
               business_name_alpha_numeric: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @payment_method = payment_method unless payment_method == SKIP
  @bonuses = bonuses unless bonuses == SKIP
  @preapproval_type = preapproval_type unless preapproval_type == SKIP
  @installments = installments unless installments == SKIP
  @terminal_id = terminal_id unless terminal_id == SKIP
  @first_billing_month = first_billing_month unless first_billing_month == SKIP
  @business_name = business_name unless business_name == SKIP
  @business_name_katakana = business_name_katakana unless business_name_katakana == SKIP
  @jis2_track_data = jis2_track_data unless jis2_track_data == SKIP
  unless business_name_alpha_numeric == SKIP
    @business_name_alpha_numeric =
      business_name_alpha_numeric
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#bonusesArray[Bonuse]

An array of objects, each of which contains a bonus month and bonus amount. Length of bonuses array is equal to the number of bonuses. Max length = 6. In case of bonus month and amount not specified, null objects to be returned in the array. Example: bonuses : [ "1","amount": "200", "3","amount": "2500", null]

Returns:



31
32
33
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 31

def bonuses
  @bonuses
end

#business_nameString

Business name in Japanese characters. This field is supported only on JCN Gateway and for the Sumitomo Mitsui Card Co. acquirer on CyberSource through VisaNet.

Returns:

  • (String)


71
72
73
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 71

def business_name
  @business_name
end

#business_name_alpha_numericString

Business name in alphanumeric characters. This field is supported only on JCN Gateway and for the Sumitomo Mitsui Card Co. acquirer on CyberSource through VisaNet.

Returns:

  • (String)


91
92
93
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 91

def business_name_alpha_numeric
  @business_name_alpha_numeric
end

#business_name_katakanaString

Business name in Katakana characters. This field is supported only on JCN Gateway and for the Sumitomo Mitsui Card Co. acquirer on CyberSource through VisaNet.

Returns:

  • (String)


77
78
79
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 77

def business_name_katakana
  @business_name_katakana
end

#first_billing_monthString

Billing month in MM format.

Returns:

  • (String)


65
66
67
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 65

def first_billing_month
  @first_billing_month
end

#installmentsString

Number of Installments.

Returns:

  • (String)


49
50
51
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 49

def installments
  @installments
end

#jis2_track_dataString

Japanese Industrial Standard Type 2 (JIS2) track data from the front of the card. This field is supported only on CyberSource through VisaNet and JCN Gateway. Optional field.

Returns:

  • (String)


85
86
87
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 85

def jis2_track_data
  @jis2_track_data
end

#payment_methodString

This value is a 2-digit code indicating the payment method. Use Payment Method Code value that applies to the tranasction.

  • 10 (One-time payment)
  • 21, 22, 23, 24 (Bonus(one-time)payment)
  • 61 (Installment payment)
  • 31, 32, 33, 34 (Integrated (Bonus + Installment)payment)
  • 80 (Revolving payment)

Returns:

  • (String)


20
21
22
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 20

def payment_method
  @payment_method
end

#preapproval_typeString

This will contain the details of the kind of transaction that has been processe. Used only for Japan. Possible Values:

  • 0 = Normal (authorization with amount and clearing/settlement; data capture or paper draft)
  • 1 = Negative card authorization (authorization-only with 0 or 1 amount)
  • 2 = Reservation of authorization (authorization-only with amount)
  • 3 = Cancel transaction
  • 4 = Merchant-initiated reversal/refund transactions
  • 5 = Cancel reservation of authorization
  • 6 = Post authorization

Returns:

  • (String)


45
46
47
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 45

def preapproval_type
  @preapproval_type
end

#terminal_idString

Unique Japan Credit Card Association (JCCA) terminal identifier. The difference between this field and the pointOfSaleInformation.terminalID field is that you can define pointOfSaleInformation.terminalID, but processingInformation.japanPaymentOptions.terminalId is defined by the JCCA and is used only in Japan. This field is supported only on CyberSource through VisaNet and JCN Gateway. Optional field.

Returns:

  • (String)


61
62
63
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 61

def terminal_id
  @terminal_id
end

Class Method Details

.from_element(root) ⇒ Object



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
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 206

def self.from_element(root)
  payment_method = XmlUtilities.from_element(root, 'paymentMethod', String)
  bonuses = XmlUtilities.from_element_to_array(root, 'Bonuse', Bonuse)
  preapproval_type = XmlUtilities.from_element(root, 'preapprovalType',
                                               String)
  installments = XmlUtilities.from_element(root, 'installments', String)
  terminal_id = XmlUtilities.from_element(root, 'terminalId', String)
  first_billing_month = XmlUtilities.from_element(root, 'firstBillingMonth',
                                                  String)
  business_name = XmlUtilities.from_element(root, 'businessName', String)
  business_name_katakana = XmlUtilities.from_element(root,
                                                     'businessNameKatakana',
                                                     String)
  jis2_track_data = XmlUtilities.from_element(root, 'jis2TrackData', String)
  business_name_alpha_numeric = XmlUtilities.from_element(
    root, 'businessNameAlphaNumeric', String
  )

  new(payment_method: payment_method,
      bonuses: bonuses,
      preapproval_type: preapproval_type,
      installments: installments,
      terminal_id: terminal_id,
      first_billing_month: first_billing_month,
      business_name: business_name,
      business_name_katakana: business_name_katakana,
      jis2_track_data: jis2_track_data,
      business_name_alpha_numeric: business_name_alpha_numeric,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 156

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_method = hash.key?('paymentMethod') ? hash['paymentMethod'] : SKIP
  # Parameter is an array, so we need to iterate through it
  bonuses = nil
  unless hash['bonuses'].nil?
    bonuses = []
    hash['bonuses'].each do |structure|
      bonuses << (Bonuse.from_hash(structure) if structure)
    end
  end

  bonuses = SKIP unless hash.key?('bonuses')
  preapproval_type =
    hash.key?('preapprovalType') ? hash['preapprovalType'] : SKIP
  installments = hash.key?('installments') ? hash['installments'] : SKIP
  terminal_id = hash.key?('terminalId') ? hash['terminalId'] : SKIP
  first_billing_month =
    hash.key?('firstBillingMonth') ? hash['firstBillingMonth'] : SKIP
  business_name = hash.key?('businessName') ? hash['businessName'] : SKIP
  business_name_katakana =
    hash.key?('businessNameKatakana') ? hash['businessNameKatakana'] : SKIP
  jis2_track_data =
    hash.key?('jis2TrackData') ? hash['jis2TrackData'] : SKIP
  business_name_alpha_numeric =
    hash.key?('businessNameAlphaNumeric') ? hash['businessNameAlphaNumeric'] : SKIP

  # 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.
  JapanPaymentOptions.new(payment_method: payment_method,
                          bonuses: bonuses,
                          preapproval_type: preapproval_type,
                          installments: installments,
                          terminal_id: terminal_id,
                          first_billing_month: first_billing_month,
                          business_name: business_name,
                          business_name_katakana: business_name_katakana,
                          jis2_track_data: jis2_track_data,
                          business_name_alpha_numeric: business_name_alpha_numeric,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 94

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_method'] = 'paymentMethod'
  @_hash['bonuses'] = 'bonuses'
  @_hash['preapproval_type'] = 'preapprovalType'
  @_hash['installments'] = 'installments'
  @_hash['terminal_id'] = 'terminalId'
  @_hash['first_billing_month'] = 'firstBillingMonth'
  @_hash['business_name'] = 'businessName'
  @_hash['business_name_katakana'] = 'businessNameKatakana'
  @_hash['jis2_track_data'] = 'jis2TrackData'
  @_hash['business_name_alpha_numeric'] = 'businessNameAlphaNumeric'
  @_hash
end

.nullablesObject

An array for nullable fields



126
127
128
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 126

def self.nullables
  []
end

.optionalsObject

An array for optional fields



110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 110

def self.optionals
  %w[
    payment_method
    bonuses
    preapproval_type
    installments
    terminal_id
    first_billing_month
    business_name
    business_name_katakana
    jis2_track_data
    business_name_alpha_numeric
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



273
274
275
276
277
278
279
280
281
282
283
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 273

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_method: #{@payment_method.inspect}, bonuses: #{@bonuses.inspect},"\
  " preapproval_type: #{@preapproval_type.inspect}, installments: #{@installments.inspect},"\
  " terminal_id: #{@terminal_id.inspect}, first_billing_month:"\
  " #{@first_billing_month.inspect}, business_name: #{@business_name.inspect},"\
  " business_name_katakana: #{@business_name_katakana.inspect}, jis2_track_data:"\
  " #{@jis2_track_data.inspect}, business_name_alpha_numeric:"\
  " #{@business_name_alpha_numeric.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



262
263
264
265
266
267
268
269
270
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 262

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_method: #{@payment_method}, bonuses: #{@bonuses}, preapproval_type:"\
  " #{@preapproval_type}, installments: #{@installments}, terminal_id: #{@terminal_id},"\
  " first_billing_month: #{@first_billing_month}, business_name: #{@business_name},"\
  " business_name_katakana: #{@business_name_katakana}, jis2_track_data: #{@jis2_track_data},"\
  " business_name_alpha_numeric: #{@business_name_alpha_numeric}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/cyber_source_merged_spec/models/japan_payment_options.rb', line 237

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'paymentMethod', payment_method)
  XmlUtilities.add_array_as_subelement(doc, root, 'Bonuse', bonuses)
  XmlUtilities.add_as_subelement(doc, root, 'preapprovalType',
                                 preapproval_type)
  XmlUtilities.add_as_subelement(doc, root, 'installments', installments)
  XmlUtilities.add_as_subelement(doc, root, 'terminalId', terminal_id)
  XmlUtilities.add_as_subelement(doc, root, 'firstBillingMonth',
                                 first_billing_month)
  XmlUtilities.add_as_subelement(doc, root, 'businessName', business_name)
  XmlUtilities.add_as_subelement(doc, root, 'businessNameKatakana',
                                 business_name_katakana)
  XmlUtilities.add_as_subelement(doc, root, 'jis2TrackData',
                                 jis2_track_data)
  XmlUtilities.add_as_subelement(doc, root, 'businessNameAlphaNumeric',
                                 business_name_alpha_numeric)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end