pcp-server-ruby-sdk 1.12.0 → 1.14.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 (181) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/api-definition.yaml +693 -40
  5. data/lib/PCP-server-Ruby-SDK/endpoints/pay_by_link_api_client.rb +33 -0
  6. data/lib/PCP-server-Ruby-SDK/endpoints/payment_intent_api_client.rb +37 -0
  7. data/lib/PCP-server-Ruby-SDK/models/address.rb +9 -237
  8. data/lib/PCP-server-Ruby-SDK/models/address_personal.rb +10 -246
  9. data/lib/PCP-server-Ruby-SDK/models/amount_of_money.rb +4 -195
  10. data/lib/PCP-server-Ruby-SDK/models/api_error.rb +27 -232
  11. data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_header_information.rb +6 -194
  12. data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_information.rb +8 -229
  13. data/lib/PCP-server-Ruby-SDK/models/authentication_token.rb +6 -183
  14. data/lib/PCP-server-Ruby-SDK/models/bank_account_information.rb +11 -207
  15. data/lib/PCP-server-Ruby-SDK/models/bank_payout_method_specific_input.rb +4 -187
  16. data/lib/PCP-server-Ruby-SDK/models/cancel_item.rb +6 -195
  17. data/lib/PCP-server-Ruby-SDK/models/cancel_payment_request.rb +6 -222
  18. data/lib/PCP-server-Ruby-SDK/models/cancel_payment_response.rb +4 -190
  19. data/lib/PCP-server-Ruby-SDK/models/cancel_request.rb +6 -224
  20. data/lib/PCP-server-Ruby-SDK/models/cancel_response.rb +4 -190
  21. data/lib/PCP-server-Ruby-SDK/models/capture_output.rb +9 -214
  22. data/lib/PCP-server-Ruby-SDK/models/capture_payment_request.rb +14 -253
  23. data/lib/PCP-server-Ruby-SDK/models/capture_payment_response.rb +7 -239
  24. data/lib/PCP-server-Ruby-SDK/models/card_fraud_results.rb +29 -184
  25. data/lib/PCP-server-Ruby-SDK/models/card_info.rb +3 -182
  26. data/lib/PCP-server-Ruby-SDK/models/card_payment_details.rb +8 -210
  27. data/lib/PCP-server-Ruby-SDK/models/card_payment_method_specific_input.rb +32 -307
  28. data/lib/PCP-server-Ruby-SDK/models/card_payment_method_specific_output.rb +6 -210
  29. data/lib/PCP-server-Ruby-SDK/models/card_recurrence_details.rb +12 -186
  30. data/lib/PCP-server-Ruby-SDK/models/cart_item_data.rb +10 -0
  31. data/lib/PCP-server-Ruby-SDK/models/cart_item_input.rb +5 -198
  32. data/lib/PCP-server-Ruby-SDK/models/cart_item_invoice_data.rb +5 -184
  33. data/lib/PCP-server-Ruby-SDK/models/cart_item_order_status.rb +4 -213
  34. data/lib/PCP-server-Ruby-SDK/models/cart_item_patch.rb +5 -200
  35. data/lib/PCP-server-Ruby-SDK/models/cart_item_result.rb +5 -200
  36. data/lib/PCP-server-Ruby-SDK/models/cart_item_supplier_references.rb +6 -195
  37. data/lib/PCP-server-Ruby-SDK/models/checkout_references.rb +4 -192
  38. data/lib/PCP-server-Ruby-SDK/models/checkout_response.rb +15 -319
  39. data/lib/PCP-server-Ruby-SDK/models/checkouts_response.rb +4 -193
  40. data/lib/PCP-server-Ruby-SDK/models/company_information.rb +3 -182
  41. data/lib/PCP-server-Ruby-SDK/models/complete_financing_payment_method_specific_input.rb +12 -202
  42. data/lib/PCP-server-Ruby-SDK/models/complete_order_request.rb +3 -181
  43. data/lib/PCP-server-Ruby-SDK/models/complete_payment_method_specific_input.rb +4 -191
  44. data/lib/PCP-server-Ruby-SDK/models/complete_payment_product840_specific_input.rb +7 -226
  45. data/lib/PCP-server-Ruby-SDK/models/complete_payment_request.rb +6 -209
  46. data/lib/PCP-server-Ruby-SDK/models/complete_payment_response.rb +5 -199
  47. data/lib/PCP-server-Ruby-SDK/models/complete_redirect_payment_method_specific_input.rb +4 -192
  48. data/lib/PCP-server-Ruby-SDK/models/contact_details.rb +4 -191
  49. data/lib/PCP-server-Ruby-SDK/models/create_checkout_request.rb +13 -240
  50. data/lib/PCP-server-Ruby-SDK/models/create_checkout_response.rb +16 -307
  51. data/lib/PCP-server-Ruby-SDK/models/create_commerce_case_response.rb +7 -219
  52. data/lib/PCP-server-Ruby-SDK/models/create_pay_by_link_request.rb +12 -0
  53. data/lib/PCP-server-Ruby-SDK/models/create_pay_by_link_response.rb +13 -0
  54. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent.rb +11 -0
  55. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent_request.rb +13 -0
  56. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent_response.rb +10 -0
  57. data/lib/PCP-server-Ruby-SDK/models/create_payment_response.rb +7 -218
  58. data/lib/PCP-server-Ruby-SDK/models/customer.rb +28 -260
  59. data/lib/PCP-server-Ruby-SDK/models/customer_account.rb +10 -44
  60. data/lib/PCP-server-Ruby-SDK/models/customer_device.rb +8 -209
  61. data/lib/PCP-server-Ruby-SDK/models/deliver_item.rb +6 -195
  62. data/lib/PCP-server-Ruby-SDK/models/deliver_request.rb +10 -246
  63. data/lib/PCP-server-Ruby-SDK/models/deliver_response.rb +4 -191
  64. data/lib/PCP-server-Ruby-SDK/models/delivery_information.rb +3 -185
  65. data/lib/PCP-server-Ruby-SDK/models/error_response.rb +4 -193
  66. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_input.rb +15 -203
  67. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_output.rb +10 -196
  68. data/lib/PCP-server-Ruby-SDK/models/fund_distribution.rb +12 -263
  69. data/lib/PCP-server-Ruby-SDK/models/fund_split.rb +5 -205
  70. data/lib/PCP-server-Ruby-SDK/models/fund_split_request.rb +3 -147
  71. data/lib/PCP-server-Ruby-SDK/models/fund_split_response.rb +10 -174
  72. data/lib/PCP-server-Ruby-SDK/models/installment_option.rb +13 -273
  73. data/lib/PCP-server-Ruby-SDK/models/link_information.rb +4 -196
  74. data/lib/PCP-server-Ruby-SDK/models/merchant_action.rb +16 -194
  75. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_input.rb +13 -246
  76. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_output.rb +7 -219
  77. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_three_dsecure.rb +3 -179
  78. data/lib/PCP-server-Ruby-SDK/models/model_base.rb +147 -0
  79. data/lib/PCP-server-Ruby-SDK/models/order.rb +7 -221
  80. data/lib/PCP-server-Ruby-SDK/models/order_item.rb +6 -197
  81. data/lib/PCP-server-Ruby-SDK/models/order_line_details_input.rb +29 -305
  82. data/lib/PCP-server-Ruby-SDK/models/order_line_details_patch.rb +5 -326
  83. data/lib/PCP-server-Ruby-SDK/models/order_line_details_result.rb +5 -326
  84. data/lib/PCP-server-Ruby-SDK/models/order_request.rb +7 -244
  85. data/lib/PCP-server-Ruby-SDK/models/order_response.rb +4 -192
  86. data/lib/PCP-server-Ruby-SDK/models/patch_checkout_request.rb +8 -228
  87. data/lib/PCP-server-Ruby-SDK/models/patch_commerce_case_request.rb +3 -183
  88. data/lib/PCP-server-Ruby-SDK/models/pause_payment_request.rb +2 -165
  89. data/lib/PCP-server-Ruby-SDK/models/pause_payment_response.rb +3 -186
  90. data/lib/PCP-server-Ruby-SDK/models/pay_link_status_value.rb +20 -0
  91. data/lib/PCP-server-Ruby-SDK/models/payee.rb +6 -204
  92. data/lib/PCP-server-Ruby-SDK/models/payment_creation_output.rb +3 -183
  93. data/lib/PCP-server-Ruby-SDK/models/payment_event.rb +19 -274
  94. data/lib/PCP-server-Ruby-SDK/models/payment_execution.rb +29 -335
  95. data/lib/PCP-server-Ruby-SDK/models/payment_execution_request.rb +4 -191
  96. data/lib/PCP-server-Ruby-SDK/models/payment_execution_specific_input.rb +6 -212
  97. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_request.rb +7 -205
  98. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_response.rb +5 -196
  99. data/lib/PCP-server-Ruby-SDK/models/payment_information_request.rb +10 -249
  100. data/lib/PCP-server-Ruby-SDK/models/payment_information_response.rb +34 -314
  101. data/lib/PCP-server-Ruby-SDK/models/payment_instructions.rb +8 -214
  102. data/lib/PCP-server-Ruby-SDK/models/payment_intent_output.rb +13 -0
  103. data/lib/PCP-server-Ruby-SDK/models/payment_intent_response.rb +13 -0
  104. data/lib/PCP-server-Ruby-SDK/models/payment_intent_response_data.rb +12 -0
  105. data/lib/PCP-server-Ruby-SDK/models/payment_link_order.rb +10 -0
  106. data/lib/PCP-server-Ruby-SDK/models/payment_link_specific_input.rb +19 -0
  107. data/lib/PCP-server-Ruby-SDK/models/payment_method_specific_input.rb +9 -261
  108. data/lib/PCP-server-Ruby-SDK/models/payment_method_specific_input_for_intent.rb +9 -0
  109. data/lib/PCP-server-Ruby-SDK/models/payment_output.rb +11 -255
  110. data/lib/PCP-server-Ruby-SDK/models/payment_product302_specific_input.rb +11 -225
  111. data/lib/PCP-server-Ruby-SDK/models/payment_product3391_specific_input.rb +6 -197
  112. data/lib/PCP-server-Ruby-SDK/models/payment_product3391_specific_output.rb +3 -185
  113. data/lib/PCP-server-Ruby-SDK/models/payment_product3392_specific_input.rb +3 -185
  114. data/lib/PCP-server-Ruby-SDK/models/payment_product5002_specific_input.rb +7 -203
  115. data/lib/PCP-server-Ruby-SDK/models/payment_product771_specific_output.rb +3 -183
  116. data/lib/PCP-server-Ruby-SDK/models/payment_product840_customer_account.rb +6 -210
  117. data/lib/PCP-server-Ruby-SDK/models/payment_product840_customer_account_for_intent.rb +12 -0
  118. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output.rb +6 -211
  119. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output_for_intent.rb +12 -0
  120. data/lib/PCP-server-Ruby-SDK/models/payment_references.rb +6 -184
  121. data/lib/PCP-server-Ruby-SDK/models/payment_references_for_payment_intent.rb +11 -0
  122. data/lib/PCP-server-Ruby-SDK/models/payment_references_for_refund.rb +12 -197
  123. data/lib/PCP-server-Ruby-SDK/models/payment_response.rb +6 -234
  124. data/lib/PCP-server-Ruby-SDK/models/payment_status_output.rb +6 -234
  125. data/lib/PCP-server-Ruby-SDK/models/payout_output.rb +5 -205
  126. data/lib/PCP-server-Ruby-SDK/models/payout_response.rb +6 -215
  127. data/lib/PCP-server-Ruby-SDK/models/personal_information.rb +11 -227
  128. data/lib/PCP-server-Ruby-SDK/models/personal_name.rb +5 -201
  129. data/lib/PCP-server-Ruby-SDK/models/positive_amount_of_money.rb +4 -196
  130. data/lib/PCP-server-Ruby-SDK/models/processing_mandate_information.rb +9 -254
  131. data/lib/PCP-server-Ruby-SDK/models/redirect_data.rb +3 -183
  132. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input.rb +14 -249
  133. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input_for_intent.rb +12 -0
  134. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output.rb +6 -211
  135. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_create_intent.rb +12 -0
  136. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_intent.rb +10 -0
  137. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input.rb +6 -205
  138. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input_data.rb +10 -0
  139. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product900_specific_input.rb +12 -177
  140. data/lib/PCP-server-Ruby-SDK/models/redirection_data.rb +11 -186
  141. data/lib/PCP-server-Ruby-SDK/models/references.rb +47 -205
  142. data/lib/PCP-server-Ruby-SDK/models/refresh_payment_request.rb +3 -186
  143. data/lib/PCP-server-Ruby-SDK/models/refund_error_response.rb +4 -193
  144. data/lib/PCP-server-Ruby-SDK/models/refund_output.rb +8 -211
  145. data/lib/PCP-server-Ruby-SDK/models/refund_payment_response.rb +7 -242
  146. data/lib/PCP-server-Ruby-SDK/models/refund_request.rb +6 -210
  147. data/lib/PCP-server-Ruby-SDK/models/return_information.rb +4 -194
  148. data/lib/PCP-server-Ruby-SDK/models/return_item.rb +6 -196
  149. data/lib/PCP-server-Ruby-SDK/models/return_request.rb +6 -234
  150. data/lib/PCP-server-Ruby-SDK/models/return_response.rb +4 -191
  151. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_specific_input.rb +4 -193
  152. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_specific_output.rb +4 -193
  153. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_product771_specific_input.rb +4 -192
  154. data/lib/PCP-server-Ruby-SDK/models/sepa_transfer_payment_product_772_specific_input.rb +3 -186
  155. data/lib/PCP-server-Ruby-SDK/models/shipping.rb +3 -183
  156. data/lib/PCP-server-Ruby-SDK/models/shipping_address.rb +14 -0
  157. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_data.rb +9 -0
  158. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_input.rb +3 -185
  159. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_patch.rb +3 -185
  160. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_result.rb +3 -185
  161. data/lib/PCP-server-Ruby-SDK/models/status_output.rb +21 -264
  162. data/lib/PCP-server-Ruby-SDK/models/three_d_secure_results.rb +6 -226
  163. data/lib/PCP-server-Ruby-SDK/queries/get_checkouts_query.rb +5 -1
  164. data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
  165. data/lib/PCP-server-Ruby-SDK.rb +25 -0
  166. data/package-lock.json +2 -2
  167. data/package.json +1 -1
  168. data/scripts/convert_models_to_model_base.rb +128 -0
  169. data/spec/endpoints/pay_by_link_api_client_spec.rb +38 -0
  170. data/spec/endpoints/payment_information_api_client_spec.rb +9 -2
  171. data/spec/endpoints/payment_intent_api_client_spec.rb +45 -0
  172. data/spec/models/api_definition_conformance_spec.rb +88 -0
  173. data/spec/models/model_base_spec.rb +87 -0
  174. data/spec/models/pay_by_link_models_spec.rb +50 -0
  175. data/spec/models/payment_intent_models_spec.rb +51 -0
  176. data/spec/models/required_field_validation_spec.rb +5 -5
  177. data/spec/queries/get_checkouts_query_spec.rb +15 -0
  178. metadata +45 -10
  179. data/lib/PCP-server-Ruby-SDK/models/action_type.rb +0 -34
  180. data/lib/PCP-server-Ruby-SDK/models/avs_result.rb +0 -52
  181. data/lib/PCP-server-Ruby-SDK/models/business_relation.rb +0 -30
@@ -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
@@ -1,259 +1,20 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
3
  module PCPServerSDK
5
4
  module Models
6
- # If the shopping cart is specified, a Capture is made with the amount of the shopping cart for the items that are specified.
7
- class CapturePaymentRequest
8
- # Here you can specify the amount that you want to capture (specified in cents, where single digit currencies are presumed to have 2 digits). The amount can be lower than the amount that was authorized, but not higher. If left empty, the full amount will be captured and the request will be final. If the full amount is captured, the request will also be final.
9
- attr_accessor :amount
10
-
11
- # This property indicates whether this will be the final operation. If the full amount should not captured but the property is set to true, the remaining amount will automatically be cancelled.
12
- attr_accessor :is_final
13
-
14
- attr_accessor :cancellation_reason
15
-
16
- attr_accessor :references
17
-
18
- attr_accessor :delivery
19
-
20
- attr_accessor :fund_split
21
-
22
- class EnumAttributeValidator
23
- attr_reader :datatype
24
- attr_reader :allowable_values
25
-
26
- def initialize(datatype, allowable_values)
27
- @allowable_values = allowable_values.map do |value|
28
- case datatype.to_s
29
- when /Integer/i
30
- value.to_i
31
- when /Float/i
32
- value.to_f
33
- else
34
- value
35
- end
36
- end
37
- end
38
-
39
- def valid?(value)
40
- !value || allowable_values.include?(value)
41
- end
42
- end
43
-
44
- # Attribute mapping from ruby-style variable name to JSON key.
45
- def self.attribute_map
46
- {
47
- :'amount' => :'amount',
48
- :'is_final' => :'isFinal',
49
- :'cancellation_reason' => :'cancellationReason',
50
- :'references' => :'references',
51
- :'delivery' => :'delivery',
52
- :'fund_split' => :'fundSplit'
53
- }
54
- end
55
-
56
- # Returns all the JSON keys this model knows about
57
- def self.acceptable_attributes
58
- attribute_map.values
59
- end
60
-
61
- # Attribute type mapping.
62
- def self.openapi_types
63
- {
64
- :'amount' => :'Integer',
65
- :'is_final' => :'Boolean',
66
- :'cancellation_reason' => :'CancellationReason',
67
- :'references' => :'PaymentReferences',
68
- :'delivery' => :'DeliveryInformation',
69
- :'fund_split' => :'FundSplit'
70
- }
71
- end
72
-
73
- # List of attributes with nullable: true
74
- def self.openapi_nullable
75
- Set.new([
76
- ])
77
- end
78
-
79
- # Initializes the object
80
- # @param [Hash] attributes Model attributes in the form of hash
81
- def initialize(attributes = {})
82
- if (!attributes.is_a?(Hash))
83
- fail ArgumentError, "The input argument (attributes) must be a hash in `CapturePaymentRequest` initialize method"
84
- end
85
-
86
- # check to see if the attribute exists and convert string to symbol for hash key
87
- attributes = attributes.each_with_object({}) { |(k, v), h|
88
- if (!self.class.attribute_map.key?(k.to_sym))
89
- fail ArgumentError, "`#{k}` is not a valid attribute in `CapturePaymentRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
- end
91
- h[k.to_sym] = v
92
- }
93
-
94
- if attributes.key?(:'amount')
95
- self.amount = attributes[:'amount']
96
- end
97
-
98
- if attributes.key?(:'is_final')
99
- self.is_final = attributes[:'is_final']
100
- else
101
- self.is_final = false
102
- end
103
-
104
- if attributes.key?(:'cancellation_reason')
105
- self.cancellation_reason = attributes[:'cancellation_reason']
106
- end
107
-
108
- if attributes.key?(:'references')
109
- self.references = attributes[:'references']
110
- end
111
-
112
- if attributes.key?(:'delivery')
113
- self.delivery = attributes[:'delivery']
114
- end
115
-
116
- if attributes.key?(:'fund_split')
117
- self.fund_split = attributes[:'fund_split']
118
- end
119
- end
120
-
121
- # Checks equality by comparing each attribute.
122
- # @param [Object] Object to be compared
123
- def ==(o)
124
- return true if self.equal?(o)
125
- self.class == o.class &&
126
- amount == o.amount &&
127
- is_final == o.is_final &&
128
- cancellation_reason == o.cancellation_reason &&
129
- references == o.references &&
130
- delivery == o.delivery &&
131
- fund_split == o.fund_split
132
- end
133
-
134
- # @see the `==` method
135
- # @param [Object] Object to be compared
136
- def eql?(o)
137
- self == o
138
- end
139
-
140
- # Calculates hash code according to all attributes.
141
- # @return [Integer] Hash code
142
- def hash
143
- [amount, is_final, cancellation_reason, references, delivery, fund_split].hash
144
- end
145
-
146
- # Builds the object from hash
147
- # @param [Hash] attributes Model attributes in the form of hash
148
- # @return [Object] Returns the model itself
149
- def self.build_from_hash(attributes)
150
- return nil unless attributes.is_a?(Hash)
151
- attributes = attributes.transform_keys(&:to_sym)
152
- transformed_hash = {}
153
- openapi_types.each_pair do |key, type|
154
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
155
- transformed_hash["#{key}"] = nil
156
- elsif type =~ /\AArray<(.*)>/i
157
- # check to ensure the input is an array given that the attribute
158
- # is documented as an array but the input is not
159
- if attributes[attribute_map[key]].is_a?(Array)
160
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
161
- end
162
- elsif !attributes[attribute_map[key]].nil?
163
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
164
- end
165
- end
166
- new(transformed_hash)
167
- end
168
-
169
- # Deserializes the data based on type
170
- # @param string type Data type
171
- # @param string value Value to be deserialized
172
- # @return [Object] Deserialized data
173
- def self._deserialize(type, value)
174
- case type.to_sym
175
- when :Time
176
- Time.parse(value)
177
- when :Date
178
- Date.parse(value)
179
- when :String
180
- value.to_s
181
- when :Integer
182
- value.to_i
183
- when :Float
184
- value.to_f
185
- when :Boolean
186
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
- true
188
- else
189
- false
190
- end
191
- when :Object
192
- # generic object (usually a Hash), return directly
193
- value
194
- when /\AArray<(?<inner_type>.+)>\z/
195
- inner_type = Regexp.last_match[:inner_type]
196
- value.map { |v| _deserialize(inner_type, v) }
197
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
- k_type = Regexp.last_match[:k_type]
199
- v_type = Regexp.last_match[:v_type]
200
- {}.tap do |hash|
201
- value.each do |k, v|
202
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
- end
204
- end
205
- else # model
206
- # models (e.g. Pet) or oneOf
207
- klass = PCPServerSDK::Models.const_get(type)
208
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
- end
210
- end
211
-
212
- # Returns the string representation of the object
213
- # @return [String] String presentation of the object
214
- def to_s
215
- to_hash.to_s
216
- end
217
-
218
- # to_body is an alias to to_hash (backward compatibility)
219
- # @return [Hash] Returns the object in the form of hash
220
- def to_body
221
- to_hash
222
- end
223
-
224
- # Returns the object in the form of hash
225
- # @return [Hash] Returns the object in the form of hash
226
- def to_hash
227
- hash = {}
228
- self.class.attribute_map.each_pair do |attr, param|
229
- value = self.send(attr)
230
- if value.nil?
231
- is_nullable = self.class.openapi_nullable.include?(attr)
232
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
- end
234
-
235
- hash[param] = _to_hash(value)
236
- end
237
- hash
238
- end
239
-
240
- # Outputs non-array value in the form of hash
241
- # For object, use to_hash. Otherwise, just return the value
242
- # @param [Object] value Any valid value
243
- # @return [Hash] Returns the value in the form of hash
244
- def _to_hash(value)
245
- if value.is_a?(Array)
246
- value.compact.map { |v| _to_hash(v) }
247
- elsif value.is_a?(Hash)
248
- {}.tap do |hash|
249
- value.each { |k, v| hash[k] = _to_hash(v) }
250
- end
251
- elsif value.respond_to? :to_hash
252
- value.to_hash
253
- else
254
- value
255
- end
256
- end
5
+ class CapturePaymentRequest < ModelBase
6
+ # Here you can specify the amount that you want to capture (specified in cents, where single digit currencies
7
+ # are presumed to have 2 digits). The amount can be lower than the amount that was authorized, but not higher.
8
+ # If left empty, the full amount will be captured and the request will be final.
9
+ # If the full amount is captured, the request will also be final.
10
+ attribute :amount, :amount, :Integer
11
+ # This property indicates whether this will be the final operation.
12
+ # If the full amount should not captured but the property is set to true, the remaining amount will automatically be cancelled.
13
+ attribute :is_final, :isFinal, :Boolean, default: false
14
+ attribute :cancellation_reason, :cancellationReason, :CancellationReason
15
+ attribute :references, :references, :PaymentReferences
16
+ attribute :delivery, :delivery, :DeliveryInformation
17
+ attribute :fund_split, :fundSplit, :FundSplit
257
18
  end
258
19
  end
259
20
  end