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