payjpv2 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +6 -2
  4. data/docs/CheckoutSessionCreateRequest.md +2 -0
  5. data/docs/CheckoutSessionDetailsResponse.md +2 -0
  6. data/docs/CheckoutSessionsApi.md +70 -0
  7. data/docs/PaymentFlowCreateRequest.md +2 -0
  8. data/docs/PaymentFlowResponse.md +2 -0
  9. data/docs/PaymentFlowUpdateRequest.md +2 -0
  10. data/docs/RedirectOptionsRequest.md +18 -0
  11. data/docs/RedirectOptionsResponse.md +18 -0
  12. data/docs/SetupFlowCancelRequest.md +1 -1
  13. data/docs/SetupFlowCreateRequest.md +2 -0
  14. data/docs/SetupFlowResponse.md +2 -0
  15. data/docs/SetupFlowUpdateRequest.md +2 -0
  16. data/docs/TaxRateCreateRequest.md +2 -0
  17. data/docs/TaxRateDetailsResponse.md +2 -0
  18. data/docs/TaxRateUpdateRequest.md +2 -0
  19. data/docs/TaxType.md +15 -0
  20. data/lib/payjpv2/api/checkout_sessions_api.rb +60 -0
  21. data/lib/payjpv2/models/checkout_session_create_request.rb +11 -1
  22. data/lib/payjpv2/models/checkout_session_details_response.rb +23 -1
  23. data/lib/payjpv2/models/line_item_request.rb +14 -0
  24. data/lib/payjpv2/models/payment_flow_create_request.rb +11 -1
  25. data/lib/payjpv2/models/payment_flow_response.rb +23 -1
  26. data/lib/payjpv2/models/payment_flow_update_request.rb +11 -1
  27. data/lib/payjpv2/models/redirect_options_request.rb +206 -0
  28. data/lib/payjpv2/models/redirect_options_response.rb +208 -0
  29. data/lib/payjpv2/models/setup_flow_cancel_request.rb +1 -1
  30. data/lib/payjpv2/models/setup_flow_cancellation_reason.rb +2 -1
  31. data/lib/payjpv2/models/setup_flow_create_request.rb +11 -1
  32. data/lib/payjpv2/models/setup_flow_response.rb +23 -1
  33. data/lib/payjpv2/models/setup_flow_update_request.rb +11 -1
  34. data/lib/payjpv2/models/tax_rate_create_request.rb +11 -1
  35. data/lib/payjpv2/models/tax_rate_details_response.rb +13 -1
  36. data/lib/payjpv2/models/tax_rate_update_request.rb +11 -1
  37. data/lib/payjpv2/models/tax_type.rb +39 -0
  38. data/lib/payjpv2/version.rb +1 -1
  39. data/lib/payjpv2.rb +3 -0
  40. data/spec/api/checkout_sessions_api_spec.rb +33 -0
  41. data/spec/models/checkout_session_create_request_spec.rb +6 -0
  42. data/spec/models/checkout_session_details_response_spec.rb +6 -0
  43. data/spec/models/payment_flow_create_request_spec.rb +6 -0
  44. data/spec/models/payment_flow_response_spec.rb +6 -0
  45. data/spec/models/payment_flow_update_request_spec.rb +6 -0
  46. data/spec/models/redirect_options_request_spec.rb +36 -0
  47. data/spec/models/redirect_options_response_spec.rb +36 -0
  48. data/spec/models/setup_flow_create_request_spec.rb +6 -0
  49. data/spec/models/setup_flow_response_spec.rb +6 -0
  50. data/spec/models/setup_flow_update_request_spec.rb +6 -0
  51. data/spec/models/tax_rate_create_request_spec.rb +6 -0
  52. data/spec/models/tax_rate_details_response_spec.rb +6 -0
  53. data/spec/models/tax_rate_update_request_spec.rb +6 -0
  54. data/spec/models/tax_type_spec.rb +30 -0
  55. metadata +13 -1
@@ -42,6 +42,9 @@ module PAYJPv2
42
42
  # 顧客が支払いを完了後かキャンセルした後にリダイレクトされる URL。アプリにリダイレクトしたい場合は URI Scheme を指定できます。confirm=true の場合のみ指定できます。
43
43
  attr_accessor :return_url
44
44
 
45
+ # return_url へリダイレクトする際のオプション
46
+ attr_accessor :redirect_options
47
+
45
48
  # オブジェクトにセットする任意の文字列。
46
49
  attr_accessor :description
47
50
 
@@ -82,6 +85,7 @@ module PAYJPv2
82
85
  :capture_method => :capture_method,
83
86
  :confirm => :confirm,
84
87
  :return_url => :return_url,
88
+ :redirect_options => :redirect_options,
85
89
  :description => :description,
86
90
  :metadata => :metadata
87
91
  }
@@ -109,6 +113,7 @@ module PAYJPv2
109
113
  :capture_method => :'CaptureMethod',
110
114
  :confirm => :'Boolean',
111
115
  :return_url => :'String',
116
+ :redirect_options => :'RedirectOptionsRequest',
112
117
  :description => :'String',
113
118
  :metadata => :'Hash<String, MetadataValue>'
114
119
  }
@@ -180,6 +185,10 @@ module PAYJPv2
180
185
  self.return_url = attributes[:return_url]
181
186
  end
182
187
 
188
+ if attributes.key?(:redirect_options)
189
+ self.redirect_options = attributes[:redirect_options]
190
+ end
191
+
183
192
  if attributes.key?(:description)
184
193
  self.description = attributes[:description]
185
194
  end
@@ -233,6 +242,7 @@ module PAYJPv2
233
242
  capture_method == o.capture_method &&
234
243
  confirm == o.confirm &&
235
244
  return_url == o.return_url &&
245
+ redirect_options == o.redirect_options &&
236
246
  description == o.description &&
237
247
  metadata == o.metadata
238
248
  end
@@ -246,7 +256,7 @@ module PAYJPv2
246
256
  # Calculates hash code according to all attributes.
247
257
  # @return [Integer] Hash code
248
258
  def hash
249
- [amount, customer_id, payment_method_id, payment_method_options, payment_method_types, currency, capture_method, confirm, return_url, description, metadata].hash
259
+ [amount, customer_id, payment_method_id, payment_method_options, payment_method_types, currency, capture_method, confirm, return_url, redirect_options, description, metadata].hash
250
260
  end
251
261
 
252
262
  # Builds the object from hash
@@ -54,6 +54,9 @@ module PAYJPv2
54
54
 
55
55
  attr_accessor :return_url
56
56
 
57
+ # return_url へリダイレクトする際のオプション
58
+ attr_accessor :redirect_options
59
+
57
60
  # 支払いの確定方法 | 値 | |:---| | **automatic**: (デフォルト) 顧客が支払いを承認すると、自動的に確定させます。 | | **manual**: 顧客が支払いを承認すると一旦確定を保留し、後で Capture API を使用して確定します。(すべての支払い方法がこれをサポートしているわけではありません)。 |
58
61
  attr_accessor :capture_method
59
62
 
@@ -115,6 +118,7 @@ module PAYJPv2
115
118
  :status => :status,
116
119
  :next_action => :next_action,
117
120
  :return_url => :return_url,
121
+ :redirect_options => :redirect_options,
118
122
  :capture_method => :capture_method,
119
123
  :last_payment_error => :last_payment_error,
120
124
  :cancellation_reason => :cancellation_reason,
@@ -155,6 +159,7 @@ module PAYJPv2
155
159
  :status => :'PaymentFlowStatus',
156
160
  :next_action => :'Hash<String, Object>',
157
161
  :return_url => :'String',
162
+ :redirect_options => :'RedirectOptionsResponse',
158
163
  :capture_method => :'CaptureMethod',
159
164
  :last_payment_error => :'Hash<String, Object>',
160
165
  :cancellation_reason => :'PaymentFlowCancellationReason',
@@ -302,6 +307,12 @@ module PAYJPv2
302
307
  self.return_url = nil
303
308
  end
304
309
 
310
+ if attributes.key?(:redirect_options)
311
+ self.redirect_options = attributes[:redirect_options]
312
+ else
313
+ self.redirect_options = nil
314
+ end
315
+
305
316
  if attributes.key?(:capture_method)
306
317
  self.capture_method = attributes[:capture_method]
307
318
  else
@@ -433,6 +444,16 @@ module PAYJPv2
433
444
  @status = status
434
445
  end
435
446
 
447
+ # Custom attribute writer method with validation
448
+ # @param [Object] redirect_options Value to be assigned
449
+ def redirect_options=(redirect_options)
450
+ if redirect_options.nil?
451
+ raise ArgumentError, 'redirect_options cannot be nil'
452
+ end
453
+
454
+ @redirect_options = redirect_options
455
+ end
456
+
436
457
  # Custom attribute writer method with validation
437
458
  # @param [Object] capture_method Value to be assigned
438
459
  def capture_method=(capture_method)
@@ -494,6 +515,7 @@ module PAYJPv2
494
515
  status == o.status &&
495
516
  next_action == o.next_action &&
496
517
  return_url == o.return_url &&
518
+ redirect_options == o.redirect_options &&
497
519
  capture_method == o.capture_method &&
498
520
  last_payment_error == o.last_payment_error &&
499
521
  cancellation_reason == o.cancellation_reason &&
@@ -513,7 +535,7 @@ module PAYJPv2
513
535
  # Calculates hash code according to all attributes.
514
536
  # @return [Integer] Hash code
515
537
  def hash
516
- [object, id, livemode, amount, currency, amount_capturable, amount_received, client_secret, customer_id, description, payment_method_id, payment_method_options, payment_method_types, status, next_action, return_url, capture_method, last_payment_error, cancellation_reason, canceled_at, expired_at, metadata, created_at, updated_at].hash
538
+ [object, id, livemode, amount, currency, amount_capturable, amount_received, client_secret, customer_id, description, payment_method_id, payment_method_options, payment_method_types, status, next_action, return_url, redirect_options, capture_method, last_payment_error, cancellation_reason, canceled_at, expired_at, metadata, created_at, updated_at].hash
517
539
  end
518
540
 
519
541
  # Builds the object from hash
@@ -33,6 +33,9 @@ module PAYJPv2
33
33
  # 顧客が支払いを完了後かキャンセルした後にリダイレクトされる URL。アプリにリダイレクトしたい場合は URI Scheme を指定できます。
34
34
  attr_accessor :return_url
35
35
 
36
+ # return_url へリダイレクトする際のオプション
37
+ attr_accessor :redirect_options
38
+
36
39
  # オブジェクトにセットする任意の文字列。
37
40
  attr_accessor :description
38
41
 
@@ -48,6 +51,7 @@ module PAYJPv2
48
51
  :payment_method_options => :payment_method_options,
49
52
  :payment_method_types => :payment_method_types,
50
53
  :return_url => :return_url,
54
+ :redirect_options => :redirect_options,
51
55
  :description => :description,
52
56
  :metadata => :metadata
53
57
  }
@@ -72,6 +76,7 @@ module PAYJPv2
72
76
  :payment_method_options => :'PaymentFlowPaymentMethodOptionsRequest',
73
77
  :payment_method_types => :'Array<PaymentMethodTypes>',
74
78
  :return_url => :'String',
79
+ :redirect_options => :'RedirectOptionsRequest',
75
80
  :description => :'String',
76
81
  :metadata => :'Hash<String, MetadataValue>'
77
82
  }
@@ -125,6 +130,10 @@ module PAYJPv2
125
130
  self.return_url = attributes[:return_url]
126
131
  end
127
132
 
133
+ if attributes.key?(:redirect_options)
134
+ self.redirect_options = attributes[:redirect_options]
135
+ end
136
+
128
137
  if attributes.key?(:description)
129
138
  self.description = attributes[:description]
130
139
  end
@@ -165,6 +174,7 @@ module PAYJPv2
165
174
  payment_method_options == o.payment_method_options &&
166
175
  payment_method_types == o.payment_method_types &&
167
176
  return_url == o.return_url &&
177
+ redirect_options == o.redirect_options &&
168
178
  description == o.description &&
169
179
  metadata == o.metadata
170
180
  end
@@ -178,7 +188,7 @@ module PAYJPv2
178
188
  # Calculates hash code according to all attributes.
179
189
  # @return [Integer] Hash code
180
190
  def hash
181
- [amount, customer_id, payment_method_id, payment_method_options, payment_method_types, return_url, description, metadata].hash
191
+ [amount, customer_id, payment_method_id, payment_method_options, payment_method_types, return_url, redirect_options, description, metadata].hash
182
192
  end
183
193
 
184
194
  # Builds the object from hash
@@ -0,0 +1,206 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PAYJPv2
17
+ class RedirectOptionsRequest
18
+ # return_url へリダイレクトする際、クエリパラメーターに client_secret を付与するかどうか。デフォルトは `true` です。
19
+ attr_accessor :include_client_secret
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :include_client_secret => :include_client_secret
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :include_client_secret => :'Boolean'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::RedirectOptionsRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::RedirectOptionsRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:include_client_secret)
68
+ self.include_client_secret = attributes[:include_client_secret]
69
+ end
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ include_client_secret == o.include_client_secret
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Integer] Hash code
88
+ def hash
89
+ [include_client_secret].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ attributes = attributes.transform_keys(&:to_sym)
98
+ transformed_hash = {}
99
+ openapi_types.each_pair do |key, type|
100
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
101
+ transformed_hash["#{key}"] = nil
102
+ elsif type =~ /\AArray<(.*)>/i
103
+ # check to ensure the input is an array given that the attribute
104
+ # is documented as an array but the input is not
105
+ if attributes[attribute_map[key]].is_a?(Array)
106
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
107
+ end
108
+ elsif !attributes[attribute_map[key]].nil?
109
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
110
+ end
111
+ end
112
+ new(transformed_hash)
113
+ end
114
+
115
+ # Deserializes the data based on type
116
+ # @param string type Data type
117
+ # @param string value Value to be deserialized
118
+ # @return [Object] Deserialized data
119
+ def self._deserialize(type, value)
120
+ case type.to_sym
121
+ when :Time
122
+ Time.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :Boolean
132
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ # models (e.g. Pet) or oneOf
153
+ klass = PAYJPv2.const_get(type)
154
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
155
+ end
156
+ end
157
+
158
+ # Returns the string representation of the object
159
+ # @return [String] String presentation of the object
160
+ def to_s
161
+ to_hash.to_s
162
+ end
163
+
164
+ # to_body is an alias to to_hash (backward compatibility)
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_body
167
+ to_hash
168
+ end
169
+
170
+ # Returns the object in the form of hash
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_hash
173
+ hash = {}
174
+ self.class.attribute_map.each_pair do |attr, param|
175
+ value = self.send(attr)
176
+ if value.nil?
177
+ is_nullable = self.class.openapi_nullable.include?(attr)
178
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
179
+ end
180
+
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map { |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+
204
+ end
205
+
206
+ end
@@ -0,0 +1,208 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PAYJPv2
17
+ class RedirectOptionsResponse
18
+ # return_url へリダイレクトする際、クエリパラメーターに client_secret を付与するかどうか。デフォルトは `true` です。
19
+ attr_accessor :include_client_secret
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :include_client_secret => :include_client_secret
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :include_client_secret => :'Boolean'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::RedirectOptionsResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::RedirectOptionsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:include_client_secret)
68
+ self.include_client_secret = attributes[:include_client_secret]
69
+ else
70
+ self.include_client_secret = true
71
+ end
72
+ end
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] Object to be compared
76
+ def ==(o)
77
+ return true if self.equal?(o)
78
+ self.class == o.class &&
79
+ include_client_secret == o.include_client_secret
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] Object to be compared
84
+ def eql?(o)
85
+ self == o
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Integer] Hash code
90
+ def hash
91
+ [include_client_secret].hash
92
+ end
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def self.build_from_hash(attributes)
98
+ return nil unless attributes.is_a?(Hash)
99
+ attributes = attributes.transform_keys(&:to_sym)
100
+ transformed_hash = {}
101
+ openapi_types.each_pair do |key, type|
102
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
103
+ transformed_hash["#{key}"] = nil
104
+ elsif type =~ /\AArray<(.*)>/i
105
+ # check to ensure the input is an array given that the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[attribute_map[key]].is_a?(Array)
108
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
109
+ end
110
+ elsif !attributes[attribute_map[key]].nil?
111
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
112
+ end
113
+ end
114
+ new(transformed_hash)
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def self._deserialize(type, value)
122
+ case type.to_sym
123
+ when :Time
124
+ Time.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :Boolean
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ # models (e.g. Pet) or oneOf
155
+ klass = PAYJPv2.const_get(type)
156
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map { |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+
208
+ end
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module PAYJPv2
17
17
  class SetupFlowCancelRequest
18
- # この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 |
18
+ # この SetupFlow のキャンセル理由。 | 値 | |:---| | **abandoned**: 顧客が SetupFlow を完了しなかった場合。 | | **requested_by_customer**: 顧客がキャンセルを要求した場合。 | | **duplicate**: 支払い方法が重複している場合。 | `expired` はシステムが自動的に設定する値のため、リクエストでは指定できません。
19
19
  attr_accessor :cancellation_reason
20
20
 
21
21
  class EnumAttributeValidator
@@ -17,10 +17,11 @@ module PAYJPv2
17
17
  class SetupFlowCancellationReason
18
18
  ABANDONED = "abandoned".freeze
19
19
  DUPLICATE = "duplicate".freeze
20
+ EXPIRED = "expired".freeze
20
21
  REQUESTED_BY_CUSTOMER = "requested_by_customer".freeze
21
22
 
22
23
  def self.all_vars
23
- @all_vars ||= [ABANDONED, DUPLICATE, REQUESTED_BY_CUSTOMER].freeze
24
+ @all_vars ||= [ABANDONED, DUPLICATE, EXPIRED, REQUESTED_BY_CUSTOMER].freeze
24
25
  end
25
26
 
26
27
  # Builds the enum from string
@@ -27,6 +27,9 @@ module PAYJPv2
27
27
  # 支払い方法が今後どのように使用されるかを指定します。指定されていない場合、この値はデフォルトで `off_session` になります。 | 値 | |:---| | **off_session**: 定期課金など、顧客がカートなどの決済フローにいるかどうか不明な場合は `off_session` を使用してください。 | | **on_session**: 顧客がカートなどの決済フローにいる場合にのみ支払い方法を利用する場合は `on_session` を使用してください。 |
28
28
  attr_accessor :usage
29
29
 
30
+ # return_url へリダイレクトする際のオプション
31
+ attr_accessor :redirect_options
32
+
30
33
  # 説明。
31
34
  attr_accessor :description
32
35
 
@@ -62,6 +65,7 @@ module PAYJPv2
62
65
  :payment_method_options => :payment_method_options,
63
66
  :payment_method_types => :payment_method_types,
64
67
  :usage => :usage,
68
+ :redirect_options => :redirect_options,
65
69
  :description => :description,
66
70
  :metadata => :metadata
67
71
  }
@@ -84,6 +88,7 @@ module PAYJPv2
84
88
  :payment_method_options => :'SetupFlowPaymentMethodOptionsRequest',
85
89
  :payment_method_types => :'Array<String>',
86
90
  :usage => :'Usage',
91
+ :redirect_options => :'RedirectOptionsRequest',
87
92
  :description => :'String',
88
93
  :metadata => :'Hash<String, MetadataValue>'
89
94
  }
@@ -129,6 +134,10 @@ module PAYJPv2
129
134
  self.usage = attributes[:usage]
130
135
  end
131
136
 
137
+ if attributes.key?(:redirect_options)
138
+ self.redirect_options = attributes[:redirect_options]
139
+ end
140
+
132
141
  if attributes.key?(:description)
133
142
  self.description = attributes[:description]
134
143
  end
@@ -149,6 +158,7 @@ module PAYJPv2
149
158
  payment_method_options == o.payment_method_options &&
150
159
  payment_method_types == o.payment_method_types &&
151
160
  usage == o.usage &&
161
+ redirect_options == o.redirect_options &&
152
162
  description == o.description &&
153
163
  metadata == o.metadata
154
164
  end
@@ -162,7 +172,7 @@ module PAYJPv2
162
172
  # Calculates hash code according to all attributes.
163
173
  # @return [Integer] Hash code
164
174
  def hash
165
- [customer_id, payment_method_options, payment_method_types, usage, description, metadata].hash
175
+ [customer_id, payment_method_options, payment_method_types, usage, redirect_options, description, metadata].hash
166
176
  end
167
177
 
168
178
  # Builds the object from hash