Class: CyberSourceMergedSpec::JapanPaymentOptions3

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

Overview

JapanPaymentOptions3 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, terminal_id: SKIP, business_name: SKIP, business_name_katakana: SKIP, business_name_english: SKIP, bonuses: SKIP, first_billing_month: SKIP, number_of_installments: SKIP, pre_approval_type: SKIP, additional_properties: nil) ⇒ JapanPaymentOptions3

Returns a new instance of JapanPaymentOptions3.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 120

def initialize(payment_method: SKIP, terminal_id: SKIP, business_name: SKIP,
               business_name_katakana: SKIP, business_name_english: SKIP,
               bonuses: SKIP, first_billing_month: SKIP,
               number_of_installments: SKIP, pre_approval_type: 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
  @terminal_id = terminal_id unless terminal_id == SKIP
  @business_name = business_name unless business_name == SKIP
  @business_name_katakana = business_name_katakana unless business_name_katakana == SKIP
  @business_name_english = business_name_english unless business_name_english == SKIP
  @bonuses = bonuses unless bonuses == SKIP
  @first_billing_month = first_billing_month unless first_billing_month == SKIP
  @number_of_installments = number_of_installments unless number_of_installments == SKIP
  @pre_approval_type = pre_approval_type unless pre_approval_type == SKIP
  @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:



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

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)


38
39
40
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 38

def business_name
  @business_name
end

#business_name_englishString

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

Returns:

  • (String)


50
51
52
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 50

def business_name_english
  @business_name_english
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)


44
45
46
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 44

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_options3.rb', line 65

def first_billing_month
  @first_billing_month
end

#number_of_installmentsString

Number of Installments.

Returns:

  • (String)


69
70
71
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 69

def number_of_installments
  @number_of_installments
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_options3.rb', line 20

def payment_method
  @payment_method
end

#pre_approval_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)


83
84
85
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 83

def pre_approval_type
  @pre_approval_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)


32
33
34
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 32

def terminal_id
  @terminal_id
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  payment_method = XmlUtilities.from_element(root, 'paymentMethod', String)
  terminal_id = XmlUtilities.from_element(root, 'terminalId', String)
  business_name = XmlUtilities.from_element(root, 'businessName', String)
  business_name_katakana = XmlUtilities.from_element(root,
                                                     'businessNameKatakana',
                                                     String)
  business_name_english = XmlUtilities.from_element(root,
                                                    'businessNameEnglish',
                                                    String)
  bonuses = XmlUtilities.from_element_to_array(root, 'Bonuse', Bonuse)
  first_billing_month = XmlUtilities.from_element(root, 'firstBillingMonth',
                                                  String)
  number_of_installments = XmlUtilities.from_element(root,
                                                     'numberOfInstallments',
                                                     String)
  pre_approval_type = XmlUtilities.from_element(root, 'preApprovalType',
                                                String)

  new(payment_method: payment_method,
      terminal_id: terminal_id,
      business_name: business_name,
      business_name_katakana: business_name_katakana,
      business_name_english: business_name_english,
      bonuses: bonuses,
      first_billing_month: first_billing_month,
      number_of_installments: number_of_installments,
      pre_approval_type: pre_approval_type,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_method = hash.key?('paymentMethod') ? hash['paymentMethod'] : SKIP
  terminal_id = hash.key?('terminalId') ? hash['terminalId'] : SKIP
  business_name = hash.key?('businessName') ? hash['businessName'] : SKIP
  business_name_katakana =
    hash.key?('businessNameKatakana') ? hash['businessNameKatakana'] : SKIP
  business_name_english =
    hash.key?('businessNameEnglish') ? hash['businessNameEnglish'] : 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')
  first_billing_month =
    hash.key?('firstBillingMonth') ? hash['firstBillingMonth'] : SKIP
  number_of_installments =
    hash.key?('numberOfInstallments') ? hash['numberOfInstallments'] : SKIP
  pre_approval_type =
    hash.key?('preApprovalType') ? hash['preApprovalType'] : 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.
  JapanPaymentOptions3.new(payment_method: payment_method,
                           terminal_id: terminal_id,
                           business_name: business_name,
                           business_name_katakana: business_name_katakana,
                           business_name_english: business_name_english,
                           bonuses: bonuses,
                           first_billing_month: first_billing_month,
                           number_of_installments: number_of_installments,
                           pre_approval_type: pre_approval_type,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 86

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_method'] = 'paymentMethod'
  @_hash['terminal_id'] = 'terminalId'
  @_hash['business_name'] = 'businessName'
  @_hash['business_name_katakana'] = 'businessNameKatakana'
  @_hash['business_name_english'] = 'businessNameEnglish'
  @_hash['bonuses'] = 'bonuses'
  @_hash['first_billing_month'] = 'firstBillingMonth'
  @_hash['number_of_installments'] = 'numberOfInstallments'
  @_hash['pre_approval_type'] = 'preApprovalType'
  @_hash
end

.nullablesObject

An array for nullable fields



116
117
118
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 116

def self.nullables
  []
end

.optionalsObject

An array for optional fields



101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 101

def self.optionals
  %w[
    payment_method
    terminal_id
    business_name
    business_name_katakana
    business_name_english
    bonuses
    first_billing_month
    number_of_installments
    pre_approval_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



255
256
257
258
259
260
261
262
263
264
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 255

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

#to_sObject

Provides a human-readable string representation of the object.



244
245
246
247
248
249
250
251
252
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 244

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

#to_xml_element(doc, root_name) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/cyber_source_merged_spec/models/japan_payment_options3.rb', line 220

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

  XmlUtilities.add_as_subelement(doc, root, 'paymentMethod', payment_method)
  XmlUtilities.add_as_subelement(doc, root, 'terminalId', terminal_id)
  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, 'businessNameEnglish',
                                 business_name_english)
  XmlUtilities.add_array_as_subelement(doc, root, 'Bonuse', bonuses)
  XmlUtilities.add_as_subelement(doc, root, 'firstBillingMonth',
                                 first_billing_month)
  XmlUtilities.add_as_subelement(doc, root, 'numberOfInstallments',
                                 number_of_installments)
  XmlUtilities.add_as_subelement(doc, root, 'preApprovalType',
                                 pre_approval_type)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end