pcp-server-ruby-sdk 1.0.0 → 1.1.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/api-definition.yaml +4737 -0
  4. data/lib/PCP-server-Ruby-SDK/endpoints/checkout_api_client.rb +24 -0
  5. data/lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb +47 -0
  6. data/lib/PCP-server-Ruby-SDK/endpoints/payment_information_api_client.rb +27 -2
  7. data/lib/PCP-server-Ruby-SDK/models/bank_account_information.rb +17 -5
  8. data/lib/PCP-server-Ruby-SDK/models/bank_payout_method_specific_input.rb +198 -0
  9. data/lib/PCP-server-Ruby-SDK/models/capture_output.rb +45 -41
  10. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_output.rb +43 -40
  11. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_input.rb +16 -33
  12. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_three_dsecure.rb +185 -0
  13. data/lib/PCP-server-Ruby-SDK/models/order_line_details_input.rb +12 -6
  14. data/lib/PCP-server-Ruby-SDK/models/{payment_product320_specific_input.rb → pause_payment_request.rb} +13 -31
  15. data/lib/PCP-server-Ruby-SDK/models/pause_payment_response.rb +192 -0
  16. data/lib/PCP-server-Ruby-SDK/models/payee.rb +212 -0
  17. data/lib/PCP-server-Ruby-SDK/models/payment_event.rb +14 -14
  18. data/lib/PCP-server-Ruby-SDK/models/payment_execution.rb +39 -5
  19. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_request.rb +212 -0
  20. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_response.rb +202 -0
  21. data/lib/PCP-server-Ruby-SDK/models/payment_information_response.rb +40 -25
  22. data/lib/PCP-server-Ruby-SDK/models/payment_instructions.rb +222 -0
  23. data/lib/PCP-server-Ruby-SDK/models/payment_product302_specific_input.rb +232 -0
  24. data/lib/PCP-server-Ruby-SDK/models/payout_output.rb +28 -24
  25. data/lib/PCP-server-Ruby-SDK/models/payout_response.rb +6 -25
  26. data/lib/PCP-server-Ruby-SDK/models/refresh_payment_request.rb +192 -0
  27. data/lib/PCP-server-Ruby-SDK/models/refresh_type.rb +30 -0
  28. data/lib/PCP-server-Ruby-SDK/models/sepa_transfer_payment_product_772_specific_input.rb +192 -0
  29. data/lib/PCP-server-Ruby-SDK/models/status_value.rb +12 -10
  30. data/lib/PCP-server-Ruby-SDK/queries/get_checkouts_query.rb +3 -1
  31. data/lib/PCP-server-Ruby-SDK/transformer/apple_pay_transformer.rb +2 -2
  32. data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
  33. data/lib/PCP-server-Ruby-SDK.rb +24 -2
  34. data/package-lock.json +196 -243
  35. data/package.json +1 -1
  36. data/scripts.sh +7 -14
  37. data/spec/endpoints/checkout_api_client_spec.rb +51 -0
  38. data/spec/endpoints/payment_execution_api_client_spec.rb +102 -0
  39. data/spec/endpoints/payment_information_api_client_spec.rb +52 -0
  40. data/spec/transformer/apple_pay_transformer_spec.rb +1 -1
  41. data/spec/utils/server_meta_info_spec.rb +2 -2
  42. metadata +19 -7
@@ -1,25 +1,27 @@
1
-
2
1
  require 'date'
3
2
  require 'time'
4
3
 
5
- # Object containing the specific output details for financing payment methods (Buy Now Pay Later)
6
4
  module PCPServerSDK
7
5
  module Models
6
+ # Object containing the specific output details for financing payment methods (Buy Now Pay Later).
8
7
  class FinancingPaymentMethodSpecificOutput
9
- # Payment product identifier - please check product documentation for a full overview of possible values. Currently supported payment methods * 3390 - PAYONE Secured Invoice * 3391 - PAYONE Secured Installment * 3392 - PAYONE Secured Direct Debit
8
+ # Payment product identifier.
10
9
  attr_accessor :payment_product_id
11
10
 
12
11
  attr_accessor :payment_product3391_specific_output
13
12
 
13
+ attr_accessor :payment_instructions
14
+
14
15
  # Attribute mapping from ruby-style variable name to JSON key.
15
16
  def self.attribute_map
16
17
  {
17
18
  :'payment_product_id' => :'paymentProductId',
18
- :'payment_product3391_specific_output' => :'paymentProduct3391SpecificOutput'
19
+ :'payment_product3391_specific_output' => :'paymentProduct3391SpecificOutput',
20
+ :'payment_instructions' => :'paymentInstructions'
19
21
  }
20
22
  end
21
23
 
22
- # Returns all the JSON keys this model knows about
24
+ # Returns all the JSON keys this model knows about.
23
25
  def self.acceptable_attributes
24
26
  attribute_map.values
25
27
  end
@@ -28,24 +30,24 @@ module PCPServerSDK
28
30
  def self.openapi_types
29
31
  {
30
32
  :'payment_product_id' => :'Integer',
31
- :'payment_product3391_specific_output' => :'PaymentProduct3391SpecificOutput'
33
+ :'payment_product3391_specific_output' => :'PaymentProduct3391SpecificOutput',
34
+ :'payment_instructions' => :'PaymentInstructions'
32
35
  }
33
36
  end
34
37
 
35
- # List of attributes with nullable: true
38
+ # List of attributes with nullable: true.
36
39
  def self.openapi_nullable
37
- Set.new([
38
- ])
40
+ Set.new([])
39
41
  end
40
42
 
41
- # Initializes the object
42
- # @param [Hash] attributes Model attributes in the form of hash
43
+ # Initializes the object.
44
+ # @param [Hash] attributes Model attributes in the form of hash.
43
45
  def initialize(attributes = {})
44
46
  if (!attributes.is_a?(Hash))
45
47
  fail ArgumentError, "The input argument (attributes) must be a hash in `FinancingPaymentMethodSpecificOutput` initialize method"
46
48
  end
47
49
 
48
- # check to see if the attribute exists and convert string to symbol for hash key
50
+ # Check to see if the attribute exists and convert string to symbol for hash key.
49
51
  attributes = attributes.each_with_object({}) { |(k, v), h|
50
52
  if (!self.class.attribute_map.key?(k.to_sym))
51
53
  fail ArgumentError, "`#{k}` is not a valid attribute in `FinancingPaymentMethodSpecificOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
@@ -60,32 +62,37 @@ module PCPServerSDK
60
62
  if attributes.key?(:'payment_product3391_specific_output')
61
63
  self.payment_product3391_specific_output = attributes[:'payment_product3391_specific_output']
62
64
  end
65
+
66
+ if attributes.key?(:'payment_instructions')
67
+ self.payment_instructions = attributes[:'payment_instructions']
68
+ end
63
69
  end
64
70
 
65
71
  # Checks equality by comparing each attribute.
66
- # @param [Object] Object to be compared
72
+ # @param [Object] Object to be compared.
67
73
  def ==(o)
68
74
  return true if self.equal?(o)
69
75
  self.class == o.class &&
70
- payment_product_id == o.payment_product_id &&
71
- payment_product3391_specific_output == o.payment_product3391_specific_output
76
+ payment_product_id == o.payment_product_id &&
77
+ payment_product3391_specific_output == o.payment_product3391_specific_output &&
78
+ payment_instructions == o.payment_instructions
72
79
  end
73
80
 
74
- # @see the `==` method
75
- # @param [Object] Object to be compared
81
+ # @see the `==` method.
82
+ # @param [Object] Object to be compared.
76
83
  def eql?(o)
77
84
  self == o
78
85
  end
79
86
 
80
87
  # Calculates hash code according to all attributes.
81
- # @return [Integer] Hash code
88
+ # @return [Integer] Hash code.
82
89
  def hash
83
- [payment_product_id, payment_product3391_specific_output].hash
90
+ [payment_product_id, payment_product3391_specific_output, payment_instructions].hash
84
91
  end
85
92
 
86
- # Builds the object from hash
87
- # @param [Hash] attributes Model attributes in the form of hash
88
- # @return [Object] Returns the model itself
93
+ # Builds the object from hash.
94
+ # @param [Hash] attributes Model attributes in the form of hash.
95
+ # @return [Object] Returns the model itself.
89
96
  def self.build_from_hash(attributes)
90
97
  return nil unless attributes.is_a?(Hash)
91
98
  attributes = attributes.transform_keys(&:to_sym)
@@ -94,8 +101,6 @@ module PCPServerSDK
94
101
  if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
95
102
  transformed_hash["#{key}"] = nil
96
103
  elsif type =~ /\AArray<(.*)>/i
97
- # check to ensure the input is an array given that the attribute
98
- # is documented as an array but the input is not
99
104
  if attributes[attribute_map[key]].is_a?(Array)
100
105
  transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
101
106
  end
@@ -106,10 +111,10 @@ module PCPServerSDK
106
111
  new(transformed_hash)
107
112
  end
108
113
 
109
- # Deserializes the data based on type
110
- # @param string type Data type
111
- # @param string value Value to be deserialized
112
- # @return [Object] Deserialized data
114
+ # Deserializes the data based on type.
115
+ # @param string type Data type.
116
+ # @param string value Value to be deserialized.
117
+ # @return [Object] Deserialized data.
113
118
  def self._deserialize(type, value)
114
119
  case type.to_sym
115
120
  when :Time
@@ -129,7 +134,6 @@ module PCPServerSDK
129
134
  false
130
135
  end
131
136
  when :Object
132
- # generic object (usually a Hash), return directly
133
137
  value
134
138
  when /\AArray<(?<inner_type>.+)>\z/
135
139
  inner_type = Regexp.last_match[:inner_type]
@@ -143,26 +147,25 @@ module PCPServerSDK
143
147
  end
144
148
  end
145
149
  else # model
146
- # models (e.g. Pet) or oneOf
147
150
  klass = PCPServerSDK::Models.const_get(type)
148
151
  klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
149
152
  end
150
153
  end
151
154
 
152
- # Returns the string representation of the object
153
- # @return [String] String presentation of the object
155
+ # Returns the string representation of the object.
156
+ # @return [String] String presentation of the object.
154
157
  def to_s
155
158
  to_hash.to_s
156
159
  end
157
160
 
158
- # to_body is an alias to to_hash (backward compatibility)
159
- # @return [Hash] Returns the object in the form of hash
161
+ # to_body is an alias to to_hash (backward compatibility).
162
+ # @return [Hash] Returns the object in the form of hash.
160
163
  def to_body
161
164
  to_hash
162
165
  end
163
166
 
164
- # Returns the object in the form of hash
165
- # @return [Hash] Returns the object in the form of hash
167
+ # Returns the object in the form of hash.
168
+ # @return [Hash] Returns the object in the form of hash.
166
169
  def to_hash
167
170
  hash = {}
168
171
  self.class.attribute_map.each_pair do |attr, param|
@@ -177,10 +180,10 @@ module PCPServerSDK
177
180
  hash
178
181
  end
179
182
 
180
- # Outputs non-array value in the form of hash
181
- # For object, use to_hash. Otherwise, just return the value
182
- # @param [Object] value Any valid value
183
- # @return [Hash] Returns the value in the form of hash
183
+ # Outputs non-array value in the form of hash.
184
+ # For object, use to_hash. Otherwise, just return the value.
185
+ # @param [Object] value Any valid value.
186
+ # @return [Hash] Returns the value in the form of hash.
184
187
  def _to_hash(value)
185
188
  if value.is_a?(Array)
186
189
  value.compact.map { |v| _to_hash(v) }
@@ -1,4 +1,3 @@
1
-
2
1
  require 'date'
3
2
  require 'time'
4
3
 
@@ -11,7 +10,9 @@ module PCPServerSDK
11
10
 
12
11
  attr_accessor :authorization_mode
13
12
 
14
- # The payment data if we will do the decryption of the encrypted payment data. Typically you'd use encryptedCustomerInput in the root of the create payment request to provide the encrypted payment data instead.
13
+ # The payment data if we will do the decryption of the encrypted payment data.
14
+ # Typically you'd use encryptedCustomerInput in the root of the create payment request
15
+ # to provide the encrypted payment data instead.
15
16
  attr_accessor :encrypted_payment_data
16
17
 
17
18
  # Public Key Hash A unique identifier to retrieve key used by Apple to encrypt information.
@@ -20,9 +21,10 @@ module PCPServerSDK
20
21
  # Ephemeral Key A unique generated key used by Apple to encrypt data.
21
22
  attr_accessor :ephemeral_key
22
23
 
23
- attr_accessor :payment_product302_specific_input
24
-
24
+ # 3D Secure authentication data
25
+ attr_accessor :three_d_secure
25
26
 
27
+ attr_accessor :payment_product302_specific_input
26
28
 
27
29
  class EnumAttributeValidator
28
30
  attr_reader :datatype
@@ -54,6 +56,7 @@ module PCPServerSDK
54
56
  :'encrypted_payment_data' => :'encryptedPaymentData',
55
57
  :'public_key_hash' => :'publicKeyHash',
56
58
  :'ephemeral_key' => :'ephemeralKey',
59
+ :'three_d_secure' => :'threeDSecure',
57
60
  :'payment_product302_specific_input' => :'paymentProduct302SpecificInput'
58
61
  }
59
62
  end
@@ -71,7 +74,8 @@ module PCPServerSDK
71
74
  :'encrypted_payment_data' => :'String',
72
75
  :'public_key_hash' => :'String',
73
76
  :'ephemeral_key' => :'String',
74
- :'payment_product302_specific_input' => :'PaymentProduct320SpecificInput'
77
+ :'three_d_secure' => :'MobilePaymentThreeDSecure',
78
+ :'payment_product302_specific_input' => :'PaymentProduct302SpecificInput'
75
79
  }
76
80
  end
77
81
 
@@ -88,7 +92,6 @@ module PCPServerSDK
88
92
  fail ArgumentError, "The input argument (attributes) must be a hash in `MobilePaymentMethodSpecificInput` initialize method"
89
93
  end
90
94
 
91
- # check to see if the attribute exists and convert string to symbol for hash key
92
95
  attributes = attributes.each_with_object({}) { |(k, v), h|
93
96
  if (!self.class.attribute_map.key?(k.to_sym))
94
97
  fail ArgumentError, "`#{k}` is not a valid attribute in `MobilePaymentMethodSpecificInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
@@ -116,6 +119,10 @@ module PCPServerSDK
116
119
  self.ephemeral_key = attributes[:'ephemeral_key']
117
120
  end
118
121
 
122
+ if attributes.key?(:'three_d_secure')
123
+ self.three_d_secure = attributes[:'three_d_secure']
124
+ end
125
+
119
126
  if attributes.key?(:'payment_product302_specific_input')
120
127
  self.payment_product302_specific_input = attributes[:'payment_product302_specific_input']
121
128
  end
@@ -131,24 +138,18 @@ module PCPServerSDK
131
138
  encrypted_payment_data == o.encrypted_payment_data &&
132
139
  public_key_hash == o.public_key_hash &&
133
140
  ephemeral_key == o.ephemeral_key &&
141
+ three_d_secure == o.three_d_secure &&
134
142
  payment_product302_specific_input == o.payment_product302_specific_input
135
143
  end
136
144
 
137
- # @see the `==` method
138
- # @param [Object] Object to be compared
139
145
  def eql?(o)
140
146
  self == o
141
147
  end
142
148
 
143
- # Calculates hash code according to all attributes.
144
- # @return [Integer] Hash code
145
149
  def hash
146
- [payment_product_id, authorization_mode, encrypted_payment_data, public_key_hash, ephemeral_key, payment_product302_specific_input].hash
150
+ [payment_product_id, authorization_mode, encrypted_payment_data, public_key_hash, ephemeral_key, three_d_secure, payment_product302_specific_input].hash
147
151
  end
148
152
 
149
- # Builds the object from hash
150
- # @param [Hash] attributes Model attributes in the form of hash
151
- # @return [Object] Returns the model itself
152
153
  def self.build_from_hash(attributes)
153
154
  return nil unless attributes.is_a?(Hash)
154
155
  attributes = attributes.transform_keys(&:to_sym)
@@ -157,8 +158,6 @@ module PCPServerSDK
157
158
  if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
159
  transformed_hash["#{key}"] = nil
159
160
  elsif type =~ /\AArray<(.*)>/i
160
- # check to ensure the input is an array given that the attribute
161
- # is documented as an array but the input is not
162
161
  if attributes[attribute_map[key]].is_a?(Array)
163
162
  transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
163
  end
@@ -169,10 +168,6 @@ module PCPServerSDK
169
168
  new(transformed_hash)
170
169
  end
171
170
 
172
- # Deserializes the data based on type
173
- # @param string type Data type
174
- # @param string value Value to be deserialized
175
- # @return [Object] Deserialized data
176
171
  def self._deserialize(type, value)
177
172
  case type.to_sym
178
173
  when :Time
@@ -192,7 +187,6 @@ module PCPServerSDK
192
187
  false
193
188
  end
194
189
  when :Object
195
- # generic object (usually a Hash), return directly
196
190
  value
197
191
  when /\AArray<(?<inner_type>.+)>\z/
198
192
  inner_type = Regexp.last_match[:inner_type]
@@ -205,27 +199,20 @@ module PCPServerSDK
205
199
  hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
200
  end
207
201
  end
208
- else # model
209
- # models (e.g. Pet) or oneOf
202
+ else
210
203
  klass = PCPServerSDK::Models.const_get(type)
211
204
  klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
212
205
  end
213
206
  end
214
207
 
215
- # Returns the string representation of the object
216
- # @return [String] String presentation of the object
217
208
  def to_s
218
209
  to_hash.to_s
219
210
  end
220
211
 
221
- # to_body is an alias to to_hash (backward compatibility)
222
- # @return [Hash] Returns the object in the form of hash
223
212
  def to_body
224
213
  to_hash
225
214
  end
226
215
 
227
- # Returns the object in the form of hash
228
- # @return [Hash] Returns the object in the form of hash
229
216
  def to_hash
230
217
  hash = {}
231
218
  self.class.attribute_map.each_pair do |attr, param|
@@ -240,10 +227,6 @@ module PCPServerSDK
240
227
  hash
241
228
  end
242
229
 
243
- # Outputs non-array value in the form of hash
244
- # For object, use to_hash. Otherwise, just return the value
245
- # @param [Object] value Any valid value
246
- # @return [Hash] Returns the value in the form of hash
247
230
  def _to_hash(value)
248
231
  if value.is_a?(Array)
249
232
  value.compact.map { |v| _to_hash(v) }
@@ -0,0 +1,185 @@
1
+ require 'date'
2
+ require 'time'
3
+
4
+ # Object containing specific data regarding 3-D Secure for card digital wallets.
5
+ # Necessary to perform 3D Secure when there is no liability shift from
6
+ # the wallet and corresponding card network.
7
+ module PCPServerSDK
8
+ module Models
9
+ class MobilePaymentThreeDSecure
10
+ # Redirection data required for 3D Secure authentication.
11
+ attr_accessor :redirection_data
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :'redirection_data' => :'redirectionData'
17
+ }
18
+ end
19
+
20
+ # Returns all the JSON keys this model knows about
21
+ def self.acceptable_attributes
22
+ attribute_map.values
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'redirection_data' => :'RedirectionData'
29
+ }
30
+ end
31
+
32
+ # List of attributes with nullable: true
33
+ def self.openapi_nullable
34
+ Set.new([])
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ if (!attributes.is_a?(Hash))
41
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MobilePaymentThreeDSecure` initialize method"
42
+ end
43
+
44
+ attributes = attributes.each_with_object({}) { |(k, v), h|
45
+ if (!self.class.attribute_map.key?(k.to_sym))
46
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MobilePaymentThreeDSecure`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
47
+ end
48
+ h[k.to_sym] = v
49
+ }
50
+
51
+ if attributes.key?(:'redirection_data')
52
+ self.redirection_data = attributes[:'redirection_data']
53
+ end
54
+ end
55
+
56
+ # Checks equality by comparing each attribute.
57
+ # @param [Object] Object to be compared
58
+ def ==(o)
59
+ return true if self.equal?(o)
60
+ self.class == o.class &&
61
+ redirection_data == o.redirection_data
62
+ end
63
+
64
+ # @see the `==` method
65
+ # @param [Object] Object to be compared
66
+ def eql?(o)
67
+ self == o
68
+ end
69
+
70
+ # Calculates hash code according to all attributes.
71
+ # @return [Integer] Hash code
72
+ def hash
73
+ [redirection_data].hash
74
+ end
75
+
76
+ # Builds the object from hash
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ # @return [Object] Returns the model itself
79
+ def self.build_from_hash(attributes)
80
+ return nil unless attributes.is_a?(Hash)
81
+ attributes = attributes.transform_keys(&:to_sym)
82
+ transformed_hash = {}
83
+ openapi_types.each_pair do |key, type|
84
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
85
+ transformed_hash["#{key}"] = nil
86
+ elsif type =~ /\AArray<(.*)>/i
87
+ if attributes[attribute_map[key]].is_a?(Array)
88
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
89
+ end
90
+ elsif !attributes[attribute_map[key]].nil?
91
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
92
+ end
93
+ end
94
+ new(transformed_hash)
95
+ end
96
+
97
+ # Deserializes the data based on type
98
+ # @param string type Data type
99
+ # @param string value Value to be deserialized
100
+ # @return [Object] Deserialized data
101
+ def self._deserialize(type, value)
102
+ case type.to_sym
103
+ when :Time
104
+ Time.parse(value)
105
+ when :Date
106
+ Date.parse(value)
107
+ when :String
108
+ value.to_s
109
+ when :Integer
110
+ value.to_i
111
+ when :Float
112
+ value.to_f
113
+ when :Boolean
114
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
115
+ true
116
+ else
117
+ false
118
+ end
119
+ when :Object
120
+ value
121
+ when /\AArray<(?<inner_type>.+)>\z/
122
+ inner_type = Regexp.last_match[:inner_type]
123
+ value.map { |v| _deserialize(inner_type, v) }
124
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
125
+ k_type = Regexp.last_match[:k_type]
126
+ v_type = Regexp.last_match[:v_type]
127
+ {}.tap do |hash|
128
+ value.each do |k, v|
129
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
130
+ end
131
+ end
132
+ else
133
+ klass = PCPServerSDK::Models.const_get(type)
134
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
135
+ end
136
+ end
137
+
138
+ # Returns the string representation of the object
139
+ # @return [String] String presentation of the object
140
+ def to_s
141
+ to_hash.to_s
142
+ end
143
+
144
+ # to_body is an alias to to_hash (backward compatibility)
145
+ # @return [Hash] Returns the object in the form of hash
146
+ def to_body
147
+ to_hash
148
+ end
149
+
150
+ # Returns the object in the form of hash
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_hash
153
+ hash = {}
154
+ self.class.attribute_map.each_pair do |attr, param|
155
+ value = self.send(attr)
156
+ if value.nil?
157
+ is_nullable = self.class.openapi_nullable.include?(attr)
158
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
159
+ end
160
+
161
+ hash[param] = _to_hash(value)
162
+ end
163
+ hash
164
+ end
165
+
166
+ # Outputs non-array value in the form of hash
167
+ # For object, use to_hash. Otherwise, just return the value
168
+ # @param [Object] value Any valid value
169
+ # @return [Hash] Returns the value in the form of hash
170
+ def _to_hash(value)
171
+ if value.is_a?(Array)
172
+ value.compact.map { |v| _to_hash(v) }
173
+ elsif value.is_a?(Hash)
174
+ {}.tap do |hash|
175
+ value.each { |k, v| hash[k] = _to_hash(v) }
176
+ end
177
+ elsif value.respond_to? :to_hash
178
+ value.to_hash
179
+ else
180
+ value
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
@@ -1,4 +1,3 @@
1
-
2
1
  require 'date'
3
2
  require 'time'
4
3
 
@@ -20,6 +19,9 @@ module PCPServerSDK
20
19
  # Tax on the line item, with the last two digits implied as decimal places
21
20
  attr_accessor :tax_amount
22
21
 
22
+ # If this is set to true, `tax_amount` will be interpreted as the tax amount per unit as opposed to the tax amount per line item.
23
+ attr_accessor :tax_amount_per_unit
24
+
23
25
  # URL of the product in shop. Used for PAYONE Buy Now, Pay Later (BNPL).
24
26
  attr_accessor :product_url
25
27
 
@@ -32,8 +34,6 @@ module PCPServerSDK
32
34
  # Optional parameter to define the delivery shop or touchpoint where an item has been collected (e.g. for Click & Collect or Click & Reserve).
33
35
  attr_accessor :merchant_shop_delivery_reference
34
36
 
35
-
36
-
37
37
  class EnumAttributeValidator
38
38
  attr_reader :datatype
39
39
  attr_reader :allowable_values
@@ -64,6 +64,7 @@ module PCPServerSDK
64
64
  :'product_type' => :'productType',
65
65
  :'quantity' => :'quantity',
66
66
  :'tax_amount' => :'taxAmount',
67
+ :'tax_amount_per_unit' => :'taxAmountPerUnit',
67
68
  :'product_url' => :'productUrl',
68
69
  :'product_image_url' => :'productImageUrl',
69
70
  :'product_category_path' => :'productCategoryPath',
@@ -84,6 +85,7 @@ module PCPServerSDK
84
85
  :'product_type' => :'ProductType',
85
86
  :'quantity' => :'Integer',
86
87
  :'tax_amount' => :'Integer',
88
+ :'tax_amount_per_unit' => :'Boolean',
87
89
  :'product_url' => :'String',
88
90
  :'product_image_url' => :'String',
89
91
  :'product_category_path' => :'String',
@@ -93,12 +95,10 @@ module PCPServerSDK
93
95
 
94
96
  # List of attributes with nullable: true
95
97
  def self.openapi_nullable
96
- Set.new([
97
- ])
98
+ Set.new([])
98
99
  end
99
100
 
100
101
  # Initializes the object
101
- # @param [Hash] attributes Model attributes in the form of hash
102
102
  def initialize(attributes = {})
103
103
  if (!attributes.is_a?(Hash))
104
104
  fail ArgumentError, "The input argument (attributes) must be a hash in `OrderLineDetailsInput` initialize method"
@@ -136,6 +136,12 @@ module PCPServerSDK
136
136
  self.tax_amount = attributes[:'tax_amount']
137
137
  end
138
138
 
139
+ if attributes.key?(:'tax_amount_per_unit')
140
+ self.tax_amount_per_unit = attributes[:'tax_amount_per_unit']
141
+ else
142
+ self.tax_amount_per_unit = false
143
+ end
144
+
139
145
  if attributes.key?(:'product_url')
140
146
  self.product_url = attributes[:'product_url']
141
147
  end