payjpv2 1.1.0 → 1.3.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 (128) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +13 -2
  4. data/docs/BankAccountStatus.md +15 -0
  5. data/docs/BankInfoResponse.md +2 -2
  6. data/docs/CardBrand.md +15 -0
  7. data/docs/CardFunding.md +15 -0
  8. data/docs/CheckoutSessionCreateRequest.md +3 -1
  9. data/docs/CheckoutSessionDetailsResponse.md +2 -0
  10. data/docs/CheckoutSessionPaymentMethodOptionsCardRequest.md +2 -2
  11. data/docs/CheckoutSessionsApi.md +70 -0
  12. data/docs/DisplayPreferenceRequest.md +1 -1
  13. data/docs/PaymentFlowCancelRequest.md +1 -1
  14. data/docs/PaymentFlowCreateRequest.md +2 -0
  15. data/docs/PaymentFlowPaymentMethodOptionsCardRequest.md +2 -2
  16. data/docs/PaymentFlowResponse.md +2 -0
  17. data/docs/PaymentFlowUpdateRequest.md +2 -0
  18. data/docs/PaymentMethodCardDetailsResponse.md +4 -2
  19. data/docs/PaymentMethodConfigurationDisplayPreference.md +2 -2
  20. data/docs/PaymentMethodConfigurationPreference.md +15 -0
  21. data/docs/PaymentMethodConfigurationValue.md +15 -0
  22. data/docs/PaymentTransactionsApi.md +4 -4
  23. data/docs/ProductCreateRequest.md +1 -1
  24. data/docs/RedirectOptionsRequest.md +18 -0
  25. data/docs/RedirectOptionsResponse.md +18 -0
  26. data/docs/RequestExtendedAuthorization.md +15 -0
  27. data/docs/RequestThreeDSecure.md +15 -0
  28. data/docs/SetupFlowCancelRequest.md +1 -1
  29. data/docs/SetupFlowCreateRequest.md +2 -0
  30. data/docs/SetupFlowPaymentMethodOptionsCardRequest.md +1 -1
  31. data/docs/SetupFlowResponse.md +2 -0
  32. data/docs/SetupFlowUpdateRequest.md +2 -0
  33. data/docs/TaxRateCreateRequest.md +2 -0
  34. data/docs/TaxRateDetailsResponse.md +2 -0
  35. data/docs/TaxRateUpdateRequest.md +2 -0
  36. data/docs/TaxType.md +15 -0
  37. data/lib/payjpv2/api/checkout_sessions_api.rb +60 -0
  38. data/lib/payjpv2/api/payment_transactions_api.rb +2 -2
  39. data/lib/payjpv2/models/balance_state.rb +4 -3
  40. data/lib/payjpv2/models/bank_account_status.rb +42 -0
  41. data/lib/payjpv2/models/bank_info_response.rb +24 -2
  42. data/lib/payjpv2/models/capture_method.rb +4 -3
  43. data/lib/payjpv2/models/card_brand.rb +45 -0
  44. data/lib/payjpv2/models/card_funding.rb +41 -0
  45. data/lib/payjpv2/models/checkout_session_create_request.rb +12 -2
  46. data/lib/payjpv2/models/checkout_session_details_response.rb +23 -1
  47. data/lib/payjpv2/models/checkout_session_mode.rb +4 -3
  48. data/lib/payjpv2/models/checkout_session_payment_method_options_card_request.rb +2 -22
  49. data/lib/payjpv2/models/checkout_session_status.rb +4 -3
  50. data/lib/payjpv2/models/checkout_session_submit_type.rb +4 -3
  51. data/lib/payjpv2/models/checkout_session_ui_mode.rb +4 -3
  52. data/lib/payjpv2/models/country.rb +4 -3
  53. data/lib/payjpv2/models/currency.rb +4 -3
  54. data/lib/payjpv2/models/customer_creation.rb +4 -3
  55. data/lib/payjpv2/models/display_preference_request.rb +6 -6
  56. data/lib/payjpv2/models/line_item_request.rb +14 -0
  57. data/lib/payjpv2/models/locale.rb +4 -3
  58. data/lib/payjpv2/models/payment_dispute_reason.rb +4 -3
  59. data/lib/payjpv2/models/payment_dispute_status.rb +4 -3
  60. data/lib/payjpv2/models/payment_flow_cancel_request.rb +1 -11
  61. data/lib/payjpv2/models/payment_flow_cancellation_reason.rb +4 -3
  62. data/lib/payjpv2/models/payment_flow_create_request.rb +11 -1
  63. data/lib/payjpv2/models/payment_flow_payment_method_options_card_request.rb +2 -22
  64. data/lib/payjpv2/models/payment_flow_response.rb +23 -1
  65. data/lib/payjpv2/models/payment_flow_status.rb +4 -3
  66. data/lib/payjpv2/models/payment_flow_update_request.rb +11 -1
  67. data/lib/payjpv2/models/payment_method_card_details_response.rb +40 -7
  68. data/lib/payjpv2/models/payment_method_configuration_display_preference.rb +2 -22
  69. data/lib/payjpv2/models/payment_method_configuration_preference.rb +42 -0
  70. data/lib/payjpv2/models/payment_method_configuration_value.rb +41 -0
  71. data/lib/payjpv2/models/payment_method_types.rb +4 -3
  72. data/lib/payjpv2/models/payment_refund_reason.rb +4 -3
  73. data/lib/payjpv2/models/payment_refund_status.rb +4 -3
  74. data/lib/payjpv2/models/payment_transaction_type.rb +4 -3
  75. data/lib/payjpv2/models/price_type.rb +4 -3
  76. data/lib/payjpv2/models/product_create_request.rb +15 -1
  77. data/lib/payjpv2/models/redirect_options_request.rb +206 -0
  78. data/lib/payjpv2/models/redirect_options_response.rb +208 -0
  79. data/lib/payjpv2/models/request_extended_authorization.rb +42 -0
  80. data/lib/payjpv2/models/request_three_d_secure.rb +41 -0
  81. data/lib/payjpv2/models/setup_flow_cancel_request.rb +1 -1
  82. data/lib/payjpv2/models/setup_flow_cancellation_reason.rb +6 -4
  83. data/lib/payjpv2/models/setup_flow_create_request.rb +11 -1
  84. data/lib/payjpv2/models/setup_flow_payment_method_options_card_request.rb +1 -11
  85. data/lib/payjpv2/models/setup_flow_response.rb +23 -1
  86. data/lib/payjpv2/models/setup_flow_status.rb +4 -3
  87. data/lib/payjpv2/models/setup_flow_update_request.rb +11 -1
  88. data/lib/payjpv2/models/statement_subject.rb +4 -3
  89. data/lib/payjpv2/models/statement_type.rb +4 -3
  90. data/lib/payjpv2/models/tax_rate_create_request.rb +11 -1
  91. data/lib/payjpv2/models/tax_rate_details_response.rb +13 -1
  92. data/lib/payjpv2/models/tax_rate_update_request.rb +11 -1
  93. data/lib/payjpv2/models/tax_type.rb +40 -0
  94. data/lib/payjpv2/models/usage.rb +4 -3
  95. data/lib/payjpv2/version.rb +1 -1
  96. data/lib/payjpv2.rb +10 -0
  97. data/spec/api/checkout_sessions_api_spec.rb +33 -0
  98. data/spec/api/payment_transactions_api_spec.rb +2 -2
  99. data/spec/integration/anyof_deserialization_spec.rb +8 -1
  100. data/spec/models/bank_account_status_spec.rb +30 -0
  101. data/spec/models/card_brand_spec.rb +30 -0
  102. data/spec/models/card_funding_spec.rb +30 -0
  103. data/spec/models/checkout_session_create_request_spec.rb +6 -0
  104. data/spec/models/checkout_session_details_response_spec.rb +6 -0
  105. data/spec/models/checkout_session_payment_method_options_card_request_spec.rb +0 -8
  106. data/spec/models/display_preference_request_spec.rb +0 -4
  107. data/spec/models/payment_flow_cancel_request_spec.rb +0 -4
  108. data/spec/models/payment_flow_create_request_spec.rb +6 -0
  109. data/spec/models/payment_flow_payment_method_options_card_request_spec.rb +0 -8
  110. data/spec/models/payment_flow_response_spec.rb +6 -0
  111. data/spec/models/payment_flow_update_request_spec.rb +6 -0
  112. data/spec/models/payment_method_card_details_response_spec.rb +6 -0
  113. data/spec/models/payment_method_configuration_display_preference_spec.rb +0 -8
  114. data/spec/models/payment_method_configuration_preference_spec.rb +30 -0
  115. data/spec/models/payment_method_configuration_value_spec.rb +30 -0
  116. data/spec/models/redirect_options_request_spec.rb +36 -0
  117. data/spec/models/redirect_options_response_spec.rb +36 -0
  118. data/spec/models/request_extended_authorization_spec.rb +30 -0
  119. data/spec/models/request_three_d_secure_spec.rb +30 -0
  120. data/spec/models/setup_flow_create_request_spec.rb +6 -0
  121. data/spec/models/setup_flow_payment_method_options_card_request_spec.rb +0 -4
  122. data/spec/models/setup_flow_response_spec.rb +6 -0
  123. data/spec/models/setup_flow_update_request_spec.rb +6 -0
  124. data/spec/models/tax_rate_create_request_spec.rb +6 -0
  125. data/spec/models/tax_rate_details_response_spec.rb +6 -0
  126. data/spec/models/tax_rate_update_request_spec.rb +6 -0
  127. data/spec/models/tax_type_spec.rb +30 -0
  128. metadata +41 -1
@@ -27,15 +27,16 @@ module PAYJPv2
27
27
  # @param [String] The enum value in the form of the string
28
28
  # @return [String] The enum value
29
29
  def self.build_from_hash(value)
30
- new.build_from_hash(value)
30
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
31
+ value
31
32
  end
32
33
 
33
34
  # Builds the enum from string
34
35
  # @param [String] The enum value in the form of the string
35
36
  # @return [String] The enum value
36
37
  def build_from_hash(value)
37
- return value if PaymentRefundReason.all_vars.include?(value)
38
- raise "Invalid ENUM value #{value} for class #PaymentRefundReason"
38
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
39
+ value
39
40
  end
40
41
  end
41
42
  end
@@ -29,15 +29,16 @@ module PAYJPv2
29
29
  # @param [String] The enum value in the form of the string
30
30
  # @return [String] The enum value
31
31
  def self.build_from_hash(value)
32
- new.build_from_hash(value)
32
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
33
+ value
33
34
  end
34
35
 
35
36
  # Builds the enum from string
36
37
  # @param [String] The enum value in the form of the string
37
38
  # @return [String] The enum value
38
39
  def build_from_hash(value)
39
- return value if PaymentRefundStatus.all_vars.include?(value)
40
- raise "Invalid ENUM value #{value} for class #PaymentRefundStatus"
40
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
41
+ value
41
42
  end
42
43
  end
43
44
  end
@@ -28,15 +28,16 @@ module PAYJPv2
28
28
  # @param [String] The enum value in the form of the string
29
29
  # @return [String] The enum value
30
30
  def self.build_from_hash(value)
31
- new.build_from_hash(value)
31
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
32
+ value
32
33
  end
33
34
 
34
35
  # Builds the enum from string
35
36
  # @param [String] The enum value in the form of the string
36
37
  # @return [String] The enum value
37
38
  def build_from_hash(value)
38
- return value if PaymentTransactionType.all_vars.include?(value)
39
- raise "Invalid ENUM value #{value} for class #PaymentTransactionType"
39
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
40
+ value
40
41
  end
41
42
  end
42
43
  end
@@ -25,15 +25,16 @@ module PAYJPv2
25
25
  # @param [String] The enum value in the form of the string
26
26
  # @return [String] The enum value
27
27
  def self.build_from_hash(value)
28
- new.build_from_hash(value)
28
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
29
+ value
29
30
  end
30
31
 
31
32
  # Builds the enum from string
32
33
  # @param [String] The enum value in the form of the string
33
34
  # @return [String] The enum value
34
35
  def build_from_hash(value)
35
- return value if PriceType.all_vars.include?(value)
36
- raise "Invalid ENUM value #{value} for class #PriceType"
36
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
37
+ value
37
38
  end
38
39
  end
39
40
  end
@@ -18,7 +18,7 @@ module PAYJPv2
18
18
  # Checkout などで顧客に表示される商品名
19
19
  attr_accessor :name
20
20
 
21
- # 商品 ID
21
+ # 商品 ID(255文字以内)
22
22
  attr_accessor :id
23
23
 
24
24
  # 商品が購入可能かどうか
@@ -128,6 +128,20 @@ module PAYJPv2
128
128
  @name = name
129
129
  end
130
130
 
131
+ # Custom attribute writer method with validation
132
+ # @param [Object] id Value to be assigned
133
+ def id=(id)
134
+ if id.nil?
135
+ raise ArgumentError, 'id cannot be nil'
136
+ end
137
+
138
+ if id.to_s.length > 255
139
+ raise ArgumentError, 'invalid value for "id", the character length must be smaller than or equal to 255.'
140
+ end
141
+
142
+ @id = id
143
+ end
144
+
131
145
  # Checks equality by comparing each attribute.
132
146
  # @param [Object] Object to be compared
133
147
  def ==(o)
@@ -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
@@ -0,0 +1,42 @@
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 RequestExtendedAuthorization
18
+ IF_AVAILABLE = "if_available".freeze
19
+ MUST_EXTEND = "must_extend".freeze
20
+ NEVER = "never".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [IF_AVAILABLE, MUST_EXTEND, NEVER].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
31
+ value
32
+ end
33
+
34
+ # Builds the enum from string
35
+ # @param [String] The enum value in the form of the string
36
+ # @return [String] The enum value
37
+ def build_from_hash(value)
38
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
39
+ value
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,41 @@
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 RequestThreeDSecure
18
+ ANY = "any".freeze
19
+ AUTOMATIC = "automatic".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [ANY, AUTOMATIC].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
30
+ value
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
38
+ value
39
+ end
40
+ end
41
+ 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,25 +17,27 @@ 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
28
  # @param [String] The enum value in the form of the string
28
29
  # @return [String] The enum value
29
30
  def self.build_from_hash(value)
30
- new.build_from_hash(value)
31
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
32
+ value
31
33
  end
32
34
 
33
35
  # Builds the enum from string
34
36
  # @param [String] The enum value in the form of the string
35
37
  # @return [String] The enum value
36
38
  def build_from_hash(value)
37
- return value if SetupFlowCancellationReason.all_vars.include?(value)
38
- raise "Invalid ENUM value #{value} for class #SetupFlowCancellationReason"
39
+ # Return unknown values as-is so that enum values added on the API side do not break older clients
40
+ value
39
41
  end
40
42
  end
41
43
  end