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,234 +1,14 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
-
5
- # 3D Secure results object
6
3
  module PCPServerSDK
7
4
  module Models
8
- class ThreeDSecureResults
5
+ class ThreeDSecureResults < ModelBase
9
6
  # 3D Secure Protocol version used during this transaction.
10
- attr_accessor :version
11
-
7
+ attribute :version, :version, :String
12
8
  # 3D Secure ECI (Electronic Commerce Indicator) depending on the Scheme. Returned by DS.
13
- attr_accessor :scheme_eci
14
-
15
- # Exemption requested and applied in the authorization.
16
- attr_accessor :applied_exemption
17
-
18
-
19
-
20
- class EnumAttributeValidator
21
- attr_reader :datatype
22
- attr_reader :allowable_values
23
-
24
- def initialize(datatype, allowable_values)
25
- @allowable_values = allowable_values.map do |value|
26
- case datatype.to_s
27
- when /Integer/i
28
- value.to_i
29
- when /Float/i
30
- value.to_f
31
- else
32
- value
33
- end
34
- end
35
- end
36
-
37
- def valid?(value)
38
- !value || allowable_values.include?(value)
39
- end
40
- end
41
-
42
- # Attribute mapping from ruby-style variable name to JSON key.
43
- def self.attribute_map
44
- {
45
- :'version' => :'version',
46
- :'scheme_eci' => :'schemeEci',
47
- :'applied_exemption' => :'appliedExemption'
48
- }
49
- end
50
-
51
- # Returns all the JSON keys this model knows about
52
- def self.acceptable_attributes
53
- attribute_map.values
54
- end
55
-
56
- # Attribute type mapping.
57
- def self.openapi_types
58
- {
59
- :'version' => :'String',
60
- :'scheme_eci' => :'String',
61
- :'applied_exemption' => :'String'
62
- }
63
- end
64
-
65
- # List of attributes with nullable: true
66
- def self.openapi_nullable
67
- Set.new([
68
- ])
69
- end
70
-
71
- # Initializes the object
72
- # @param [Hash] attributes Model attributes in the form of hash
73
- def initialize(attributes = {})
74
- if (!attributes.is_a?(Hash))
75
- fail ArgumentError, "The input argument (attributes) must be a hash in `ThreeDSecureResults` initialize method"
76
- end
77
-
78
- # check to see if the attribute exists and convert string to symbol for hash key
79
- attributes = attributes.each_with_object({}) { |(k, v), h|
80
- if (!self.class.attribute_map.key?(k.to_sym))
81
- fail ArgumentError, "`#{k}` is not a valid attribute in `ThreeDSecureResults`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
- end
83
- h[k.to_sym] = v
84
- }
85
-
86
- if attributes.key?(:'version')
87
- self.version = attributes[:'version']
88
- end
89
-
90
- if attributes.key?(:'scheme_eci')
91
- self.scheme_eci = attributes[:'scheme_eci']
92
- end
93
-
94
- if attributes.key?(:'applied_exemption')
95
- self.applied_exemption = attributes[:'applied_exemption']
96
- end
97
- end
98
-
99
- # Checks equality by comparing each attribute.
100
- # @param [Object] Object to be compared
101
- def ==(o)
102
- return true if self.equal?(o)
103
- self.class == o.class &&
104
- version == o.version &&
105
- scheme_eci == o.scheme_eci &&
106
- applied_exemption == o.applied_exemption
107
- end
108
-
109
- # @see the `==` method
110
- # @param [Object] Object to be compared
111
- def eql?(o)
112
- self == o
113
- end
114
-
115
- # Calculates hash code according to all attributes.
116
- # @return [Integer] Hash code
117
- def hash
118
- [version, scheme_eci, applied_exemption].hash
119
- end
120
-
121
- # Builds the object from hash
122
- # @param [Hash] attributes Model attributes in the form of hash
123
- # @return [Object] Returns the model itself
124
- def self.build_from_hash(attributes)
125
- return nil unless attributes.is_a?(Hash)
126
- attributes = attributes.transform_keys(&:to_sym)
127
- transformed_hash = {}
128
- openapi_types.each_pair do |key, type|
129
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
130
- transformed_hash["#{key}"] = nil
131
- elsif type =~ /\AArray<(.*)>/i
132
- # check to ensure the input is an array given that the attribute
133
- # is documented as an array but the input is not
134
- if attributes[attribute_map[key]].is_a?(Array)
135
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
- end
137
- elsif !attributes[attribute_map[key]].nil?
138
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
139
- end
140
- end
141
- new(transformed_hash)
142
- end
143
-
144
- # Deserializes the data based on type
145
- # @param string type Data type
146
- # @param string value Value to be deserialized
147
- # @return [Object] Deserialized data
148
- def self._deserialize(type, value)
149
- case type.to_sym
150
- when :Time
151
- Time.parse(value)
152
- when :Date
153
- Date.parse(value)
154
- when :String
155
- value.to_s
156
- when :Integer
157
- value.to_i
158
- when :Float
159
- value.to_f
160
- when :Boolean
161
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
- true
163
- else
164
- false
165
- end
166
- when :Object
167
- # generic object (usually a Hash), return directly
168
- value
169
- when /\AArray<(?<inner_type>.+)>\z/
170
- inner_type = Regexp.last_match[:inner_type]
171
- value.map { |v| _deserialize(inner_type, v) }
172
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
- k_type = Regexp.last_match[:k_type]
174
- v_type = Regexp.last_match[:v_type]
175
- {}.tap do |hash|
176
- value.each do |k, v|
177
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
- end
179
- end
180
- else # model
181
- # models (e.g. Pet) or oneOf
182
- klass = PCPServerSDK::Models.const_get(type)
183
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
- end
185
- end
186
-
187
- # Returns the string representation of the object
188
- # @return [String] String presentation of the object
189
- def to_s
190
- to_hash.to_s
191
- end
192
-
193
- # to_body is an alias to to_hash (backward compatibility)
194
- # @return [Hash] Returns the object in the form of hash
195
- def to_body
196
- to_hash
197
- end
198
-
199
- # Returns the object in the form of hash
200
- # @return [Hash] Returns the object in the form of hash
201
- def to_hash
202
- hash = {}
203
- self.class.attribute_map.each_pair do |attr, param|
204
- value = self.send(attr)
205
- if value.nil?
206
- is_nullable = self.class.openapi_nullable.include?(attr)
207
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
- end
209
-
210
- hash[param] = _to_hash(value)
211
- end
212
- hash
213
- end
214
-
215
- # Outputs non-array value in the form of hash
216
- # For object, use to_hash. Otherwise, just return the value
217
- # @param [Object] value Any valid value
218
- # @return [Hash] Returns the value in the form of hash
219
- def _to_hash(value)
220
- if value.is_a?(Array)
221
- value.compact.map { |v| _to_hash(v) }
222
- elsif value.is_a?(Hash)
223
- {}.tap do |hash|
224
- value.each { |k, v| hash[k] = _to_hash(v) }
225
- end
226
- elsif value.respond_to? :to_hash
227
- value.to_hash
228
- else
229
- value
230
- end
231
- end
9
+ attribute :scheme_eci, :schemeEci, :String
10
+ # Exemption requested and applied in the authorization.
11
+ attribute :applied_exemption, :appliedExemption, :String, enum: ["low-value", "merchant-acquirer-transaction-risk-analysis"]
232
12
  end
233
13
  end
234
14
  end
@@ -15,7 +15,8 @@ module PCPServerSDK
15
15
  :include_payment_product_id, :include_checkout_status,
16
16
  :include_extended_checkout_status, :include_payment_channel,
17
17
  :payment_reference, :payment_id, :first_name, :surname,
18
- :email, :phone_number, :date_of_birth, :company_information, :terminal_id, :reporting_token
18
+ :email, :phone_number, :date_of_birth, :company_information, :terminal_id, :reporting_token,
19
+ :card_authorization_id, :receipt_number, :trace_number
19
20
 
20
21
  def initialize
21
22
  @include_payment_product_id = []
@@ -60,6 +61,9 @@ module PCPServerSDK
60
61
  query['companyInformation'] = @company_information if @company_information
61
62
  query['terminalId'] = @terminal_id if @terminal_id
62
63
  query['reportingToken'] = @reporting_token if @reporting_token
64
+ query['cardAuthorizationId'] = @card_authorization_id if @card_authorization_id
65
+ query['receiptNumber'] = @receipt_number if @receipt_number
66
+ query['traceNumber'] = @trace_number if @trace_number
63
67
 
64
68
  query
65
69
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module PCPServerSDK
3
- VERSION = '1.12.0'
3
+ VERSION = '1.14.0'
4
4
  end
@@ -6,6 +6,8 @@ require_relative 'PCP-server-Ruby-SDK/endpoints/commerce_case_api_client'
6
6
  require_relative 'PCP-server-Ruby-SDK/endpoints/order_management_checkout_actions_api_client'
7
7
  require_relative 'PCP-server-Ruby-SDK/endpoints/payment_execution_api_client'
8
8
  require_relative 'PCP-server-Ruby-SDK/endpoints/payment_information_api_client'
9
+ require_relative 'PCP-server-Ruby-SDK/endpoints/payment_intent_api_client'
10
+ require_relative 'PCP-server-Ruby-SDK/endpoints/pay_by_link_api_client'
9
11
 
10
12
  # Errors
11
13
  require_relative 'PCP-server-Ruby-SDK/errors/api_error_response_exception'
@@ -37,6 +39,7 @@ require_relative 'PCP-server-Ruby-SDK/models/capture_payment_request'
37
39
  require_relative 'PCP-server-Ruby-SDK/models/capture_payment_response'
38
40
  require_relative 'PCP-server-Ruby-SDK/models/card_fraud_results'
39
41
  require_relative 'PCP-server-Ruby-SDK/models/card_info'
42
+ require_relative 'PCP-server-Ruby-SDK/models/cart_item_data'
40
43
  require_relative 'PCP-server-Ruby-SDK/models/card_payment_details'
41
44
  require_relative 'PCP-server-Ruby-SDK/models/card_payment_method_specific_input'
42
45
  require_relative 'PCP-server-Ruby-SDK/models/card_payment_method_specific_output'
@@ -66,6 +69,7 @@ require_relative 'PCP-server-Ruby-SDK/models/create_commerce_case_request'
66
69
  require_relative 'PCP-server-Ruby-SDK/models/create_commerce_case_response'
67
70
  require_relative 'PCP-server-Ruby-SDK/models/create_payment_response'
68
71
  require_relative 'PCP-server-Ruby-SDK/models/customer'
72
+ require_relative 'PCP-server-Ruby-SDK/models/customer_account'
69
73
  require_relative 'PCP-server-Ruby-SDK/models/customer_device'
70
74
  require_relative 'PCP-server-Ruby-SDK/models/deliver_item'
71
75
  require_relative 'PCP-server-Ruby-SDK/models/deliver_request'
@@ -112,6 +116,20 @@ require_relative 'PCP-server-Ruby-SDK/models/payment_information_refund_response
112
116
  require_relative 'PCP-server-Ruby-SDK/models/payment_information_request'
113
117
  require_relative 'PCP-server-Ruby-SDK/models/payment_information_response'
114
118
  require_relative 'PCP-server-Ruby-SDK/models/payment_instructions'
119
+ require_relative 'PCP-server-Ruby-SDK/models/create_payment_intent'
120
+ require_relative 'PCP-server-Ruby-SDK/models/create_payment_intent_request'
121
+ require_relative 'PCP-server-Ruby-SDK/models/create_payment_intent_response'
122
+ require_relative 'PCP-server-Ruby-SDK/models/create_pay_by_link_request'
123
+ require_relative 'PCP-server-Ruby-SDK/models/create_pay_by_link_response'
124
+ require_relative 'PCP-server-Ruby-SDK/models/payment_intent_response_data'
125
+ require_relative 'PCP-server-Ruby-SDK/models/payment_intent_output'
126
+ require_relative 'PCP-server-Ruby-SDK/models/payment_intent_response'
127
+ require_relative 'PCP-server-Ruby-SDK/models/payment_method_specific_input_for_intent'
128
+ require_relative 'PCP-server-Ruby-SDK/models/payment_product840_specific_output_for_intent'
129
+ require_relative 'PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input_for_intent'
130
+ require_relative 'PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_create_intent'
131
+ require_relative 'PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_intent'
132
+ require_relative 'PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input_data'
115
133
  require_relative 'PCP-server-Ruby-SDK/models/payment_method_specific_input'
116
134
  require_relative 'PCP-server-Ruby-SDK/models/payment_output'
117
135
  require_relative 'PCP-server-Ruby-SDK/models/payment_product302_specific_input'
@@ -121,10 +139,15 @@ require_relative 'PCP-server-Ruby-SDK/models/payment_product3392_specific_input'
121
139
  require_relative 'PCP-server-Ruby-SDK/models/payment_product5002_specific_input'
122
140
  require_relative 'PCP-server-Ruby-SDK/models/payment_product771_specific_output'
123
141
  require_relative 'PCP-server-Ruby-SDK/models/payment_product840_customer_account'
142
+ require_relative 'PCP-server-Ruby-SDK/models/payment_product840_customer_account_for_intent'
124
143
  require_relative 'PCP-server-Ruby-SDK/models/payment_product840_specific_output'
125
144
  require_relative 'PCP-server-Ruby-SDK/models/payment_references'
145
+ require_relative 'PCP-server-Ruby-SDK/models/payment_references_for_payment_intent'
126
146
  require_relative 'PCP-server-Ruby-SDK/models/payment_references_for_refund'
127
147
  require_relative 'PCP-server-Ruby-SDK/models/payment_response'
148
+ require_relative 'PCP-server-Ruby-SDK/models/payment_link_order'
149
+ require_relative 'PCP-server-Ruby-SDK/models/payment_link_specific_input'
150
+ require_relative 'PCP-server-Ruby-SDK/models/pay_link_status_value'
128
151
  require_relative 'PCP-server-Ruby-SDK/models/payment_status_output'
129
152
  require_relative 'PCP-server-Ruby-SDK/models/payment_type'
130
153
  require_relative 'PCP-server-Ruby-SDK/models/payout_output'
@@ -159,7 +182,9 @@ require_relative 'PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_sp
159
182
  require_relative 'PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_product771_specific_input'
160
183
  require_relative 'PCP-server-Ruby-SDK/models/sepa_transfer_payment_product_772_specific_input'
161
184
  require_relative 'PCP-server-Ruby-SDK/models/shipping'
185
+ require_relative 'PCP-server-Ruby-SDK/models/shipping_address'
162
186
  require_relative 'PCP-server-Ruby-SDK/models/shopping_cart_input'
187
+ require_relative 'PCP-server-Ruby-SDK/models/shopping_cart_data'
163
188
  require_relative 'PCP-server-Ruby-SDK/models/shopping_cart_patch'
164
189
  require_relative 'PCP-server-Ruby-SDK/models/shopping_cart_result'
165
190
  require_relative 'PCP-server-Ruby-SDK/models/status_category_value'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pcp-serversdk-ruby",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pcp-serversdk-ruby",
9
- "version": "1.12.0",
9
+ "version": "1.14.0",
10
10
  "devDependencies": {
11
11
  "@commitlint/cli": "19.4.0",
12
12
  "@commitlint/config-conventional": "19.2.2",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pcp-serversdk-ruby",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "type": "commonjs",
5
5
  "scripts": {
6
6
  "changelog": "conventional-changelog -i CHANGELOG.md -s --config ./changelog.config.js"
@@ -0,0 +1,128 @@
1
+ # Regenerates eligible object model files from `api-definition.yaml` as concise
2
+ # `ModelBase` subclasses. Use this after an API-definition update or when the
3
+ # generated model layer needs to be brought back to the shared ModelBase style.
4
+ #
5
+ # The script rewrites eligible files in `lib/PCP-server-Ruby-SDK/models`; it is
6
+ # not a read-only audit. It intentionally excludes `oneOf`/`anyOf` schemas and
7
+ # keeps direct Ruby inheritance for single-parent `allOf` schemas. Attribute
8
+ # names, types, defaults, enums, and inheritance are derived from the API
9
+ # definition, making it the source of truth. Output filenames follow the Ruby
10
+ # naming convention, with documented exceptions for legacy filenames.
11
+ # Referenced object, composed, and enum schemas remain model types; only plain
12
+ # primitive aliases are converted to their Ruby primitive type.
13
+ #
14
+ # Running it can overwrite manual edits to eligible model files. Run it from a
15
+ # clean or understood worktree, then inspect `git diff` and run the full test
16
+ # suite before committing. Do not use it to regenerate endpoint clients or
17
+ # special composed models; those require manual implementation and review.
18
+
19
+ require 'pathname'
20
+ require 'set'
21
+ require 'yaml'
22
+
23
+ ROOT = Pathname.new(__dir__).parent
24
+ MODELS_DIRECTORY = ROOT.join('lib/PCP-server-Ruby-SDK/models')
25
+ SCHEMAS = YAML.unsafe_load_file(ROOT.join('api-definition.yaml')).fetch('components').fetch('schemas')
26
+ PRIMITIVE_TYPES = {
27
+ 'string' => :String,
28
+ 'integer' => :Integer,
29
+ 'number' => :Float,
30
+ 'boolean' => :Boolean
31
+ }.freeze
32
+ MODEL_FILE_OVERRIDES = {
33
+ # These existing filenames do not follow the class-name conversion convention.
34
+ 'MobilePaymentThreeDSecure' => 'mobile_payment_three_dsecure.rb',
35
+ 'SepaTransferPaymentProduct772SpecificInput' => 'sepa_transfer_payment_product_772_specific_input.rb'
36
+ }.freeze
37
+
38
+ def direct_parent_name(schema)
39
+ parents = Array(schema['allOf']).filter_map { |item| item['$ref']&.split('/')&.last }
40
+ parents.first if parents.size == 1
41
+ end
42
+
43
+ def local_properties(schema)
44
+ schema.fetch('properties', {}).merge(Array(schema['allOf']).each_with_object({}) do |item, properties|
45
+ properties.merge!(item.fetch('properties', {})) unless item.key?('$ref')
46
+ end)
47
+ end
48
+
49
+ def snake_case(value)
50
+ value.gsub(/([A-Z\d]+)([A-Z][a-z])/, '\\1_\\2')
51
+ .gsub(/([a-z\d])([A-Z])/, '\\1_\\2')
52
+ .tr('-', '_')
53
+ .downcase
54
+ end
55
+
56
+ def model_file(class_name)
57
+ MODELS_DIRECTORY.join(MODEL_FILE_OVERRIDES.fetch(class_name, "#{snake_case(class_name)}.rb"))
58
+ end
59
+
60
+ def ruby_type(schema, resolving = Set.new)
61
+ if schema['$ref']
62
+ name = schema['$ref'].split('/').last
63
+ return name.to_sym if resolving.include?(name)
64
+
65
+ referenced_schema = SCHEMAS.fetch(name)
66
+ # Enum references have generated model classes that validate deserialized values.
67
+ return name.to_sym if referenced_schema['type'] == 'object' || referenced_schema.key?('oneOf') || referenced_schema.key?('anyOf') || referenced_schema.key?('enum')
68
+
69
+ return ruby_type(referenced_schema, resolving | [name])
70
+ end
71
+
72
+ return ruby_type(schema.fetch('allOf').first, resolving) if schema['allOf']&.size == 1
73
+ return "Array<#{ruby_type(schema.fetch('items'), resolving)}>" if schema['type'] == 'array'
74
+
75
+ if schema['type'] == 'object' && schema['additionalProperties']
76
+ return "Hash<String, #{ruby_type(schema.fetch('additionalProperties'), resolving)}>"
77
+ end
78
+
79
+ return :Date if schema['format'] == 'date'
80
+ return :Time if schema['format'] == 'date-time'
81
+
82
+ PRIMITIVE_TYPES.fetch(schema['type'], :Object)
83
+ end
84
+
85
+ def description_lines(description)
86
+ description.to_s.lines.map do |line|
87
+ line.strip.empty? ? ' #' : " # #{line.strip}"
88
+ end
89
+ end
90
+
91
+ def render_model(class_name, attributes, parent_name)
92
+ superclass = parent_name || 'ModelBase'
93
+ dependency = parent_name ? snake_case(parent_name) : 'model_base'
94
+ output = ["require_relative '#{dependency}'", '', 'module PCPServerSDK', ' module Models', " class #{class_name} < #{superclass}"]
95
+
96
+ attributes.each do |name, json_name, type, property|
97
+ options = []
98
+ options << "default: #{property['default'].inspect}" if property.key?('default')
99
+ options << "enum: #{property['enum'].inspect}" if property.key?('enum')
100
+ output.concat(description_lines(property['description'])) if property.key?('description')
101
+ output << " attribute #{name.inspect}, #{json_name.inspect}, #{type.inspect}#{", #{options.join(', ')}" unless options.empty?}"
102
+ end
103
+
104
+ if parent_name
105
+ output << '' unless attributes.empty?
106
+ output << ' def self.openapi_all_of'
107
+ output << " [#{parent_name.to_sym.inspect}]"
108
+ output << ' end'
109
+ end
110
+
111
+ output.concat([' end', ' end', 'end', ''])
112
+ output.join("\n")
113
+ end
114
+
115
+ eligible = SCHEMAS.select do |_name, schema|
116
+ schema['type'] == 'object' && !schema.key?('oneOf') && !schema.key?('anyOf')
117
+ end
118
+
119
+ metadata = eligible.transform_values do |schema|
120
+ attributes = local_properties(schema).map do |json_name, property|
121
+ [snake_case(json_name).to_sym, json_name.to_sym, ruby_type(property), property]
122
+ end
123
+ { attributes: attributes, parent_name: direct_parent_name(schema) }
124
+ end
125
+
126
+ metadata.sort.each do |class_name, model_metadata|
127
+ model_file(class_name).write(render_model(class_name, model_metadata.fetch(:attributes), model_metadata.fetch(:parent_name)))
128
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+ require 'net/http'
3
+ require 'json'
4
+ require_relative '../../lib/PCP-server-Ruby-SDK.rb'
5
+
6
+ RSpec.describe PCPServerSDK::Endpoints::PayByLinkApiClient do
7
+ let(:config) { mock_communicator_config }
8
+ let(:client) { described_class.new(config) }
9
+ let(:payload) { double('PCPServerSDK::Models::CreatePayByLinkRequest') }
10
+ let(:response) do
11
+ double(
12
+ 'Response',
13
+ body: '{"status":"ACTIVE","paymentLinkId":"707ef15b-7a0a-48f2-b7d8-c95103418a9c"}',
14
+ code: 201
15
+ )
16
+ end
17
+
18
+ before do
19
+ allow(client).to receive(:get_response).and_return(response)
20
+ end
21
+
22
+ describe '#create_pay_by_link_request' do
23
+ it 'posts to the pay-by-link endpoint and deserializes its response' do
24
+ result = client.create_pay_by_link_request('1', '2', '3', payload)
25
+
26
+ expect(result).to be_a(PCPServerSDK::Models::CreatePayByLinkResponse)
27
+ expect(result.status).to eq('ACTIVE')
28
+ expect(result.payment_link_id).to eq('707ef15b-7a0a-48f2-b7d8-c95103418a9c')
29
+ end
30
+
31
+ it 'requires all path parameters and the payload' do
32
+ expect { client.create_pay_by_link_request(nil, '2', '3', payload) }.to raise_error(TypeError, 'Merchant ID is required')
33
+ expect { client.create_pay_by_link_request('1', nil, '3', payload) }.to raise_error(TypeError, 'Commerce Case ID is required')
34
+ expect { client.create_pay_by_link_request('1', '2', nil, payload) }.to raise_error(TypeError, 'Checkout ID is required')
35
+ expect { client.create_pay_by_link_request('1', '2', '3', nil) }.to raise_error(TypeError, 'Payload is required')
36
+ end
37
+ end
38
+ end
@@ -17,8 +17,13 @@ RSpec.describe PCPServerSDK::Endpoints::PaymentInformationApiClient do
17
17
  let(:payload) { double('PCPServerSDK::Models::PaymentInformationRequest') }
18
18
 
19
19
  context 'when request is successful' do
20
- let(:response) { double('Response', body: '{}', code: '200') }
21
- let(:expected_response) { PCPServerSDK::Models::PaymentInformationResponse.new }
20
+ let(:response) { double('Response', body: '{"traceNumber":"trace-123","receiptNumber":"receipt-123"}', code: '200') }
21
+ let(:expected_response) do
22
+ PCPServerSDK::Models::PaymentInformationResponse.new(
23
+ trace_number: 'trace-123',
24
+ receipt_number: 'receipt-123'
25
+ )
26
+ end
22
27
 
23
28
  before do
24
29
  allow(client).to receive(:get_response).and_return(response)
@@ -27,6 +32,8 @@ RSpec.describe PCPServerSDK::Endpoints::PaymentInformationApiClient do
27
32
  it 'returns a successful response' do
28
33
  result = client.create_payment_information('1', '2', '3', payload)
29
34
  expect(result).to eq(expected_response)
35
+ expect(result.trace_number).to eq('trace-123')
36
+ expect(result.receipt_number).to eq('receipt-123')
30
37
  end
31
38
  end
32
39
 
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+ require_relative '../../lib/PCP-server-Ruby-SDK'
4
+
5
+ RSpec.describe PCPServerSDK::Endpoints::PaymentIntentApiClient do
6
+ let(:config) { mock_communicator_config }
7
+ let(:client) { described_class.new(config) }
8
+
9
+ describe '#create_payment_intent' do
10
+ it 'posts the payload and deserializes the response' do
11
+ payload = PCPServerSDK::Models::CreatePaymentIntentRequest.new(
12
+ references: PCPServerSDK::Models::PaymentReferencesForPaymentIntent.new(merchant_reference: 'order-123')
13
+ )
14
+ response = double('Response', body: '{"paymentIntentOutput":{"paymentIntentId":"intent-1"}}', code: '201')
15
+ allow(client).to receive(:get_response).and_return(response)
16
+
17
+ result = client.create_payment_intent('merchant-1', payload)
18
+
19
+ expect(result).to be_a(PCPServerSDK::Models::CreatePaymentIntentResponse)
20
+ expect(result.payment_intent_output.payment_intent_id).to eq('intent-1')
21
+ end
22
+
23
+ it 'validates the merchant ID and payload' do
24
+ expect { client.create_payment_intent(nil, {}) }.to raise_error(TypeError, 'Merchant ID is required')
25
+ expect { client.create_payment_intent('merchant-1', nil) }.to raise_error(TypeError, 'Payload is required')
26
+ end
27
+ end
28
+
29
+ describe '#get_payment_intent' do
30
+ it 'deserializes the response' do
31
+ response = double('Response', body: '{"paymentIntentId":"intent-1"}', code: '200')
32
+ allow(client).to receive(:get_response).and_return(response)
33
+
34
+ result = client.get_payment_intent('merchant-1', 'intent-1')
35
+
36
+ expect(result).to be_a(PCPServerSDK::Models::PaymentIntentResponse)
37
+ expect(result.payment_intent_id).to eq('intent-1')
38
+ end
39
+
40
+ it 'validates the merchant ID and payment intent ID' do
41
+ expect { client.get_payment_intent(nil, 'intent-1') }.to raise_error(TypeError, 'Merchant ID is required')
42
+ expect { client.get_payment_intent('merchant-1', nil) }.to raise_error(TypeError, 'Payment Intent ID is required')
43
+ end
44
+ end
45
+ end