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,230 +1,12 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
3
  module PCPServerSDK
5
4
  module Models
6
- # Request to mark items as of the respective Checkout as cancelled and to automatically reverse the associated payment. A Cancel can be created for a full or the partial ShoppingCart of the Checkout. The platform will automatically calculate the respective amount to trigger the Cancel. For a partial Cancel a list of items must be provided. The cancellationReason is mandatory for BNPL payment methods (paymentProductId 3390, 3391 and 3392). For other payment methods the cancellationReason is not mandatory but can be used for reporting and reconciliation purposes.
7
- class CancelRequest
8
- attr_accessor :cancel_type
9
-
10
- attr_accessor :cancellation_reason
11
-
12
- attr_accessor :cancel_items
13
-
14
- class EnumAttributeValidator
15
- attr_reader :datatype
16
- attr_reader :allowable_values
17
-
18
- def initialize(datatype, allowable_values)
19
- @allowable_values = allowable_values.map do |value|
20
- case datatype.to_s
21
- when /Integer/i
22
- value.to_i
23
- when /Float/i
24
- value.to_f
25
- else
26
- value
27
- end
28
- end
29
- end
30
-
31
- def valid?(value)
32
- !value || allowable_values.include?(value)
33
- end
34
- end
35
-
36
- # Attribute mapping from ruby-style variable name to JSON key.
37
- def self.attribute_map
38
- {
39
- :'cancel_type' => :'cancelType',
40
- :'cancellation_reason' => :'cancellationReason',
41
- :'cancel_items' => :'cancelItems'
42
- }
43
- end
44
-
45
- # Returns all the JSON keys this model knows about
46
- def self.acceptable_attributes
47
- attribute_map.values
48
- end
49
-
50
- # Attribute type mapping.
51
- def self.openapi_types
52
- {
53
- :'cancel_type' => :'CancelType',
54
- :'cancellation_reason' => :'CancellationReason',
55
- :'cancel_items' => :'Array<CancelItem>'
56
- }
57
- end
58
-
59
- # List of attributes with nullable: true
60
- def self.openapi_nullable
61
- Set.new([
62
- ])
63
- end
64
-
65
- # Initializes the object
66
- # @param [Hash] attributes Model attributes in the form of hash
67
- def initialize(attributes = {})
68
- if (!attributes.is_a?(Hash))
69
- fail ArgumentError, "The input argument (attributes) must be a hash in `CancelRequest` initialize method"
70
- end
71
-
72
- # check to see if the attribute exists and convert string to symbol for hash key
73
- attributes = attributes.each_with_object({}) { |(k, v), h|
74
- if (!self.class.attribute_map.key?(k.to_sym))
75
- fail ArgumentError, "`#{k}` is not a valid attribute in `CancelRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
- end
77
- h[k.to_sym] = v
78
- }
79
-
80
- if attributes.key?(:'cancel_type')
81
- self.cancel_type = attributes[:'cancel_type']
82
- end
83
-
84
- if attributes.key?(:'cancellation_reason')
85
- self.cancellation_reason = attributes[:'cancellation_reason']
86
- end
87
-
88
- if attributes.key?(:'cancel_items')
89
- if (value = attributes[:'cancel_items']).is_a?(Array)
90
- self.cancel_items = value
91
- end
92
- end
93
- end
94
-
95
- # Checks equality by comparing each attribute.
96
- # @param [Object] Object to be compared
97
- def ==(o)
98
- return true if self.equal?(o)
99
- self.class == o.class &&
100
- cancel_type == o.cancel_type &&
101
- cancellation_reason == o.cancellation_reason &&
102
- cancel_items == o.cancel_items
103
- end
104
-
105
- # @see the `==` method
106
- # @param [Object] Object to be compared
107
- def eql?(o)
108
- self == o
109
- end
110
-
111
- # Calculates hash code according to all attributes.
112
- # @return [Integer] Hash code
113
- def hash
114
- [cancel_type, cancellation_reason, cancel_items].hash
115
- end
116
-
117
- # Builds the object from hash
118
- # @param [Hash] attributes Model attributes in the form of hash
119
- # @return [Object] Returns the model itself
120
- def self.build_from_hash(attributes)
121
- return nil unless attributes.is_a?(Hash)
122
- attributes = attributes.transform_keys(&:to_sym)
123
- transformed_hash = {}
124
- openapi_types.each_pair do |key, type|
125
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
- transformed_hash["#{key}"] = nil
127
- elsif type =~ /\AArray<(.*)>/i
128
- # check to ensure the input is an array given that the attribute
129
- # is documented as an array but the input is not
130
- if attributes[attribute_map[key]].is_a?(Array)
131
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
- end
133
- elsif !attributes[attribute_map[key]].nil?
134
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
- end
136
- end
137
- new(transformed_hash)
138
- end
139
-
140
- # Deserializes the data based on type
141
- # @param string type Data type
142
- # @param string value Value to be deserialized
143
- # @return [Object] Deserialized data
144
- def self._deserialize(type, value)
145
- case type.to_sym
146
- when :Time
147
- Time.parse(value)
148
- when :Date
149
- Date.parse(value)
150
- when :String
151
- value.to_s
152
- when :Integer
153
- value.to_i
154
- when :Float
155
- value.to_f
156
- when :Boolean
157
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
- true
159
- else
160
- false
161
- end
162
- when :Object
163
- # generic object (usually a Hash), return directly
164
- value
165
- when /\AArray<(?<inner_type>.+)>\z/
166
- inner_type = Regexp.last_match[:inner_type]
167
- value.map { |v| _deserialize(inner_type, v) }
168
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
- k_type = Regexp.last_match[:k_type]
170
- v_type = Regexp.last_match[:v_type]
171
- {}.tap do |hash|
172
- value.each do |k, v|
173
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
- end
175
- end
176
- else # model
177
- # models (e.g. Pet) or oneOf
178
- klass = PCPServerSDK::Models.const_get(type)
179
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
- end
181
- end
182
-
183
- # Returns the string representation of the object
184
- # @return [String] String presentation of the object
185
- def to_s
186
- to_hash.to_s
187
- end
188
-
189
- # to_body is an alias to to_hash (backward compatibility)
190
- # @return [Hash] Returns the object in the form of hash
191
- def to_body
192
- to_hash
193
- end
194
-
195
- # Returns the object in the form of hash
196
- # @return [Hash] Returns the object in the form of hash
197
- def to_hash
198
- hash = {}
199
- self.class.attribute_map.each_pair do |attr, param|
200
- value = self.send(attr)
201
- if value.nil?
202
- is_nullable = self.class.openapi_nullable.include?(attr)
203
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
- end
205
-
206
- hash[param] = _to_hash(value)
207
- end
208
- hash
209
- end
210
-
211
- # Outputs non-array value in the form of hash
212
- # For object, use to_hash. Otherwise, just return the value
213
- # @param [Object] value Any valid value
214
- # @return [Hash] Returns the value in the form of hash
215
- def _to_hash(value)
216
- if value.is_a?(Array)
217
- value.compact.map { |v| _to_hash(v) }
218
- elsif value.is_a?(Hash)
219
- {}.tap do |hash|
220
- value.each { |k, v| hash[k] = _to_hash(v) }
221
- end
222
- elsif value.respond_to? :to_hash
223
- value.to_hash
224
- else
225
- value
226
- end
227
- end
5
+ class CancelRequest < ModelBase
6
+ attribute :cancel_type, :cancelType, :CancelType
7
+ attribute :cancellation_reason, :cancellationReason, :CancellationReason
8
+ attribute :cancel_items, :cancelItems, "Array<CancelItem>"
9
+ attribute :fund_split, :fundSplit, :FundSplit
228
10
  end
229
11
  end
230
12
  end
@@ -1,196 +1,10 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
3
  module PCPServerSDK
5
4
  module Models
6
- class CancelResponse
7
- attr_accessor :cancel_payment_response
8
-
9
- attr_accessor :shopping_cart
10
-
11
- # Attribute mapping from ruby-style variable name to JSON key.
12
- def self.attribute_map
13
- {
14
- :'cancel_payment_response' => :'cancelPaymentResponse',
15
- :'shopping_cart' => :'shoppingCart'
16
- }
17
- end
18
-
19
- # Returns all the JSON keys this model knows about
20
- def self.acceptable_attributes
21
- attribute_map.values
22
- end
23
-
24
- # Attribute type mapping.
25
- def self.openapi_types
26
- {
27
- :'cancel_payment_response' => :'CancelPaymentResponse',
28
- :'shopping_cart' => :'ShoppingCartResult'
29
- }
30
- end
31
-
32
- # List of attributes with nullable: true
33
- def self.openapi_nullable
34
- Set.new([
35
- ])
36
- end
37
-
38
- # Initializes the object
39
- # @param [Hash] attributes Model attributes in the form of hash
40
- def initialize(attributes = {})
41
- if (!attributes.is_a?(Hash))
42
- fail ArgumentError, "The input argument (attributes) must be a hash in `CancelResponse` initialize method"
43
- end
44
-
45
- # check to see if the attribute exists and convert string to symbol for hash key
46
- attributes = attributes.each_with_object({}) { |(k, v), h|
47
- if (!self.class.attribute_map.key?(k.to_sym))
48
- fail ArgumentError, "`#{k}` is not a valid attribute in `CancelResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
- end
50
- h[k.to_sym] = v
51
- }
52
-
53
- if attributes.key?(:'cancel_payment_response')
54
- self.cancel_payment_response = attributes[:'cancel_payment_response']
55
- end
56
-
57
- if attributes.key?(:'shopping_cart')
58
- self.shopping_cart = attributes[:'shopping_cart']
59
- end
60
- end
61
-
62
- # Checks equality by comparing each attribute.
63
- # @param [Object] Object to be compared
64
- def ==(o)
65
- return true if self.equal?(o)
66
- self.class == o.class &&
67
- cancel_payment_response == o.cancel_payment_response &&
68
- shopping_cart == o.shopping_cart
69
- end
70
-
71
- # @see the `==` method
72
- # @param [Object] Object to be compared
73
- def eql?(o)
74
- self == o
75
- end
76
-
77
- # Calculates hash code according to all attributes.
78
- # @return [Integer] Hash code
79
- def hash
80
- [cancel_payment_response, shopping_cart].hash
81
- end
82
-
83
- # Builds the object from hash
84
- # @param [Hash] attributes Model attributes in the form of hash
85
- # @return [Object] Returns the model itself
86
- def self.build_from_hash(attributes)
87
- return nil unless attributes.is_a?(Hash)
88
- attributes = attributes.transform_keys(&:to_sym)
89
- transformed_hash = {}
90
- openapi_types.each_pair do |key, type|
91
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
92
- transformed_hash["#{key}"] = nil
93
- elsif type =~ /\AArray<(.*)>/i
94
- # check to ensure the input is an array given that the attribute
95
- # is documented as an array but the input is not
96
- if attributes[attribute_map[key]].is_a?(Array)
97
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
98
- end
99
- elsif !attributes[attribute_map[key]].nil?
100
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
101
- end
102
- end
103
- new(transformed_hash)
104
- end
105
-
106
- # Deserializes the data based on type
107
- # @param string type Data type
108
- # @param string value Value to be deserialized
109
- # @return [Object] Deserialized data
110
- def self._deserialize(type, value)
111
- case type.to_sym
112
- when :Time
113
- Time.parse(value)
114
- when :Date
115
- Date.parse(value)
116
- when :String
117
- value.to_s
118
- when :Integer
119
- value.to_i
120
- when :Float
121
- value.to_f
122
- when :Boolean
123
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
124
- true
125
- else
126
- false
127
- end
128
- when :Object
129
- # generic object (usually a Hash), return directly
130
- value
131
- when /\AArray<(?<inner_type>.+)>\z/
132
- inner_type = Regexp.last_match[:inner_type]
133
- value.map { |v| _deserialize(inner_type, v) }
134
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
135
- k_type = Regexp.last_match[:k_type]
136
- v_type = Regexp.last_match[:v_type]
137
- {}.tap do |hash|
138
- value.each do |k, v|
139
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
140
- end
141
- end
142
- else # model
143
- # models (e.g. Pet) or oneOf
144
- klass = PCPServerSDK::Models.const_get(type)
145
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
146
- end
147
- end
148
-
149
- # Returns the string representation of the object
150
- # @return [String] String presentation of the object
151
- def to_s
152
- to_hash.to_s
153
- end
154
-
155
- # to_body is an alias to to_hash (backward compatibility)
156
- # @return [Hash] Returns the object in the form of hash
157
- def to_body
158
- to_hash
159
- end
160
-
161
- # Returns the object in the form of hash
162
- # @return [Hash] Returns the object in the form of hash
163
- def to_hash
164
- hash = {}
165
- self.class.attribute_map.each_pair do |attr, param|
166
- value = self.send(attr)
167
- if value.nil?
168
- is_nullable = self.class.openapi_nullable.include?(attr)
169
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
170
- end
171
-
172
- hash[param] = _to_hash(value)
173
- end
174
- hash
175
- end
176
-
177
- # Outputs non-array value in the form of hash
178
- # For object, use to_hash. Otherwise, just return the value
179
- # @param [Object] value Any valid value
180
- # @return [Hash] Returns the value in the form of hash
181
- def _to_hash(value)
182
- if value.is_a?(Array)
183
- value.compact.map { |v| _to_hash(v) }
184
- elsif value.is_a?(Hash)
185
- {}.tap do |hash|
186
- value.each { |k, v| hash[k] = _to_hash(v) }
187
- end
188
- elsif value.respond_to? :to_hash
189
- value.to_hash
190
- else
191
- value
192
- end
193
- end
5
+ class CancelResponse < ModelBase
6
+ attribute :cancel_payment_response, :cancelPaymentResponse, :CancelPaymentResponse
7
+ attribute :shopping_cart, :shoppingCart, :ShoppingCartResult
194
8
  end
195
9
  end
196
10
  end
@@ -1,221 +1,16 @@
1
- require 'date'
2
- require 'time'
1
+ require_relative 'model_base'
3
2
 
4
3
  module PCPServerSDK
5
4
  module Models
6
- # Object containing Capture details.
7
- class CaptureOutput
8
- attr_accessor :amount_of_money
9
-
10
- # It allows you to store additional parameters for the transaction in JSON format. This field must not contain any personal data.
11
- attr_accessor :merchant_parameters
12
-
13
- attr_accessor :references
14
-
5
+ class CaptureOutput < ModelBase
6
+ attribute :amount_of_money, :amountOfMoney, :AmountOfMoney
7
+ # It allows you to store additional parameters for the transaction in JSON format.
8
+ # This field must not contain any personal data.
9
+ attribute :merchant_parameters, :merchantParameters, :String
10
+ attribute :references, :references, :PaymentReferences
15
11
  # Payment method identifier used by our payment engine.
16
- attr_accessor :payment_method
17
-
18
- attr_accessor :payment_instructions
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'amount_of_money' => :'amountOfMoney',
24
- :'merchant_parameters' => :'merchantParameters',
25
- :'references' => :'references',
26
- :'payment_method' => :'paymentMethod',
27
- :'payment_instructions' => :'paymentInstructions'
28
- }
29
- end
30
-
31
- # Returns all the JSON keys this model knows about.
32
- def self.acceptable_attributes
33
- attribute_map.values
34
- end
35
-
36
- # Attribute type mapping.
37
- def self.openapi_types
38
- {
39
- :'amount_of_money' => :'AmountOfMoney',
40
- :'merchant_parameters' => :'String',
41
- :'references' => :'PaymentReferences',
42
- :'payment_method' => :'String',
43
- :'payment_instructions' => :'PaymentInstructions'
44
- }
45
- end
46
-
47
- # List of attributes with nullable: true.
48
- def self.openapi_nullable
49
- Set.new([])
50
- end
51
-
52
- # Initializes the object.
53
- # @param [Hash] attributes Model attributes in the form of hash.
54
- def initialize(attributes = {})
55
- if (!attributes.is_a?(Hash))
56
- fail ArgumentError, "The input argument (attributes) must be a hash in `CaptureOutput` initialize method"
57
- end
58
-
59
- # Check to see if the attribute exists and convert string to symbol for hash key.
60
- attributes = attributes.each_with_object({}) { |(k, v), h|
61
- if (!self.class.attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `CaptureOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
- end
64
- h[k.to_sym] = v
65
- }
66
-
67
- if attributes.key?(:'amount_of_money')
68
- self.amount_of_money = attributes[:'amount_of_money']
69
- end
70
-
71
- if attributes.key?(:'merchant_parameters')
72
- self.merchant_parameters = attributes[:'merchant_parameters']
73
- end
74
-
75
- if attributes.key?(:'references')
76
- self.references = attributes[:'references']
77
- end
78
-
79
- if attributes.key?(:'payment_method')
80
- self.payment_method = attributes[:'payment_method']
81
- end
82
-
83
- if attributes.key?(:'payment_instructions')
84
- self.payment_instructions = attributes[:'payment_instructions']
85
- end
86
- end
87
-
88
- # Checks equality by comparing each attribute.
89
- # @param [Object] Object to be compared.
90
- def ==(o)
91
- return true if self.equal?(o)
92
- self.class == o.class &&
93
- amount_of_money == o.amount_of_money &&
94
- merchant_parameters == o.merchant_parameters &&
95
- references == o.references &&
96
- payment_method == o.payment_method &&
97
- payment_instructions == o.payment_instructions
98
- end
99
-
100
- # @see the `==` method.
101
- # @param [Object] Object to be compared.
102
- def eql?(o)
103
- self == o
104
- end
105
-
106
- # Calculates hash code according to all attributes.
107
- # @return [Integer] Hash code.
108
- def hash
109
- [amount_of_money, merchant_parameters, references, payment_method, payment_instructions].hash
110
- end
111
-
112
- # Builds the object from hash.
113
- # @param [Hash] attributes Model attributes in the form of hash.
114
- # @return [Object] Returns the model itself.
115
- def self.build_from_hash(attributes)
116
- return nil unless attributes.is_a?(Hash)
117
- attributes = attributes.transform_keys(&:to_sym)
118
- transformed_hash = {}
119
- openapi_types.each_pair do |key, type|
120
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
121
- transformed_hash["#{key}"] = nil
122
- elsif type =~ /\AArray<(.*)>/i
123
- if attributes[attribute_map[key]].is_a?(Array)
124
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
125
- end
126
- elsif !attributes[attribute_map[key]].nil?
127
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
128
- end
129
- end
130
- new(transformed_hash)
131
- end
132
-
133
- # Deserializes the data based on type.
134
- # @param string type Data type.
135
- # @param string value Value to be deserialized.
136
- # @return [Object] Deserialized data.
137
- def self._deserialize(type, value)
138
- case type.to_sym
139
- when :Time
140
- Time.parse(value)
141
- when :Date
142
- Date.parse(value)
143
- when :String
144
- value.to_s
145
- when :Integer
146
- value.to_i
147
- when :Float
148
- value.to_f
149
- when :Boolean
150
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
- true
152
- else
153
- false
154
- end
155
- when :Object
156
- value
157
- when /\AArray<(?<inner_type>.+)>\z/
158
- inner_type = Regexp.last_match[:inner_type]
159
- value.map { |v| _deserialize(inner_type, v) }
160
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
- k_type = Regexp.last_match[:k_type]
162
- v_type = Regexp.last_match[:v_type]
163
- {}.tap do |hash|
164
- value.each do |k, v|
165
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
- end
167
- end
168
- else # model
169
- klass = PCPServerSDK::Models.const_get(type)
170
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
171
- end
172
- end
173
-
174
- # Returns the string representation of the object.
175
- # @return [String] String presentation of the object.
176
- def to_s
177
- to_hash.to_s
178
- end
179
-
180
- # to_body is an alias to to_hash (backward compatibility).
181
- # @return [Hash] Returns the object in the form of hash.
182
- def to_body
183
- to_hash
184
- end
185
-
186
- # Returns the object in the form of hash.
187
- # @return [Hash] Returns the object in the form of hash.
188
- def to_hash
189
- hash = {}
190
- self.class.attribute_map.each_pair do |attr, param|
191
- value = self.send(attr)
192
- if value.nil?
193
- is_nullable = self.class.openapi_nullable.include?(attr)
194
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
- end
196
-
197
- hash[param] = _to_hash(value)
198
- end
199
- hash
200
- end
201
-
202
- # Outputs non-array value in the form of hash.
203
- # For object, use to_hash. Otherwise, just return the value.
204
- # @param [Object] value Any valid value.
205
- # @return [Hash] Returns the value in the form of hash.
206
- def _to_hash(value)
207
- if value.is_a?(Array)
208
- value.compact.map { |v| _to_hash(v) }
209
- elsif value.is_a?(Hash)
210
- {}.tap do |hash|
211
- value.each { |k, v| hash[k] = _to_hash(v) }
212
- end
213
- elsif value.respond_to? :to_hash
214
- value.to_hash
215
- else
216
- value
217
- end
218
- end
12
+ attribute :payment_method, :paymentMethod, :String
13
+ attribute :payment_instructions, :paymentInstructions, :PaymentInstructions
219
14
  end
220
15
  end
221
16
  end