pcp-server-ruby-sdk 1.12.0 → 1.13.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 (168) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/api-definition.yaml +323 -41
  5. data/lib/PCP-server-Ruby-SDK/endpoints/payment_intent_api_client.rb +37 -0
  6. data/lib/PCP-server-Ruby-SDK/models/address.rb +9 -237
  7. data/lib/PCP-server-Ruby-SDK/models/address_personal.rb +10 -246
  8. data/lib/PCP-server-Ruby-SDK/models/amount_of_money.rb +4 -195
  9. data/lib/PCP-server-Ruby-SDK/models/api_error.rb +27 -232
  10. data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_header_information.rb +6 -194
  11. data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_information.rb +8 -229
  12. data/lib/PCP-server-Ruby-SDK/models/bank_account_information.rb +11 -207
  13. data/lib/PCP-server-Ruby-SDK/models/bank_payout_method_specific_input.rb +4 -187
  14. data/lib/PCP-server-Ruby-SDK/models/cancel_item.rb +6 -195
  15. data/lib/PCP-server-Ruby-SDK/models/cancel_payment_request.rb +6 -222
  16. data/lib/PCP-server-Ruby-SDK/models/cancel_payment_response.rb +4 -190
  17. data/lib/PCP-server-Ruby-SDK/models/cancel_request.rb +6 -224
  18. data/lib/PCP-server-Ruby-SDK/models/cancel_response.rb +4 -190
  19. data/lib/PCP-server-Ruby-SDK/models/capture_output.rb +9 -214
  20. data/lib/PCP-server-Ruby-SDK/models/capture_payment_request.rb +14 -253
  21. data/lib/PCP-server-Ruby-SDK/models/capture_payment_response.rb +7 -239
  22. data/lib/PCP-server-Ruby-SDK/models/card_fraud_results.rb +29 -184
  23. data/lib/PCP-server-Ruby-SDK/models/card_info.rb +3 -182
  24. data/lib/PCP-server-Ruby-SDK/models/card_payment_details.rb +8 -210
  25. data/lib/PCP-server-Ruby-SDK/models/card_payment_method_specific_input.rb +32 -307
  26. data/lib/PCP-server-Ruby-SDK/models/card_payment_method_specific_output.rb +6 -210
  27. data/lib/PCP-server-Ruby-SDK/models/card_recurrence_details.rb +12 -186
  28. data/lib/PCP-server-Ruby-SDK/models/cart_item_data.rb +10 -0
  29. data/lib/PCP-server-Ruby-SDK/models/cart_item_input.rb +5 -198
  30. data/lib/PCP-server-Ruby-SDK/models/cart_item_invoice_data.rb +5 -184
  31. data/lib/PCP-server-Ruby-SDK/models/cart_item_order_status.rb +4 -213
  32. data/lib/PCP-server-Ruby-SDK/models/cart_item_patch.rb +5 -200
  33. data/lib/PCP-server-Ruby-SDK/models/cart_item_result.rb +5 -200
  34. data/lib/PCP-server-Ruby-SDK/models/cart_item_supplier_references.rb +6 -195
  35. data/lib/PCP-server-Ruby-SDK/models/checkout_references.rb +4 -192
  36. data/lib/PCP-server-Ruby-SDK/models/checkout_response.rb +15 -319
  37. data/lib/PCP-server-Ruby-SDK/models/checkouts_response.rb +4 -193
  38. data/lib/PCP-server-Ruby-SDK/models/company_information.rb +3 -182
  39. data/lib/PCP-server-Ruby-SDK/models/complete_financing_payment_method_specific_input.rb +12 -202
  40. data/lib/PCP-server-Ruby-SDK/models/complete_order_request.rb +3 -181
  41. data/lib/PCP-server-Ruby-SDK/models/complete_payment_method_specific_input.rb +4 -191
  42. data/lib/PCP-server-Ruby-SDK/models/complete_payment_product840_specific_input.rb +7 -226
  43. data/lib/PCP-server-Ruby-SDK/models/complete_payment_request.rb +6 -209
  44. data/lib/PCP-server-Ruby-SDK/models/complete_payment_response.rb +5 -199
  45. data/lib/PCP-server-Ruby-SDK/models/complete_redirect_payment_method_specific_input.rb +4 -192
  46. data/lib/PCP-server-Ruby-SDK/models/contact_details.rb +4 -191
  47. data/lib/PCP-server-Ruby-SDK/models/create_checkout_request.rb +13 -240
  48. data/lib/PCP-server-Ruby-SDK/models/create_checkout_response.rb +16 -307
  49. data/lib/PCP-server-Ruby-SDK/models/create_commerce_case_response.rb +7 -219
  50. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent.rb +11 -0
  51. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent_request.rb +13 -0
  52. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent_response.rb +10 -0
  53. data/lib/PCP-server-Ruby-SDK/models/create_payment_response.rb +7 -218
  54. data/lib/PCP-server-Ruby-SDK/models/customer.rb +28 -260
  55. data/lib/PCP-server-Ruby-SDK/models/customer_account.rb +10 -44
  56. data/lib/PCP-server-Ruby-SDK/models/customer_device.rb +8 -209
  57. data/lib/PCP-server-Ruby-SDK/models/deliver_item.rb +6 -195
  58. data/lib/PCP-server-Ruby-SDK/models/deliver_request.rb +10 -246
  59. data/lib/PCP-server-Ruby-SDK/models/deliver_response.rb +4 -191
  60. data/lib/PCP-server-Ruby-SDK/models/delivery_information.rb +3 -185
  61. data/lib/PCP-server-Ruby-SDK/models/error_response.rb +4 -193
  62. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_input.rb +15 -203
  63. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_output.rb +10 -196
  64. data/lib/PCP-server-Ruby-SDK/models/fund_distribution.rb +12 -263
  65. data/lib/PCP-server-Ruby-SDK/models/fund_split.rb +5 -205
  66. data/lib/PCP-server-Ruby-SDK/models/fund_split_request.rb +3 -147
  67. data/lib/PCP-server-Ruby-SDK/models/fund_split_response.rb +10 -174
  68. data/lib/PCP-server-Ruby-SDK/models/installment_option.rb +13 -273
  69. data/lib/PCP-server-Ruby-SDK/models/link_information.rb +4 -196
  70. data/lib/PCP-server-Ruby-SDK/models/merchant_action.rb +16 -194
  71. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_input.rb +13 -246
  72. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_output.rb +7 -219
  73. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_three_dsecure.rb +3 -179
  74. data/lib/PCP-server-Ruby-SDK/models/model_base.rb +147 -0
  75. data/lib/PCP-server-Ruby-SDK/models/order.rb +7 -221
  76. data/lib/PCP-server-Ruby-SDK/models/order_item.rb +6 -197
  77. data/lib/PCP-server-Ruby-SDK/models/order_line_details_input.rb +29 -305
  78. data/lib/PCP-server-Ruby-SDK/models/order_line_details_patch.rb +5 -326
  79. data/lib/PCP-server-Ruby-SDK/models/order_line_details_result.rb +5 -326
  80. data/lib/PCP-server-Ruby-SDK/models/order_request.rb +7 -244
  81. data/lib/PCP-server-Ruby-SDK/models/order_response.rb +4 -192
  82. data/lib/PCP-server-Ruby-SDK/models/patch_checkout_request.rb +8 -228
  83. data/lib/PCP-server-Ruby-SDK/models/patch_commerce_case_request.rb +3 -183
  84. data/lib/PCP-server-Ruby-SDK/models/pause_payment_request.rb +2 -165
  85. data/lib/PCP-server-Ruby-SDK/models/pause_payment_response.rb +3 -186
  86. data/lib/PCP-server-Ruby-SDK/models/payee.rb +6 -204
  87. data/lib/PCP-server-Ruby-SDK/models/payment_creation_output.rb +3 -183
  88. data/lib/PCP-server-Ruby-SDK/models/payment_event.rb +19 -274
  89. data/lib/PCP-server-Ruby-SDK/models/payment_execution.rb +29 -335
  90. data/lib/PCP-server-Ruby-SDK/models/payment_execution_request.rb +4 -191
  91. data/lib/PCP-server-Ruby-SDK/models/payment_execution_specific_input.rb +6 -212
  92. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_request.rb +7 -205
  93. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_response.rb +5 -196
  94. data/lib/PCP-server-Ruby-SDK/models/payment_information_request.rb +10 -249
  95. data/lib/PCP-server-Ruby-SDK/models/payment_information_response.rb +30 -314
  96. data/lib/PCP-server-Ruby-SDK/models/payment_instructions.rb +8 -214
  97. data/lib/PCP-server-Ruby-SDK/models/payment_intent_output.rb +13 -0
  98. data/lib/PCP-server-Ruby-SDK/models/payment_intent_response.rb +13 -0
  99. data/lib/PCP-server-Ruby-SDK/models/payment_intent_response_data.rb +12 -0
  100. data/lib/PCP-server-Ruby-SDK/models/payment_method_specific_input.rb +9 -261
  101. data/lib/PCP-server-Ruby-SDK/models/payment_method_specific_input_for_intent.rb +9 -0
  102. data/lib/PCP-server-Ruby-SDK/models/payment_output.rb +11 -255
  103. data/lib/PCP-server-Ruby-SDK/models/payment_product302_specific_input.rb +11 -225
  104. data/lib/PCP-server-Ruby-SDK/models/payment_product3391_specific_input.rb +6 -197
  105. data/lib/PCP-server-Ruby-SDK/models/payment_product3391_specific_output.rb +3 -185
  106. data/lib/PCP-server-Ruby-SDK/models/payment_product3392_specific_input.rb +3 -185
  107. data/lib/PCP-server-Ruby-SDK/models/payment_product5002_specific_input.rb +7 -203
  108. data/lib/PCP-server-Ruby-SDK/models/payment_product771_specific_output.rb +3 -183
  109. data/lib/PCP-server-Ruby-SDK/models/payment_product840_customer_account.rb +6 -210
  110. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output.rb +5 -209
  111. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output_data.rb +11 -0
  112. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output_for_intent.rb +13 -0
  113. data/lib/PCP-server-Ruby-SDK/models/payment_references.rb +6 -184
  114. data/lib/PCP-server-Ruby-SDK/models/payment_references_for_refund.rb +12 -197
  115. data/lib/PCP-server-Ruby-SDK/models/payment_response.rb +6 -234
  116. data/lib/PCP-server-Ruby-SDK/models/payment_status_output.rb +6 -234
  117. data/lib/PCP-server-Ruby-SDK/models/payout_output.rb +5 -205
  118. data/lib/PCP-server-Ruby-SDK/models/payout_response.rb +6 -215
  119. data/lib/PCP-server-Ruby-SDK/models/personal_information.rb +11 -227
  120. data/lib/PCP-server-Ruby-SDK/models/personal_name.rb +5 -201
  121. data/lib/PCP-server-Ruby-SDK/models/positive_amount_of_money.rb +4 -196
  122. data/lib/PCP-server-Ruby-SDK/models/processing_mandate_information.rb +9 -254
  123. data/lib/PCP-server-Ruby-SDK/models/redirect_data.rb +3 -183
  124. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input.rb +14 -249
  125. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input_for_intent.rb +12 -0
  126. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output.rb +6 -211
  127. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_create_intent.rb +12 -0
  128. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_intent.rb +10 -0
  129. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input.rb +6 -205
  130. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input_data.rb +10 -0
  131. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product900_specific_input.rb +12 -177
  132. data/lib/PCP-server-Ruby-SDK/models/redirection_data.rb +11 -186
  133. data/lib/PCP-server-Ruby-SDK/models/references.rb +47 -205
  134. data/lib/PCP-server-Ruby-SDK/models/refresh_payment_request.rb +3 -186
  135. data/lib/PCP-server-Ruby-SDK/models/refund_error_response.rb +4 -193
  136. data/lib/PCP-server-Ruby-SDK/models/refund_output.rb +8 -211
  137. data/lib/PCP-server-Ruby-SDK/models/refund_payment_response.rb +7 -242
  138. data/lib/PCP-server-Ruby-SDK/models/refund_request.rb +6 -210
  139. data/lib/PCP-server-Ruby-SDK/models/return_information.rb +4 -194
  140. data/lib/PCP-server-Ruby-SDK/models/return_item.rb +6 -196
  141. data/lib/PCP-server-Ruby-SDK/models/return_request.rb +6 -234
  142. data/lib/PCP-server-Ruby-SDK/models/return_response.rb +4 -191
  143. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_specific_input.rb +4 -193
  144. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_specific_output.rb +4 -193
  145. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_product771_specific_input.rb +4 -192
  146. data/lib/PCP-server-Ruby-SDK/models/sepa_transfer_payment_product_772_specific_input.rb +3 -186
  147. data/lib/PCP-server-Ruby-SDK/models/shipping.rb +3 -183
  148. data/lib/PCP-server-Ruby-SDK/models/shipping_address.rb +14 -0
  149. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_data.rb +9 -0
  150. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_input.rb +3 -185
  151. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_patch.rb +3 -185
  152. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_result.rb +3 -185
  153. data/lib/PCP-server-Ruby-SDK/models/status_output.rb +21 -264
  154. data/lib/PCP-server-Ruby-SDK/models/three_d_secure_results.rb +6 -226
  155. data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
  156. data/lib/PCP-server-Ruby-SDK.rb +18 -0
  157. data/package-lock.json +2 -2
  158. data/package.json +1 -1
  159. data/scripts/convert_models_to_model_base.rb +128 -0
  160. data/spec/endpoints/payment_intent_api_client_spec.rb +43 -0
  161. data/spec/models/api_definition_conformance_spec.rb +88 -0
  162. data/spec/models/model_base_spec.rb +87 -0
  163. data/spec/models/payment_intent_models_spec.rb +25 -0
  164. data/spec/models/required_field_validation_spec.rb +5 -5
  165. metadata +35 -11
  166. data/lib/PCP-server-Ruby-SDK/models/action_type.rb +0 -34
  167. data/lib/PCP-server-Ruby-SDK/models/avs_result.rb +0 -52
  168. data/lib/PCP-server-Ruby-SDK/models/business_relation.rb +0 -30
@@ -1,228 +1,16 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
-
5
- # Object containing the mobile payment method details.
6
3
  module PCPServerSDK
7
4
  module Models
8
- class MobilePaymentMethodSpecificOutput
5
+ class MobilePaymentMethodSpecificOutput < ModelBase
9
6
  # Payment product identifier - please check product documentation for a full overview of possible values.
10
- attr_accessor :payment_product_id
11
-
7
+ attribute :payment_product_id, :paymentProductId, :Integer
12
8
  # Card Authorization code as returned by the acquirer
13
- attr_accessor :authorisation_code
14
-
15
- attr_accessor :fraud_results
16
-
17
- attr_accessor :three_d_secure_results
18
-
9
+ attribute :authorisation_code, :authorisationCode, :String
10
+ attribute :fraud_results, :fraudResults, :CardFraudResults
11
+ attribute :three_d_secure_results, :threeDSecureResults, :ThreeDSecureResults
19
12
  # The card network that was used for a mobile payment method operation
20
- attr_accessor :network
21
-
22
- # Attribute mapping from ruby-style variable name to JSON key.
23
- def self.attribute_map
24
- {
25
- :'payment_product_id' => :'paymentProductId',
26
- :'authorisation_code' => :'authorisationCode',
27
- :'fraud_results' => :'fraudResults',
28
- :'three_d_secure_results' => :'threeDSecureResults',
29
- :'network' => :'network'
30
- }
31
- end
32
-
33
- # Returns all the JSON keys this model knows about
34
- def self.acceptable_attributes
35
- attribute_map.values
36
- end
37
-
38
- # Attribute type mapping.
39
- def self.openapi_types
40
- {
41
- :'payment_product_id' => :'Integer',
42
- :'authorisation_code' => :'String',
43
- :'fraud_results' => :'CardFraudResults',
44
- :'three_d_secure_results' => :'ThreeDSecureResults',
45
- :'network' => :'MobilePaymentNetwork'
46
- }
47
- end
48
-
49
- # List of attributes with nullable: true
50
- def self.openapi_nullable
51
- Set.new([
52
- ])
53
- end
54
-
55
- # Initializes the object
56
- # @param [Hash] attributes Model attributes in the form of hash
57
- def initialize(attributes = {})
58
- if (!attributes.is_a?(Hash))
59
- fail ArgumentError, "The input argument (attributes) must be a hash in `MobilePaymentMethodSpecificOutput` initialize method"
60
- end
61
-
62
- # check to see if the attribute exists and convert string to symbol for hash key
63
- attributes = attributes.each_with_object({}) { |(k, v), h|
64
- if (!self.class.attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `MobilePaymentMethodSpecificOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
- end
67
- h[k.to_sym] = v
68
- }
69
-
70
- if attributes.key?(:'payment_product_id')
71
- self.payment_product_id = attributes[:'payment_product_id']
72
- end
73
-
74
- if attributes.key?(:'authorisation_code')
75
- self.authorisation_code = attributes[:'authorisation_code']
76
- end
77
-
78
- if attributes.key?(:'fraud_results')
79
- self.fraud_results = attributes[:'fraud_results']
80
- end
81
-
82
- if attributes.key?(:'three_d_secure_results')
83
- self.three_d_secure_results = attributes[:'three_d_secure_results']
84
- end
85
-
86
- if attributes.key?(:'network')
87
- self.network = attributes[:'network']
88
- end
89
- end
90
-
91
- # Checks equality by comparing each attribute.
92
- # @param [Object] Object to be compared
93
- def ==(o)
94
- return true if self.equal?(o)
95
- self.class == o.class &&
96
- payment_product_id == o.payment_product_id &&
97
- authorisation_code == o.authorisation_code &&
98
- fraud_results == o.fraud_results &&
99
- three_d_secure_results == o.three_d_secure_results &&
100
- network == o.network
101
- end
102
-
103
- # @see the `==` method
104
- # @param [Object] Object to be compared
105
- def eql?(o)
106
- self == o
107
- end
108
-
109
- # Calculates hash code according to all attributes.
110
- # @return [Integer] Hash code
111
- def hash
112
- [payment_product_id, authorisation_code, fraud_results, three_d_secure_results, network].hash
113
- end
114
-
115
- # Builds the object from hash
116
- # @param [Hash] attributes Model attributes in the form of hash
117
- # @return [Object] Returns the model itself
118
- def self.build_from_hash(attributes)
119
- return nil unless attributes.is_a?(Hash)
120
- attributes = attributes.transform_keys(&:to_sym)
121
- transformed_hash = {}
122
- openapi_types.each_pair do |key, type|
123
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
124
- transformed_hash["#{key}"] = nil
125
- elsif type =~ /\AArray<(.*)>/i
126
- # check to ensure the input is an array given that the attribute
127
- # is documented as an array but the input is not
128
- if attributes[attribute_map[key]].is_a?(Array)
129
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
130
- end
131
- elsif !attributes[attribute_map[key]].nil?
132
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
133
- end
134
- end
135
- new(transformed_hash)
136
- end
137
-
138
- # Deserializes the data based on type
139
- # @param string type Data type
140
- # @param string value Value to be deserialized
141
- # @return [Object] Deserialized data
142
- def self._deserialize(type, value)
143
- case type.to_sym
144
- when :Time
145
- Time.parse(value)
146
- when :Date
147
- Date.parse(value)
148
- when :String
149
- value.to_s
150
- when :Integer
151
- value.to_i
152
- when :Float
153
- value.to_f
154
- when :Boolean
155
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
- true
157
- else
158
- false
159
- end
160
- when :Object
161
- # generic object (usually a Hash), return directly
162
- value
163
- when /\AArray<(?<inner_type>.+)>\z/
164
- inner_type = Regexp.last_match[:inner_type]
165
- value.map { |v| _deserialize(inner_type, v) }
166
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
- k_type = Regexp.last_match[:k_type]
168
- v_type = Regexp.last_match[:v_type]
169
- {}.tap do |hash|
170
- value.each do |k, v|
171
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
- end
173
- end
174
- else # model
175
- # models (e.g. Pet) or oneOf
176
- klass = PCPServerSDK::Models.const_get(type)
177
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
- end
179
- end
180
-
181
- # Returns the string representation of the object
182
- # @return [String] String presentation of the object
183
- def to_s
184
- to_hash.to_s
185
- end
186
-
187
- # to_body is an alias to to_hash (backward compatibility)
188
- # @return [Hash] Returns the object in the form of hash
189
- def to_body
190
- to_hash
191
- end
192
-
193
- # Returns the object in the form of hash
194
- # @return [Hash] Returns the object in the form of hash
195
- def to_hash
196
- hash = {}
197
- self.class.attribute_map.each_pair do |attr, param|
198
- value = self.send(attr)
199
- if value.nil?
200
- is_nullable = self.class.openapi_nullable.include?(attr)
201
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
- end
203
-
204
- hash[param] = _to_hash(value)
205
- end
206
- hash
207
- end
208
-
209
- # Outputs non-array value in the form of hash
210
- # For object, use to_hash. Otherwise, just return the value
211
- # @param [Object] value Any valid value
212
- # @return [Hash] Returns the value in the form of hash
213
- def _to_hash(value)
214
- if value.is_a?(Array)
215
- value.compact.map { |v| _to_hash(v) }
216
- elsif value.is_a?(Hash)
217
- {}.tap do |hash|
218
- value.each { |k, v| hash[k] = _to_hash(v) }
219
- end
220
- elsif value.respond_to? :to_hash
221
- value.to_hash
222
- else
223
- value
224
- end
225
- end
13
+ attribute :network, :network, :String
226
14
  end
227
15
  end
228
16
  end
@@ -1,185 +1,9 @@
1
- require 'date'
2
- require 'time'
1
+ require_relative 'model_base'
3
2
 
4
- # Object containing specific data regarding 3-D Secure for card digital wallets.
5
- # Necessary to perform 3D Secure when there is no liability shift from
6
- # the wallet and corresponding card network.
7
3
  module PCPServerSDK
8
4
  module Models
9
- class MobilePaymentThreeDSecure
10
- # Redirection data required for 3D Secure authentication.
11
- attr_accessor :redirection_data
12
-
13
- # Attribute mapping from ruby-style variable name to JSON key.
14
- def self.attribute_map
15
- {
16
- :'redirection_data' => :'redirectionData'
17
- }
18
- end
19
-
20
- # Returns all the JSON keys this model knows about
21
- def self.acceptable_attributes
22
- attribute_map.values
23
- end
24
-
25
- # Attribute type mapping.
26
- def self.openapi_types
27
- {
28
- :'redirection_data' => :'RedirectionData'
29
- }
30
- end
31
-
32
- # List of attributes with nullable: true
33
- def self.openapi_nullable
34
- Set.new([])
35
- end
36
-
37
- # Initializes the object
38
- # @param [Hash] attributes Model attributes in the form of hash
39
- def initialize(attributes = {})
40
- if (!attributes.is_a?(Hash))
41
- fail ArgumentError, "The input argument (attributes) must be a hash in `MobilePaymentThreeDSecure` initialize method"
42
- end
43
-
44
- attributes = attributes.each_with_object({}) { |(k, v), h|
45
- if (!self.class.attribute_map.key?(k.to_sym))
46
- fail ArgumentError, "`#{k}` is not a valid attribute in `MobilePaymentThreeDSecure`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
47
- end
48
- h[k.to_sym] = v
49
- }
50
-
51
- if attributes.key?(:'redirection_data')
52
- self.redirection_data = attributes[:'redirection_data']
53
- end
54
- end
55
-
56
- # Checks equality by comparing each attribute.
57
- # @param [Object] Object to be compared
58
- def ==(o)
59
- return true if self.equal?(o)
60
- self.class == o.class &&
61
- redirection_data == o.redirection_data
62
- end
63
-
64
- # @see the `==` method
65
- # @param [Object] Object to be compared
66
- def eql?(o)
67
- self == o
68
- end
69
-
70
- # Calculates hash code according to all attributes.
71
- # @return [Integer] Hash code
72
- def hash
73
- [redirection_data].hash
74
- end
75
-
76
- # Builds the object from hash
77
- # @param [Hash] attributes Model attributes in the form of hash
78
- # @return [Object] Returns the model itself
79
- def self.build_from_hash(attributes)
80
- return nil unless attributes.is_a?(Hash)
81
- attributes = attributes.transform_keys(&:to_sym)
82
- transformed_hash = {}
83
- openapi_types.each_pair do |key, type|
84
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
85
- transformed_hash["#{key}"] = nil
86
- elsif type =~ /\AArray<(.*)>/i
87
- if attributes[attribute_map[key]].is_a?(Array)
88
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
89
- end
90
- elsif !attributes[attribute_map[key]].nil?
91
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
92
- end
93
- end
94
- new(transformed_hash)
95
- end
96
-
97
- # Deserializes the data based on type
98
- # @param string type Data type
99
- # @param string value Value to be deserialized
100
- # @return [Object] Deserialized data
101
- def self._deserialize(type, value)
102
- case type.to_sym
103
- when :Time
104
- Time.parse(value)
105
- when :Date
106
- Date.parse(value)
107
- when :String
108
- value.to_s
109
- when :Integer
110
- value.to_i
111
- when :Float
112
- value.to_f
113
- when :Boolean
114
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
115
- true
116
- else
117
- false
118
- end
119
- when :Object
120
- value
121
- when /\AArray<(?<inner_type>.+)>\z/
122
- inner_type = Regexp.last_match[:inner_type]
123
- value.map { |v| _deserialize(inner_type, v) }
124
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
125
- k_type = Regexp.last_match[:k_type]
126
- v_type = Regexp.last_match[:v_type]
127
- {}.tap do |hash|
128
- value.each do |k, v|
129
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
130
- end
131
- end
132
- else
133
- klass = PCPServerSDK::Models.const_get(type)
134
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
135
- end
136
- end
137
-
138
- # Returns the string representation of the object
139
- # @return [String] String presentation of the object
140
- def to_s
141
- to_hash.to_s
142
- end
143
-
144
- # to_body is an alias to to_hash (backward compatibility)
145
- # @return [Hash] Returns the object in the form of hash
146
- def to_body
147
- to_hash
148
- end
149
-
150
- # Returns the object in the form of hash
151
- # @return [Hash] Returns the object in the form of hash
152
- def to_hash
153
- hash = {}
154
- self.class.attribute_map.each_pair do |attr, param|
155
- value = self.send(attr)
156
- if value.nil?
157
- is_nullable = self.class.openapi_nullable.include?(attr)
158
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
159
- end
160
-
161
- hash[param] = _to_hash(value)
162
- end
163
- hash
164
- end
165
-
166
- # Outputs non-array value in the form of hash
167
- # For object, use to_hash. Otherwise, just return the value
168
- # @param [Object] value Any valid value
169
- # @return [Hash] Returns the value in the form of hash
170
- def _to_hash(value)
171
- if value.is_a?(Array)
172
- value.compact.map { |v| _to_hash(v) }
173
- elsif value.is_a?(Hash)
174
- {}.tap do |hash|
175
- value.each { |k, v| hash[k] = _to_hash(v) }
176
- end
177
- elsif value.respond_to? :to_hash
178
- value.to_hash
179
- else
180
- value
181
- end
182
- end
5
+ class MobilePaymentThreeDSecure < ModelBase
6
+ attribute :redirection_data, :redirectionData, :RedirectionData
183
7
  end
184
8
  end
185
9
  end
@@ -0,0 +1,147 @@
1
+ require 'date'
2
+ require 'time'
3
+ require 'set'
4
+
5
+ module PCPServerSDK
6
+ module Models
7
+ class ModelBase
8
+ @attribute_map = {}
9
+ @openapi_types = {}
10
+ @attribute_defaults = {}
11
+ @attribute_enums = {}
12
+
13
+ class << self
14
+ def inherited(subclass)
15
+ subclass.instance_variable_set(:@attribute_map, attribute_map.dup)
16
+ subclass.instance_variable_set(:@openapi_types, openapi_types.dup)
17
+ subclass.instance_variable_set(:@attribute_defaults, attribute_defaults.dup)
18
+ subclass.instance_variable_set(:@attribute_enums, attribute_enums.dup)
19
+ super
20
+ end
21
+
22
+ def attribute(name, json_name, type, default: nil, enum: nil)
23
+ define_method(name) { instance_variable_get("@#{name}") }
24
+ define_method("#{name}=") do |value|
25
+ allowed_values = self.class.attribute_enums[name]
26
+ if !value.nil? && allowed_values && !allowed_values.include?(value)
27
+ raise ArgumentError, "invalid value for \"#{name}\", must be one of #{allowed_values.inspect}."
28
+ end
29
+
30
+ instance_variable_set("@#{name}", value)
31
+ end
32
+ @attribute_map[name] = json_name
33
+ @openapi_types[name] = type
34
+ @attribute_defaults[name] = default unless default.nil?
35
+ @attribute_enums[name] = enum if enum
36
+ end
37
+
38
+ def attribute_map
39
+ @attribute_map
40
+ end
41
+
42
+ def openapi_types
43
+ @openapi_types
44
+ end
45
+
46
+ def attribute_defaults
47
+ @attribute_defaults
48
+ end
49
+
50
+ def attribute_enums
51
+ @attribute_enums
52
+ end
53
+
54
+ def acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
58
+ def openapi_nullable
59
+ Set.new
60
+ end
61
+
62
+ def build_from_hash(attributes)
63
+ return nil unless attributes.is_a?(Hash)
64
+
65
+ values = attributes.each_with_object({}) { |(key, value), result| result[key.to_s] = value }
66
+ new(openapi_types.each_with_object({}) do |(name, type), result|
67
+ json_name = attribute_map[name].to_s
68
+ result[name] = values.key?(json_name) ? _deserialize(type, values[json_name]) : nil if values.key?(json_name)
69
+ end)
70
+ end
71
+
72
+ def _deserialize(type, value)
73
+ return nil if value.nil?
74
+
75
+ type_name = type.to_s
76
+
77
+ case type_name
78
+ when 'Time' then Time.parse(value)
79
+ when 'Date' then Date.parse(value)
80
+ when 'String' then value.to_s
81
+ when 'Integer' then value.to_i
82
+ when 'Float' then value.to_f
83
+ when 'Boolean' then value.to_s.match?(/\A(true|t|yes|y|1)\z/i)
84
+ when 'Object' then value
85
+ when /\AArray<(?<inner_type>.+)>\z/
86
+ inner_type = Regexp.last_match[:inner_type]
87
+ value.map { |item| _deserialize(inner_type, item) }
88
+ when /\AHash<(?<key_type>.+?), (?<value_type>.+)>\z/
89
+ key_type = Regexp.last_match[:key_type]
90
+ value_type = Regexp.last_match[:value_type]
91
+ value.each_with_object({}) do |(key, item), result|
92
+ result[_deserialize(key_type, key)] = _deserialize(value_type, item)
93
+ end
94
+ else
95
+ klass = PCPServerSDK::Models.const_get(type_name)
96
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
97
+ end
98
+ end
99
+ end
100
+
101
+ def initialize(attributes = {})
102
+ raise ArgumentError, "The input argument must be a hash" unless attributes.is_a?(Hash)
103
+
104
+ self.class.attribute_defaults.each { |name, value| public_send("#{name}=", value) }
105
+ attributes.each do |name, value|
106
+ name = name.to_sym
107
+ raise ArgumentError, "`#{name}` is not a valid attribute" unless self.class.attribute_map.key?(name)
108
+
109
+ public_send("#{name}=", value)
110
+ end
111
+ end
112
+
113
+ def ==(other)
114
+ self.class == other.class && self.class.attribute_map.keys.all? { |name| public_send(name) == other.public_send(name) }
115
+ end
116
+
117
+ alias eql? ==
118
+
119
+ def hash
120
+ self.class.attribute_map.keys.map { |name| public_send(name) }.hash
121
+ end
122
+
123
+ def to_s
124
+ to_hash.to_s
125
+ end
126
+
127
+ def to_hash
128
+ self.class.attribute_map.each_with_object({}) do |(name, json_name), result|
129
+ value = public_send(name)
130
+ result[json_name] = to_value(value) unless value.nil?
131
+ end
132
+ end
133
+
134
+ alias to_body to_hash
135
+
136
+ private
137
+
138
+ def to_value(value)
139
+ return value.compact.map { |item| to_value(item) } if value.is_a?(Array)
140
+ return value.transform_values { |item| to_value(item) } if value.is_a?(Hash)
141
+ return value.to_hash if value.respond_to?(:to_hash)
142
+
143
+ value
144
+ end
145
+ end
146
+ end
147
+ end