Class: PAYJPv2::CheckoutSessionDetailsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/payjpv2/models/checkout_session_details_response.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CheckoutSessionDetailsResponse

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
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
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 194

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::CheckoutSessionDetailsResponse` 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))
      raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::CheckoutSessionDetailsResponse`. 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?(:object)
    self.object = attributes[:object]
  else
    self.object = 'checkout.session'
  end

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:payment_method_types)
    if (value = attributes[:payment_method_types]).is_a?(Array)
      self.payment_method_types = value
    end
  else
    self.payment_method_types = nil
  end

  if attributes.key?(:payment_method_options)
    if (value = attributes[:payment_method_options]).is_a?(Hash)
      self.payment_method_options = value
    end
  else
    self.payment_method_options = nil
  end

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

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

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

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

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

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

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

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

  if attributes.key?(:metadata)
    if (value = attributes[:metadata]).is_a?(Hash)
      self. = value
    end
  else
    self. = nil
  end

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

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

Instance Attribute Details

#amount_subtotalObject

Returns the value of attribute amount_subtotal.



26
27
28
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 26

def amount_subtotal
  @amount_subtotal
end

#amount_totalObject

Returns the value of attribute amount_total.



28
29
30
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 28

def amount_total
  @amount_total
end

#cancel_urlObject

Returns the value of attribute cancel_url.



64
65
66
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 64

def cancel_url
  @cancel_url
end

#created_atObject

作成日時 (UTC, ISO 8601 形式)



73
74
75
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 73

def created_at
  @created_at
end

#currencyObject

価格の通貨。現在は ‘jpy` のみサポートしています。



39
40
41
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 39

def currency
  @currency
end

#customer_detailsObject

Returns the value of attribute customer_details.



34
35
36
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 34

def customer_details
  @customer_details
end

#customer_emailObject

Returns the value of attribute customer_email.



32
33
34
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 32

def customer_email
  @customer_email
end

#customer_idObject

Returns the value of attribute customer_id.



30
31
32
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 30

def customer_id
  @customer_id
end

#expires_atObject

Returns the value of attribute expires_at.



36
37
38
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 36

def expires_at
  @expires_at
end

#idObject

Checkout Session ID



21
22
23
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 21

def id
  @id
end

#livemodeObject

本番環境かどうか



24
25
26
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 24

def livemode
  @livemode
end

#localeObject

Returns the value of attribute locale.



41
42
43
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 41

def locale
  @locale
end

#metadataObject

メタデータ



70
71
72
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 70

def 
  @metadata
end

#modeObject

Checkout Session のモード | 値 | |:—| | payment: 支払いモード | | setup: セットアップモード |



54
55
56
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 54

def mode
  @mode
end

#objectObject

Returns the value of attribute object.



18
19
20
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 18

def object
  @object
end

#payment_flow_idObject

Returns the value of attribute payment_flow_id.



43
44
45
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 43

def payment_flow_id
  @payment_flow_id
end

#payment_method_optionsObject

Returns the value of attribute payment_method_options.



47
48
49
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 47

def payment_method_options
  @payment_method_options
end

#payment_method_typesObject

Returns the value of attribute payment_method_types.



45
46
47
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 45

def payment_method_types
  @payment_method_types
end

#setup_flow_idObject

Returns the value of attribute setup_flow_id.



49
50
51
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 49

def setup_flow_id
  @setup_flow_id
end

#statusObject

チェックアウトセッションのステータス



60
61
62
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 60

def status
  @status
end

#submit_typeObject

Returns the value of attribute submit_type.



51
52
53
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 51

def submit_type
  @submit_type
end

#success_urlObject

Returns the value of attribute success_url.



62
63
64
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 62

def success_url
  @success_url
end

#ui_modeObject

Checkout Session の UI モード | 値 | |:—| | hosted: PAY.JP でホスティングしている画面を使用します。 |



57
58
59
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 57

def ui_mode
  @ui_mode
end

#updated_atObject

更新日時 (UTC, ISO 8601 形式)



76
77
78
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 76

def updated_at
  @updated_at
end

#urlObject

URL



67
68
69
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 67

def url
  @url
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



540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 540

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 = PAYJPv2.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



132
133
134
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 132

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



137
138
139
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 137

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 101

def self.attribute_map
  {
    :object => :object,
    :id => :id,
    :livemode => :livemode,
    :amount_subtotal => :amount_subtotal,
    :amount_total => :amount_total,
    :customer_id => :customer_id,
    :customer_email => :customer_email,
    :customer_details => :customer_details,
    :expires_at => :expires_at,
    :currency => :currency,
    :locale => :locale,
    :payment_flow_id => :payment_flow_id,
    :payment_method_types => :payment_method_types,
    :payment_method_options => :payment_method_options,
    :setup_flow_id => :setup_flow_id,
    :submit_type => :submit_type,
    :mode => :mode,
    :ui_mode => :ui_mode,
    :status => :status,
    :success_url => :success_url,
    :cancel_url => :cancel_url,
    :url => :url,
    :metadata => :metadata,
    :created_at => :created_at,
    :updated_at => :updated_at
  }
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



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 516

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



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 173

def self.openapi_nullable
  Set.new([
    :amount_subtotal,
    :amount_total,
    :customer_id,
    :customer_email,
    :customer_details,
    :expires_at,
    :locale,
    :payment_flow_id,
    :payment_method_types,
    :payment_method_options,
    :setup_flow_id,
    :submit_type,
    :success_url,
    :cancel_url,
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 142

def self.openapi_types
  {
    :object => :'String',
    :id => :'String',
    :livemode => :'Boolean',
    :amount_subtotal => :'Integer',
    :amount_total => :'Integer',
    :customer_id => :'String',
    :customer_email => :'String',
    :customer_details => :'CheckoutSessionCustomerDetailsResponse',
    :expires_at => :'Time',
    :currency => :'Currency',
    :locale => :'Locale',
    :payment_flow_id => :'String',
    :payment_method_types => :'Array<PaymentMethodTypes>',
    :payment_method_options => :'Hash<String, Object>',
    :setup_flow_id => :'String',
    :submit_type => :'CheckoutSessionSubmitType',
    :mode => :'CheckoutSessionMode',
    :ui_mode => :'CheckoutSessionUIMode',
    :status => :'CheckoutSessionStatus',
    :success_url => :'String',
    :cancel_url => :'String',
    :url => :'String',
    :metadata => :'Hash<String, MetadataValue>',
    :created_at => :'Time',
    :updated_at => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 471

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      object == o.object &&
      id == o.id &&
      livemode == o.livemode &&
      amount_subtotal == o.amount_subtotal &&
      amount_total == o.amount_total &&
      customer_id == o.customer_id &&
      customer_email == o.customer_email &&
      customer_details == o.customer_details &&
      expires_at == o.expires_at &&
      currency == o.currency &&
      locale == o.locale &&
      payment_flow_id == o.payment_flow_id &&
      payment_method_types == o.payment_method_types &&
      payment_method_options == o.payment_method_options &&
      setup_flow_id == o.setup_flow_id &&
      submit_type == o.submit_type &&
      mode == o.mode &&
      ui_mode == o.ui_mode &&
      status == o.status &&
      success_url == o.success_url &&
      cancel_url == o.cancel_url &&
      url == o.url &&
       == o. &&
      created_at == o.created_at &&
      updated_at == o.updated_at
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



611
612
613
614
615
616
617
618
619
620
621
622
623
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 611

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


503
504
505
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 503

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



509
510
511
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 509

def hash
  [object, id, livemode, amount_subtotal, amount_total, customer_id, customer_email, customer_details, expires_at, currency, locale, payment_flow_id, payment_method_types, payment_method_options, setup_flow_id, submit_type, mode, ui_mode, status, success_url, cancel_url, url, , created_at, updated_at].hash
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



587
588
589
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 587

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



593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 593

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



581
582
583
# File 'lib/payjpv2/models/checkout_session_details_response.rb', line 581

def to_s
  to_hash.to_s
end