Class: PAYJPv2::CheckoutSessionCreateRequest
- Inherits:
-
Object
- Object
- PAYJPv2::CheckoutSessionCreateRequest
- Defined in:
- lib/payjpv2/models/checkout_session_create_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#cancel_url ⇒ Object
キャンセル時のリダイレクト URL.
-
#client_reference_id ⇒ Object
ID.
-
#currency ⇒ Object
価格の通貨。現在は ‘jpy` のみサポートしています。.
-
#customer_creation ⇒ Object
Checkout Session の確定時に Customer を作成するかどうかを指定します。
‘payment` および `setup` モードでのみ設定可能です。. -
#customer_email ⇒ Object
顧客オブジェクトを作成する時に使われます。指定されていない場合、顧客にメールアドレスの入力を求めます。すでに顧客のメールアドレスを持っている場合は、このパラメータを使ってあらかじめ情報を入力しておくことが可能です。.
-
#customer_id ⇒ Object
顧客 ID.
-
#expires_at ⇒ Object
Checkout Session の有効期限が失効する日時.
-
#line_items ⇒ Object
顧客が購入する商品のリストです。このパラメーターを使用して、1回限りまたは定期的な料金を渡します。 ‘payment` モードの場合、最大100個のラインアイテムを使用できます。.
-
#locale ⇒ Object
Checkout 画面の表示言語を指定します。 | 指定できる値 | |:—| | ja: 日本語で表示します。 |.
-
#metadata ⇒ Object
キーバリューの任意のデータを格納できます。20件まで登録可能で、空文字列を指定するとそのキーを削除できます。<a href="docs.pay.jp/v2/guide/developers/metadata">詳細はメタデータのドキュメントを参照してください。</a>.
-
#mode ⇒ Object
Checkout Session のモード | 指定できる値 | |:—| | payment: 支払いモードで Checkout Session を作成します。 | | setup: セットアップモードで Checkout Session を作成します。 |.
-
#payment_flow_data ⇒ Object
‘payment` モード指定時に PaymentFlow 作成に使用するパラメーター.
-
#payment_method_options ⇒ Object
この PaymentFlow の支払い方法の個別設定.
-
#payment_method_types ⇒ Object
この PaymentFlow で使用できる支払い方法の種類(カードなど)のリストです。指定しない場合、管理画面で利用可能な状態にしている支払い方法を自動的に表示します。.
-
#setup_flow_data ⇒ Object
‘setup` モードの Checkout Session を作成する際、SetupFlow の作成に渡されるパラメーター.
-
#submit_type ⇒ Object
Checkout の画面上に表示される送信ボタンなど、ページ上の関連テキストをカスタマイズするために使用されます。
‘submit_type` は、`payment` モードの Checkout Session でのみ指定できます。未指定時、あるいは `auto` の場合、`pay` が使用されます。 | 指定できる値 | |:—| | auto: `pay` が使用されます。 | | pay: 「支払う」(デフォルト) | | book: 「予約する」 | | donate: 「寄付する」 |. -
#success_url ⇒ Object
支払いや設定が完了した際に、PAY.JP が顧客をリダイレクトする URL。成功した Checkout Session からの情報をページで使用したい場合は、成功ページのカスタマイズに関するガイドをお読みください。.
-
#ui_mode ⇒ Object
Checkout Session の UI モード。デフォルトは ‘hosted` です。 | 指定できる値 | |:—| | hosted: PAY.JP でホスティングしている画面を使用します。 |.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CheckoutSessionCreateRequest
constructor
Initializes the object.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ CheckoutSessionCreateRequest
Initializes the object
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 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 160 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::CheckoutSessionCreateRequest` 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::CheckoutSessionCreateRequest`. 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?(:mode) self.mode = attributes[:mode] else self.mode = nil end if attributes.key?(:client_reference_id) self.client_reference_id = attributes[:client_reference_id] end if attributes.key?(:customer_id) self.customer_id = attributes[:customer_id] end if attributes.key?(:customer_email) self.customer_email = attributes[:customer_email] end if attributes.key?(:customer_creation) self.customer_creation = attributes[:customer_creation] end if attributes.key?(:line_items) if (value = attributes[:line_items]).is_a?(Array) self.line_items = value end end if attributes.key?(:metadata) if (value = attributes[:metadata]).is_a?(Hash) self. = value end end if attributes.key?(:success_url) self.success_url = attributes[:success_url] end if attributes.key?(:cancel_url) self.cancel_url = attributes[:cancel_url] end if attributes.key?(:currency) self.currency = attributes[:currency] end if attributes.key?(:expires_at) self.expires_at = attributes[:expires_at] end if attributes.key?(:locale) self.locale = attributes[:locale] end if attributes.key?(:payment_method_types) if (value = attributes[:payment_method_types]).is_a?(Array) self.payment_method_types = value end end if attributes.key?(:payment_method_options) self. = attributes[:payment_method_options] end if attributes.key?(:payment_flow_data) self.payment_flow_data = attributes[:payment_flow_data] end if attributes.key?(:submit_type) self.submit_type = attributes[:submit_type] end if attributes.key?(:setup_flow_data) self.setup_flow_data = attributes[:setup_flow_data] end if attributes.key?(:ui_mode) self.ui_mode = attributes[:ui_mode] end end |
Instance Attribute Details
#cancel_url ⇒ Object
キャンセル時のリダイレクト URL
43 44 45 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 43 def cancel_url @cancel_url end |
#client_reference_id ⇒ Object
ID
22 23 24 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 22 def client_reference_id @client_reference_id end |
#currency ⇒ Object
価格の通貨。現在は ‘jpy` のみサポートしています。
46 47 48 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 46 def currency @currency end |
#customer_creation ⇒ Object
Checkout Session の確定時に Customer を作成するかどうかを指定します。
‘payment` および `setup` モードでのみ設定可能です。
31 32 33 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 31 def customer_creation @customer_creation end |
#customer_email ⇒ Object
顧客オブジェクトを作成する時に使われます。指定されていない場合、顧客にメールアドレスの入力を求めます。すでに顧客のメールアドレスを持っている場合は、このパラメータを使ってあらかじめ情報を入力しておくことが可能です。
28 29 30 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 28 def customer_email @customer_email end |
#customer_id ⇒ Object
顧客 ID
25 26 27 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 25 def customer_id @customer_id end |
#expires_at ⇒ Object
Checkout Session の有効期限が失効する日時
49 50 51 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 49 def expires_at @expires_at end |
#line_items ⇒ Object
顧客が購入する商品のリストです。このパラメーターを使用して、1回限りまたは定期的な料金を渡します。 ‘payment` モードの場合、最大100個のラインアイテムを使用できます。
34 35 36 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 34 def line_items @line_items end |
#locale ⇒ Object
Checkout 画面の表示言語を指定します。 | 指定できる値 | |:—| | ja: 日本語で表示します。 |
52 53 54 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 52 def locale @locale end |
#metadata ⇒ Object
キーバリューの任意のデータを格納できます。20件まで登録可能で、空文字列を指定するとそのキーを削除できます。<a href="docs.pay.jp/v2/guide/developers/metadata">詳細はメタデータのドキュメントを参照してください。</a>
37 38 39 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 37 def @metadata end |
#mode ⇒ Object
Checkout Session のモード | 指定できる値 | |:—| | payment: 支払いモードで Checkout Session を作成します。 | | setup: セットアップモードで Checkout Session を作成します。 |
19 20 21 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 19 def mode @mode end |
#payment_flow_data ⇒ Object
‘payment` モード指定時に PaymentFlow 作成に使用するパラメーター
61 62 63 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 61 def payment_flow_data @payment_flow_data end |
#payment_method_options ⇒ Object
この PaymentFlow の支払い方法の個別設定
58 59 60 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 58 def @payment_method_options end |
#payment_method_types ⇒ Object
この PaymentFlow で使用できる支払い方法の種類(カードなど)のリストです。指定しない場合、管理画面で利用可能な状態にしている支払い方法を自動的に表示します。
55 56 57 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 55 def payment_method_types @payment_method_types end |
#setup_flow_data ⇒ Object
‘setup` モードの Checkout Session を作成する際、SetupFlow の作成に渡されるパラメーター
67 68 69 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 67 def setup_flow_data @setup_flow_data end |
#submit_type ⇒ Object
Checkout の画面上に表示される送信ボタンなど、ページ上の関連テキストをカスタマイズするために使用されます。
‘submit_type` は、`payment` モードの Checkout Session でのみ指定できます。未指定時、あるいは `auto` の場合、`pay` が使用されます。 | 指定できる値 | |:—| | auto: `pay` が使用されます。 | | pay: 「支払う」(デフォルト) | | book: 「予約する」 | | donate: 「寄付する」 |
64 65 66 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 64 def submit_type @submit_type end |
#success_url ⇒ Object
支払いや設定が完了した際に、PAY.JP が顧客をリダイレクトする URL。成功した Checkout Session からの情報をページで使用したい場合は、成功ページのカスタマイズに関するガイドをお読みください。
40 41 42 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 40 def success_url @success_url end |
#ui_mode ⇒ Object
Checkout Session の UI モード。デフォルトは ‘hosted` です。 | 指定できる値 | |:—| | hosted: PAY.JP でホスティングしている画面を使用します。 |
70 71 72 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 70 def ui_mode @ui_mode end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 343 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_map ⇒ Object
Returns attribute mapping this model knows about
119 120 121 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 119 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
124 125 126 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 124 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 95 def self.attribute_map { :mode => :mode, :client_reference_id => :client_reference_id, :customer_id => :customer_id, :customer_email => :customer_email, :customer_creation => :customer_creation, :line_items => :line_items, :metadata => :metadata, :success_url => :success_url, :cancel_url => :cancel_url, :currency => :currency, :expires_at => :expires_at, :locale => :locale, :payment_method_types => :payment_method_types, :payment_method_options => :payment_method_options, :payment_flow_data => :payment_flow_data, :submit_type => :submit_type, :setup_flow_data => :setup_flow_data, :ui_mode => :ui_mode } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 319 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_nullable ⇒ Object
List of attributes with nullable: true
153 154 155 156 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 153 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 129 def self.openapi_types { :mode => :'CheckoutSessionMode', :client_reference_id => :'String', :customer_id => :'String', :customer_email => :'String', :customer_creation => :'CustomerCreation', :line_items => :'Array<LineItemRequest>', :metadata => :'Hash<String, MetadataValue>', :success_url => :'String', :cancel_url => :'String', :currency => :'Currency', :expires_at => :'Time', :locale => :'Locale', :payment_method_types => :'Array<PaymentMethodTypes>', :payment_method_options => :'CheckoutSessionPaymentMethodOptionsRequest', :payment_flow_data => :'PaymentFlowDataRequest', :submit_type => :'CheckoutSessionSubmitType', :setup_flow_data => :'SetupFlowDataRequest', :ui_mode => :'CheckoutSessionUIMode' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 281 def ==(o) return true if self.equal?(o) self.class == o.class && mode == o.mode && client_reference_id == o.client_reference_id && customer_id == o.customer_id && customer_email == o.customer_email && customer_creation == o.customer_creation && line_items == o.line_items && == o. && success_url == o.success_url && cancel_url == o.cancel_url && currency == o.currency && expires_at == o.expires_at && locale == o.locale && payment_method_types == o.payment_method_types && == o. && payment_flow_data == o.payment_flow_data && submit_type == o.submit_type && setup_flow_data == o.setup_flow_data && ui_mode == o.ui_mode end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 414 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
306 307 308 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 306 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
312 313 314 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 312 def hash [mode, client_reference_id, customer_id, customer_email, customer_creation, line_items, , success_url, cancel_url, currency, expires_at, locale, payment_method_types, , payment_flow_data, submit_type, setup_flow_data, ui_mode].hash end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
390 391 392 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 390 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 396 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_s ⇒ String
Returns the string representation of the object
384 385 386 |
# File 'lib/payjpv2/models/checkout_session_create_request.rb', line 384 def to_s to_hash.to_s end |