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,255 +1,16 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
3
  module PCPServerSDK
5
4
  module Models
6
- class PaymentInformationRequest
7
- attr_accessor :amount_of_money
8
-
9
- attr_accessor :type
10
-
11
- attr_accessor :payment_channel
12
-
13
- # Payment method identifier - please check the product documentation for a full overview of possible values.
14
- attr_accessor :payment_product_id
15
-
16
- # Unique reference of the PaymentInformation. In case of card present transactions, the reference from the ECR or terminal will be used. It is always the reference for external transactions. (e.g. card present payments, cash payments or payments processed by other payment providers).
17
- attr_accessor :merchant_reference
18
-
19
- class EnumAttributeValidator
20
- attr_reader :datatype
21
- attr_reader :allowable_values
22
-
23
- def initialize(datatype, allowable_values)
24
- @allowable_values = allowable_values.map do |value|
25
- case datatype.to_s
26
- when /Integer/i
27
- value.to_i
28
- when /Float/i
29
- value.to_f
30
- else
31
- value
32
- end
33
- end
34
- end
35
-
36
- def valid?(value)
37
- !value || allowable_values.include?(value)
38
- end
39
- end
40
-
41
- # Attribute mapping from ruby-style variable name to JSON key.
42
- def self.attribute_map
43
- {
44
- :'amount_of_money' => :'amountOfMoney',
45
- :'type' => :'type',
46
- :'payment_channel' => :'paymentChannel',
47
- :'payment_product_id' => :'paymentProductId',
48
- :'merchant_reference' => :'merchantReference'
49
- }
50
- end
51
-
52
- # Returns all the JSON keys this model knows about
53
- def self.acceptable_attributes
54
- attribute_map.values
55
- end
56
-
57
- # Attribute type mapping.
58
- def self.openapi_types
59
- {
60
- :'amount_of_money' => :'AmountOfMoney',
61
- :'type' => :'PaymentType',
62
- :'payment_channel' => :'PaymentChannel',
63
- :'payment_product_id' => :'Integer',
64
- :'merchant_reference' => :'String'
65
- }
66
- end
67
-
68
- # List of attributes with nullable: true
69
- def self.openapi_nullable
70
- Set.new([
71
- ])
72
- end
73
-
74
- # Initializes the object
75
- # @param [Hash] attributes Model attributes in the form of hash
76
- def initialize(attributes = {})
77
- if (!attributes.is_a?(Hash))
78
- fail ArgumentError, "The input argument (attributes) must be a hash in `PaymentInformationRequest` initialize method"
79
- end
80
-
81
- # check to see if the attribute exists and convert string to symbol for hash key
82
- attributes = attributes.each_with_object({}) { |(k, v), h|
83
- if (!self.class.attribute_map.key?(k.to_sym))
84
- fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentInformationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
- end
86
- h[k.to_sym] = v
87
- }
88
-
89
- if attributes.key?(:'amount_of_money')
90
- self.amount_of_money = attributes[:'amount_of_money']
91
- else
92
- self.amount_of_money = nil
93
- end
94
-
95
- if attributes.key?(:'type')
96
- self.type = attributes[:'type']
97
- else
98
- self.type = nil
99
- end
100
-
101
- if attributes.key?(:'payment_channel')
102
- self.payment_channel = attributes[:'payment_channel']
103
- else
104
- self.payment_channel = nil
105
- end
106
-
107
- if attributes.key?(:'payment_product_id')
108
- self.payment_product_id = attributes[:'payment_product_id']
109
- else
110
- self.payment_product_id = nil
111
- end
112
-
113
- if attributes.key?(:'merchant_reference')
114
- self.merchant_reference = attributes[:'merchant_reference']
115
- end
116
- end
117
-
118
- # Checks equality by comparing each attribute.
119
- # @param [Object] Object to be compared
120
- def ==(o)
121
- return true if self.equal?(o)
122
- self.class == o.class &&
123
- amount_of_money == o.amount_of_money &&
124
- type == o.type &&
125
- payment_channel == o.payment_channel &&
126
- payment_product_id == o.payment_product_id &&
127
- merchant_reference == o.merchant_reference
128
- end
129
-
130
- # @see the `==` method
131
- # @param [Object] Object to be compared
132
- def eql?(o)
133
- self == o
134
- end
135
-
136
- # Calculates hash code according to all attributes.
137
- # @return [Integer] Hash code
138
- def hash
139
- [amount_of_money, type, payment_channel, payment_product_id, merchant_reference].hash
140
- end
141
-
142
- # Builds the object from hash
143
- # @param [Hash] attributes Model attributes in the form of hash
144
- # @return [Object] Returns the model itself
145
- def self.build_from_hash(attributes)
146
- return nil unless attributes.is_a?(Hash)
147
- attributes = attributes.transform_keys(&:to_sym)
148
- transformed_hash = {}
149
- openapi_types.each_pair do |key, type|
150
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
- transformed_hash["#{key}"] = nil
152
- elsif type =~ /\AArray<(.*)>/i
153
- # check to ensure the input is an array given that the attribute
154
- # is documented as an array but the input is not
155
- if attributes[attribute_map[key]].is_a?(Array)
156
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
- end
158
- elsif !attributes[attribute_map[key]].nil?
159
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
- end
161
- end
162
- new(transformed_hash)
163
- end
164
-
165
- # Deserializes the data based on type
166
- # @param string type Data type
167
- # @param string value Value to be deserialized
168
- # @return [Object] Deserialized data
169
- def self._deserialize(type, value)
170
- case type.to_sym
171
- when :Time
172
- Time.parse(value)
173
- when :Date
174
- Date.parse(value)
175
- when :String
176
- value.to_s
177
- when :Integer
178
- value.to_i
179
- when :Float
180
- value.to_f
181
- when :Boolean
182
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
- true
184
- else
185
- false
186
- end
187
- when :Object
188
- # generic object (usually a Hash), return directly
189
- value
190
- when /\AArray<(?<inner_type>.+)>\z/
191
- inner_type = Regexp.last_match[:inner_type]
192
- value.map { |v| _deserialize(inner_type, v) }
193
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
- k_type = Regexp.last_match[:k_type]
195
- v_type = Regexp.last_match[:v_type]
196
- {}.tap do |hash|
197
- value.each do |k, v|
198
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
- end
200
- end
201
- else # model
202
- # models (e.g. Pet) or oneOf
203
- klass = PCPServerSDK::Models.const_get(type)
204
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
- end
206
- end
207
-
208
- # Returns the string representation of the object
209
- # @return [String] String presentation of the object
210
- def to_s
211
- to_hash.to_s
212
- end
213
-
214
- # to_body is an alias to to_hash (backward compatibility)
215
- # @return [Hash] Returns the object in the form of hash
216
- def to_body
217
- to_hash
218
- end
219
-
220
- # Returns the object in the form of hash
221
- # @return [Hash] Returns the object in the form of hash
222
- def to_hash
223
- hash = {}
224
- self.class.attribute_map.each_pair do |attr, param|
225
- value = self.send(attr)
226
- if value.nil?
227
- is_nullable = self.class.openapi_nullable.include?(attr)
228
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
- end
230
-
231
- hash[param] = _to_hash(value)
232
- end
233
- hash
234
- end
235
-
236
- # Outputs non-array value in the form of hash
237
- # For object, use to_hash. Otherwise, just return the value
238
- # @param [Object] value Any valid value
239
- # @return [Hash] Returns the value in the form of hash
240
- def _to_hash(value)
241
- if value.is_a?(Array)
242
- value.compact.map { |v| _to_hash(v) }
243
- elsif value.is_a?(Hash)
244
- {}.tap do |hash|
245
- value.each { |k, v| hash[k] = _to_hash(v) }
246
- end
247
- elsif value.respond_to? :to_hash
248
- value.to_hash
249
- else
250
- value
251
- end
252
- end
5
+ class PaymentInformationRequest < ModelBase
6
+ attribute :amount_of_money, :amountOfMoney, :AmountOfMoney
7
+ attribute :type, :type, :PaymentType
8
+ attribute :payment_channel, :paymentChannel, :PaymentChannel
9
+ attribute :payment_product_id, :paymentProductId, :Integer
10
+ # Unique reference of the PaymentInformation. In case of card present transactions, the reference from the ECR
11
+ # or terminal will be used. It is always the reference for external transactions.
12
+ # (e.g. card present payments, cash payments or payments processed by other payment providers).
13
+ attribute :merchant_reference, :merchantReference, :String
253
14
  end
254
15
  end
255
16
  end
@@ -1,327 +1,43 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
-
5
- # Object containing the related data of the created Payment Information.
6
3
  module PCPServerSDK
7
4
  module Models
8
- class PaymentInformationResponse
5
+ class PaymentInformationResponse < ModelBase
9
6
  # Unique ID of the Commerce Case.
10
- attr_accessor :commerce_case_id
11
-
7
+ attribute :commerce_case_id, :commerceCaseId, :String
12
8
  # Unique ID of the Commerce Case.
13
- attr_accessor :checkout_id
14
-
9
+ attribute :checkout_id, :checkoutId, :String
15
10
  # Unique identifier of the customer.
16
- attr_accessor :merchant_customer_id
17
-
11
+ attribute :merchant_customer_id, :merchantCustomerId, :String
18
12
  # Unique ID of the Payment Information.
19
- attr_accessor :payment_information_id
20
-
21
- attr_accessor :payment_channel
22
-
23
- # Payment product identifier - please check see product documentation for a full overview of possible values.
24
- attr_accessor :payment_product_id
25
-
13
+ attribute :payment_information_id, :paymentInformationId, :String
14
+ attribute :payment_channel, :paymentChannel, :PaymentChannel
15
+ attribute :payment_product_id, :paymentProductId, :Integer
26
16
  # Unique identifier of the POS terminal of the payment transaction.
27
- attr_accessor :terminal_id
28
-
29
- # Unique ID that identifies a store location or transaction point and which refers to the contract number of the merchant accepting the card.
30
- attr_accessor :card_acceptor_id
31
-
32
- # Unique reference of the PaymentInformation. In case of card present transactions, the reference from the ECR or terminal will be used. It is always the reference for external transactions. (e.g. card present payments, cash payments or payments processed by other payment providers).
33
- attr_accessor :merchant_reference
34
-
17
+ attribute :terminal_id, :terminalId, :String
18
+ # Unique ID that identifies a store location or transaction point and which refers to the contract number of
19
+ # the merchant accepting the card.
20
+ attribute :card_acceptor_id, :cardAcceptorId, :String
21
+ # Unique reference of the PaymentInformation. In case of card present transactions, the reference from the ECR
22
+ # or terminal will be used. It is always the reference for external transactions.
23
+ # (e.g. card present payments, cash payments or payments processed by other payment providers).
24
+ attribute :merchant_reference, :merchantReference, :String
35
25
  # The date and time when the payment was created.
36
- attr_accessor :creation_date_time
37
-
26
+ #
27
+ # Format will be in one of the following formats:
28
+ # * YYYY-MM-DD'T'HH:mm:ss'Z'
29
+ # * YYYY-MM-DD'T'HH:mm:ss+XX:XX
30
+ # * YYYY-MM-DD'T'HH:mm:ss-XX:XX
31
+ attribute :creation_date_time, :creationDateTime, :Time
38
32
  # The date and time when the payment was last updated.
39
- attr_accessor :last_updated
40
-
41
- attr_accessor :card_payment_details
42
-
43
- attr_accessor :events
44
-
45
- class EnumAttributeValidator
46
- attr_reader :datatype
47
- attr_reader :allowable_values
48
-
49
- def initialize(datatype, allowable_values)
50
- @allowable_values = allowable_values.map do |value|
51
- case datatype.to_s
52
- when /Integer/i
53
- value.to_i
54
- when /Float/i
55
- value.to_f
56
- else
57
- value
58
- end
59
- end
60
- end
61
-
62
- def valid?(value)
63
- !value || allowable_values.include?(value)
64
- end
65
- end
66
-
67
- # Attribute mapping from ruby-style variable name to JSON key.
68
- def self.attribute_map
69
- {
70
- :'commerce_case_id' => :'commerceCaseId',
71
- :'checkout_id' => :'checkoutId',
72
- :'merchant_customer_id' => :'merchantCustomerId',
73
- :'payment_information_id' => :'paymentInformationId',
74
- :'payment_channel' => :'paymentChannel',
75
- :'payment_product_id' => :'paymentProductId',
76
- :'terminal_id' => :'terminalId',
77
- :'card_acceptor_id' => :'cardAcceptorId',
78
- :'merchant_reference' => :'merchantReference',
79
- :'creation_date_time' => :'creationDateTime',
80
- :'last_updated' => :'lastUpdated',
81
- :'card_payment_details' => :'cardPaymentDetails',
82
- :'events' => :'events'
83
- }
84
- end
85
-
86
- # Returns all the JSON keys this model knows about
87
- def self.acceptable_attributes
88
- attribute_map.values
89
- end
90
-
91
- # Attribute type mapping.
92
- def self.openapi_types
93
- {
94
- :'commerce_case_id' => :'String',
95
- :'checkout_id' => :'String',
96
- :'merchant_customer_id' => :'String',
97
- :'payment_information_id' => :'String',
98
- :'payment_channel' => :'PaymentChannel',
99
- :'payment_product_id' => :'Integer',
100
- :'terminal_id' => :'String',
101
- :'card_acceptor_id' => :'String',
102
- :'merchant_reference' => :'String',
103
- :'creation_date_time' => :'Time',
104
- :'last_updated' => :'Time',
105
- :'card_payment_details' => :'CardPaymentDetails',
106
- :'events' => :'Array<PaymentEvent>'
107
- }
108
- end
109
-
110
- # List of attributes with nullable: true
111
- def self.openapi_nullable
112
- Set.new([
113
- ])
114
- end
115
-
116
- # Initializes the object
117
- # @param [Hash] attributes Model attributes in the form of hash
118
- def initialize(attributes = {})
119
- if (!attributes.is_a?(Hash))
120
- fail ArgumentError, "The input argument (attributes) must be a hash in `PaymentInformationResponse` initialize method"
121
- end
122
-
123
- # check to see if the attribute exists and convert string to symbol for hash key
124
- attributes = attributes.each_with_object({}) { |(k, v), h|
125
- if (!self.class.attribute_map.key?(k.to_sym))
126
- fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentInformationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
127
- end
128
- h[k.to_sym] = v
129
- }
130
-
131
- if attributes.key?(:'commerce_case_id')
132
- self.commerce_case_id = attributes[:'commerce_case_id']
133
- end
134
-
135
- if attributes.key?(:'checkout_id')
136
- self.checkout_id = attributes[:'checkout_id']
137
- end
138
-
139
- if attributes.key?(:'merchant_customer_id')
140
- self.merchant_customer_id = attributes[:'merchant_customer_id']
141
- end
142
-
143
- if attributes.key?(:'payment_information_id')
144
- self.payment_information_id = attributes[:'payment_information_id']
145
- end
146
-
147
- if attributes.key?(:'payment_channel')
148
- self.payment_channel = attributes[:'payment_channel']
149
- end
150
-
151
- if attributes.key?(:'payment_product_id')
152
- self.payment_product_id = attributes[:'payment_product_id']
153
- end
154
-
155
- if attributes.key?(:'terminal_id')
156
- self.terminal_id = attributes[:'terminal_id']
157
- end
158
-
159
- if attributes.key?(:'card_acceptor_id')
160
- self.card_acceptor_id = attributes[:'card_acceptor_id']
161
- end
162
-
163
- if attributes.key?(:'merchant_reference')
164
- self.merchant_reference = attributes[:'merchant_reference']
165
- end
166
-
167
- if attributes.key?(:'creation_date_time')
168
- self.creation_date_time = attributes[:'creation_date_time']
169
- end
170
-
171
- if attributes.key?(:'last_updated')
172
- self.last_updated = attributes[:'last_updated']
173
- end
174
-
175
- if attributes.key?(:'card_payment_details')
176
- self.card_payment_details = attributes[:'card_payment_details']
177
- end
178
-
179
- if attributes.key?(:'events')
180
- if (value = attributes[:'events']).is_a?(Array)
181
- self.events = value
182
- end
183
- end
184
- end
185
-
186
- # Checks equality by comparing each attribute.
187
- def ==(o)
188
- return true if self.equal?(o)
189
- self.class == o.class &&
190
- commerce_case_id == o.commerce_case_id &&
191
- checkout_id == o.checkout_id &&
192
- merchant_customer_id == o.merchant_customer_id &&
193
- payment_information_id == o.payment_information_id &&
194
- payment_channel == o.payment_channel &&
195
- payment_product_id == o.payment_product_id &&
196
- terminal_id == o.terminal_id &&
197
- card_acceptor_id == o.card_acceptor_id &&
198
- merchant_reference == o.merchant_reference &&
199
- creation_date_time == o.creation_date_time &&
200
- last_updated == o.last_updated &&
201
- card_payment_details == o.card_payment_details &&
202
- events == o.events
203
- end
204
-
205
- # @see the `==` method
206
- def eql?(o)
207
- self == o
208
- end
209
-
210
- # Calculates hash code according to all attributes.
211
- def hash
212
- [commerce_case_id, checkout_id, merchant_customer_id, payment_information_id, payment_channel, payment_product_id, terminal_id, card_acceptor_id, merchant_reference, creation_date_time, last_updated, card_payment_details, events].hash
213
- end
214
- # Builds the object from hash
215
- # @param [Hash] attributes Model attributes in the form of hash
216
- # @return [Object] Returns the model itself
217
- def self.build_from_hash(attributes)
218
- return nil unless attributes.is_a?(Hash)
219
- attributes = attributes.transform_keys(&:to_sym)
220
- transformed_hash = {}
221
- openapi_types.each_pair do |key, type|
222
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
223
- transformed_hash["#{key}"] = nil
224
- elsif type =~ /\AArray<(.*)>/i
225
- # check to ensure the input is an array given that the attribute
226
- # is documented as an array but the input is not
227
- if attributes[attribute_map[key]].is_a?(Array)
228
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
229
- end
230
- elsif !attributes[attribute_map[key]].nil?
231
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
232
- end
233
- end
234
- new(transformed_hash)
235
- end
236
-
237
- # Deserializes the data based on type
238
- # @param string type Data type
239
- # @param string value Value to be deserialized
240
- # @return [Object] Deserialized data
241
- def self._deserialize(type, value)
242
- case type.to_sym
243
- when :Time
244
- Time.parse(value)
245
- when :Date
246
- Date.parse(value)
247
- when :String
248
- value.to_s
249
- when :Integer
250
- value.to_i
251
- when :Float
252
- value.to_f
253
- when :Boolean
254
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
255
- true
256
- else
257
- false
258
- end
259
- when :Object
260
- # generic object (usually a Hash), return directly
261
- value
262
- when /\AArray<(?<inner_type>.+)>\z/
263
- inner_type = Regexp.last_match[:inner_type]
264
- value.map { |v| _deserialize(inner_type, v) }
265
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
266
- k_type = Regexp.last_match[:k_type]
267
- v_type = Regexp.last_match[:v_type]
268
- {}.tap do |hash|
269
- value.each do |k, v|
270
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
271
- end
272
- end
273
- else # model
274
- # models (e.g. Pet) or oneOf
275
- klass = PCPServerSDK::Models.const_get(type)
276
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
277
- end
278
- end
279
-
280
- # Returns the string representation of the object
281
- # @return [String] String presentation of the object
282
- def to_s
283
- to_hash.to_s
284
- end
285
-
286
- # to_body is an alias to to_hash (backward compatibility)
287
- # @return [Hash] Returns the object in the form of hash
288
- def to_body
289
- to_hash
290
- end
291
-
292
- # Returns the object in the form of hash
293
- # @return [Hash] Returns the object in the form of hash
294
- def to_hash
295
- hash = {}
296
- self.class.attribute_map.each_pair do |attr, param|
297
- value = self.send(attr)
298
- if value.nil?
299
- is_nullable = self.class.openapi_nullable.include?(attr)
300
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
301
- end
302
-
303
- hash[param] = _to_hash(value)
304
- end
305
- hash
306
- end
307
-
308
- # Outputs non-array value in the form of hash
309
- # For object, use to_hash. Otherwise, just return the value
310
- # @param [Object] value Any valid value
311
- # @return [Hash] Returns the value in the form of hash
312
- def _to_hash(value)
313
- if value.is_a?(Array)
314
- value.compact.map { |v| _to_hash(v) }
315
- elsif value.is_a?(Hash)
316
- {}.tap do |hash|
317
- value.each { |k, v| hash[k] = _to_hash(v) }
318
- end
319
- elsif value.respond_to? :to_hash
320
- value.to_hash
321
- else
322
- value
323
- end
324
- end
33
+ #
34
+ # Format will be in one of the following formats:
35
+ # * YYYY-MM-DD'T'HH:mm:ss'Z'
36
+ # * YYYY-MM-DD'T'HH:mm:ss+XX:XX
37
+ # * YYYY-MM-DD'T'HH:mm:ss-XX:XX
38
+ attribute :last_updated, :lastUpdated, :Time
39
+ attribute :card_payment_details, :cardPaymentDetails, :CardPaymentDetails
40
+ attribute :events, :events, "Array<PaymentEvent>"
325
41
  end
326
42
  end
327
43
  end