pcp-server-ruby-sdk 1.7.0 → 1.9.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/api-definition.yaml +685 -667
- data/lib/PCP-server-Ruby-SDK/endpoints/checkout_api_client.rb +3 -1
- data/lib/PCP-server-Ruby-SDK/endpoints/commerce_case_api_client.rb +5 -4
- data/lib/PCP-server-Ruby-SDK/endpoints/order_management_checkout_actions_api_client.rb +25 -0
- data/lib/PCP-server-Ruby-SDK/models/cancel_payment_request.rb +8 -0
- data/lib/PCP-server-Ruby-SDK/models/cart_item_supplier_references.rb +2 -0
- data/lib/PCP-server-Ruby-SDK/models/commerce_cases_response.rb +18 -0
- data/lib/PCP-server-Ruby-SDK/models/complete_order_request.rb +187 -0
- data/lib/PCP-server-Ruby-SDK/models/order_line_details_input.rb +2 -1
- data/lib/PCP-server-Ruby-SDK/models/order_line_details_patch.rb +11 -1
- data/lib/PCP-server-Ruby-SDK/models/order_line_details_result.rb +11 -1
- data/lib/PCP-server-Ruby-SDK/models/payment_event.rb +34 -4
- data/lib/PCP-server-Ruby-SDK/models/payment_references_for_refund.rb +198 -0
- data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input.rb +4 -14
- data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output.rb +4 -14
- data/lib/PCP-server-Ruby-SDK/models/refund_request.rb +1 -1
- data/lib/PCP-server-Ruby-SDK/models/required_field_validation.rb +108 -0
- data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
- data/lib/PCP-server-Ruby-SDK.rb +6 -0
- data/package-lock.json +16 -2
- data/package.json +1 -1
- data/spec/endpoints/checkout_api_client_spec.rb +22 -0
- data/spec/endpoints/order_management_checkout_actions_api_client_spec.rb +51 -0
- data/spec/models/required_field_validation_spec.rb +551 -0
- metadata +14 -8
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require_relative '../../lib/PCP-server-Ruby-SDK.rb'
|
|
3
|
+
|
|
4
|
+
RSpec.describe 'required field validation' do
|
|
5
|
+
describe PCPServerSDK::Models::AmountOfMoney do
|
|
6
|
+
it 'rejects missing required fields during initialization' do
|
|
7
|
+
expect do
|
|
8
|
+
described_class.new(currency_code: 'EUR')
|
|
9
|
+
end.to raise_error(ArgumentError, 'amount cannot be nil')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'allows empty initialization until the object is serialized' do
|
|
13
|
+
amount = described_class.new({})
|
|
14
|
+
|
|
15
|
+
expect do
|
|
16
|
+
amount.to_hash
|
|
17
|
+
end.to raise_error(ArgumentError, 'amount cannot be nil')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'rejects missing required fields during deserialization' do
|
|
21
|
+
expect do
|
|
22
|
+
described_class.build_from_hash({ 'currencyCode' => 'EUR' })
|
|
23
|
+
end.to raise_error(ArgumentError, 'amount cannot be nil')
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe PCPServerSDK::Models::CartItemSupplierReferences do
|
|
28
|
+
it 'allows empty initialization until the object is serialized' do
|
|
29
|
+
supplier_references = described_class.new({})
|
|
30
|
+
|
|
31
|
+
expect do
|
|
32
|
+
supplier_references.to_hash
|
|
33
|
+
end.to raise_error(ArgumentError, 'supplier_id cannot be nil')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'rejects partially initialized models missing required fields' do
|
|
37
|
+
expect do
|
|
38
|
+
described_class.new(order_reference: 'order-123')
|
|
39
|
+
end.to raise_error(ArgumentError, 'supplier_id cannot be nil')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'rejects nil assignment after initialization' do
|
|
43
|
+
supplier_references = described_class.new(supplier_id: 'supplier-123')
|
|
44
|
+
|
|
45
|
+
expect do
|
|
46
|
+
supplier_references.supplier_id = nil
|
|
47
|
+
end.to raise_error(ArgumentError, 'supplier_id cannot be nil')
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe PCPServerSDK::Models::RefreshPaymentRequest do
|
|
52
|
+
it 'rejects omitted required fields during serialization even when initialize does not assign nil explicitly' do
|
|
53
|
+
request = described_class.new({})
|
|
54
|
+
|
|
55
|
+
expect do
|
|
56
|
+
request.to_hash
|
|
57
|
+
end.to raise_error(ArgumentError, 'refresh_type cannot be nil')
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe PCPServerSDK::Models::PaymentInformationRequest do
|
|
62
|
+
let(:amount_of_money) { PCPServerSDK::Models::AmountOfMoney.new(amount: 100, currency_code: 'EUR') }
|
|
63
|
+
|
|
64
|
+
it 'accepts omitted optional fields when required fields are present' do
|
|
65
|
+
request = described_class.new(
|
|
66
|
+
amount_of_money: amount_of_money,
|
|
67
|
+
type: PCPServerSDK::Models::PaymentType::SALE,
|
|
68
|
+
payment_channel: PCPServerSDK::Models::PaymentChannel::ECOMMERCE,
|
|
69
|
+
payment_product_id: 840
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
expect(request.merchant_reference).to be_nil
|
|
73
|
+
expect(request.payment_product_id).to eq(840)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe PCPServerSDK::Models::APIError do
|
|
78
|
+
it 'rejects partially initialized models missing required fields' do
|
|
79
|
+
expect do
|
|
80
|
+
described_class.new(message: 'boom')
|
|
81
|
+
end.to raise_error(ArgumentError, 'error_code cannot be nil')
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
85
|
+
error = described_class.new({})
|
|
86
|
+
|
|
87
|
+
expect do
|
|
88
|
+
error.to_hash
|
|
89
|
+
end.to raise_error(ArgumentError, 'error_code cannot be nil')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it 'rejects missing required fields during deserialization' do
|
|
93
|
+
expect do
|
|
94
|
+
described_class.build_from_hash({ 'message' => 'boom' })
|
|
95
|
+
end.to raise_error(ArgumentError, 'error_code cannot be nil')
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'rejects nil assignment after initialization' do
|
|
99
|
+
error = described_class.new(error_code: 'E0001')
|
|
100
|
+
|
|
101
|
+
expect do
|
|
102
|
+
error.error_code = nil
|
|
103
|
+
end.to raise_error(ArgumentError, 'error_code cannot be nil')
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
describe PCPServerSDK::Models::ApplePaymentDataTokenHeaderInformation do
|
|
108
|
+
it 'rejects partially initialized models missing required fields' do
|
|
109
|
+
expect do
|
|
110
|
+
described_class.new(application_data: 'abcd1234')
|
|
111
|
+
end.to raise_error(ArgumentError, 'transaction_id cannot be nil')
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it 'rejects missing required fields during deserialization' do
|
|
115
|
+
expect do
|
|
116
|
+
described_class.build_from_hash({ 'applicationData' => 'abcd1234' })
|
|
117
|
+
end.to raise_error(ArgumentError, 'transaction_id cannot be nil')
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
describe PCPServerSDK::Models::ApplePaymentDataTokenInformation do
|
|
122
|
+
let(:header) do
|
|
123
|
+
PCPServerSDK::Models::ApplePaymentDataTokenHeaderInformation.new(transaction_id: 'tx-123')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it 'rejects partially initialized models missing required fields' do
|
|
127
|
+
expect do
|
|
128
|
+
described_class.new(signature: 'signed-payload', header: header)
|
|
129
|
+
end.to raise_error(ArgumentError, 'version cannot be nil')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'rejects missing nested required fields during deserialization' do
|
|
133
|
+
expect do
|
|
134
|
+
described_class.build_from_hash({
|
|
135
|
+
'version' => 'EC_V1',
|
|
136
|
+
'signature' => 'signed-payload',
|
|
137
|
+
'header' => {}
|
|
138
|
+
})
|
|
139
|
+
end.to raise_error(ArgumentError, 'transaction_id cannot be nil')
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
describe PCPServerSDK::Models::References do
|
|
144
|
+
it 'rejects partially initialized models missing required fields' do
|
|
145
|
+
expect do
|
|
146
|
+
described_class.new(descriptor: 'descriptor')
|
|
147
|
+
end.to raise_error(ArgumentError, 'merchant_reference cannot be nil')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it 'rejects missing required fields during deserialization' do
|
|
151
|
+
expect do
|
|
152
|
+
described_class.build_from_hash({ 'descriptor' => 'descriptor' })
|
|
153
|
+
end.to raise_error(ArgumentError, 'merchant_reference cannot be nil')
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
describe PCPServerSDK::Models::Order do
|
|
158
|
+
let(:references) { PCPServerSDK::Models::References.new(merchant_reference: 'ref-123') }
|
|
159
|
+
|
|
160
|
+
it 'rejects missing required nested objects during serialization after empty initialization' do
|
|
161
|
+
order = described_class.new({})
|
|
162
|
+
|
|
163
|
+
expect do
|
|
164
|
+
order.to_hash
|
|
165
|
+
end.to raise_error(ArgumentError, 'references cannot be nil')
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
it 'rejects partially initialized models missing required nested objects' do
|
|
169
|
+
expect do
|
|
170
|
+
described_class.new(amount_of_money: PCPServerSDK::Models::AmountOfMoney.new(amount: 100, currency_code: 'EUR'))
|
|
171
|
+
end.to raise_error(ArgumentError, 'references cannot be nil')
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
it 'rejects nil assignment for required nested objects after initialization' do
|
|
175
|
+
order = described_class.new(references: references)
|
|
176
|
+
|
|
177
|
+
expect do
|
|
178
|
+
order.references = nil
|
|
179
|
+
end.to raise_error(ArgumentError, 'references cannot be nil')
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
describe PCPServerSDK::Models::OrderItem do
|
|
184
|
+
it 'rejects partially initialized item models missing required fields' do
|
|
185
|
+
expect do
|
|
186
|
+
described_class.new(quantity: 2)
|
|
187
|
+
end.to raise_error(ArgumentError, 'id cannot be nil')
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
it 'rejects missing required item fields during deserialization' do
|
|
191
|
+
expect do
|
|
192
|
+
described_class.build_from_hash({ 'quantity' => 2 })
|
|
193
|
+
end.to raise_error(ArgumentError, 'id cannot be nil')
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
describe PCPServerSDK::Models::InstallmentOption do
|
|
198
|
+
it 'rejects partially initialized models with many missing required fields' do
|
|
199
|
+
expect do
|
|
200
|
+
described_class.new(installment_option_id: 'opt-1')
|
|
201
|
+
end.to raise_error(ArgumentError, 'credit_information cannot be nil')
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
205
|
+
installment_option = described_class.new({})
|
|
206
|
+
|
|
207
|
+
expect do
|
|
208
|
+
installment_option.to_hash
|
|
209
|
+
end.to raise_error(ArgumentError, 'credit_information cannot be nil')
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
describe PCPServerSDK::Models::PaymentProduct3391SpecificInput do
|
|
214
|
+
let(:bank_account_information) do
|
|
215
|
+
PCPServerSDK::Models::BankAccountInformation.new(iban: 'DE89370400440532013000', account_holder: 'Jane Doe')
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
it 'rejects partially initialized models missing required nested objects' do
|
|
219
|
+
expect do
|
|
220
|
+
described_class.new(installment_option_id: 'installment-1')
|
|
221
|
+
end.to raise_error(ArgumentError, 'bank_account_information cannot be nil')
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
it 'rejects nested deserialization when required nested fields are missing' do
|
|
225
|
+
expect do
|
|
226
|
+
described_class.build_from_hash({
|
|
227
|
+
'installmentOptionId' => 'installment-1',
|
|
228
|
+
'bankAccountInformation' => { 'iban' => 'DE89370400440532013000' }
|
|
229
|
+
})
|
|
230
|
+
end.to raise_error(ArgumentError, 'account_holder cannot be nil')
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
it 'rejects nil assignment for required nested objects after initialization' do
|
|
234
|
+
input = described_class.new(
|
|
235
|
+
installment_option_id: 'installment-1',
|
|
236
|
+
bank_account_information: bank_account_information
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
expect do
|
|
240
|
+
input.bank_account_information = nil
|
|
241
|
+
end.to raise_error(ArgumentError, 'bank_account_information cannot be nil')
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
describe PCPServerSDK::Models::PositiveAmountOfMoney do
|
|
246
|
+
it 'rejects missing required fields during initialization' do
|
|
247
|
+
expect do
|
|
248
|
+
described_class.new(currency_code: 'EUR')
|
|
249
|
+
end.to raise_error(ArgumentError, 'amount cannot be nil')
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
it 'rejects missing required fields during deserialization' do
|
|
253
|
+
expect do
|
|
254
|
+
described_class.build_from_hash({ 'currencyCode' => 'EUR' })
|
|
255
|
+
end.to raise_error(ArgumentError, 'amount cannot be nil')
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
describe PCPServerSDK::Models::RedirectionData do
|
|
260
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
261
|
+
redirection_data = described_class.new({})
|
|
262
|
+
|
|
263
|
+
expect do
|
|
264
|
+
redirection_data.to_hash
|
|
265
|
+
end.to raise_error(ArgumentError, 'return_url cannot be nil')
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
it 'rejects missing required fields during deserialization' do
|
|
269
|
+
expect do
|
|
270
|
+
described_class.build_from_hash({})
|
|
271
|
+
end.to raise_error(ArgumentError, 'return_url cannot be nil')
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
describe PCPServerSDK::Models::FundDistribution do
|
|
276
|
+
it 'rejects partially initialized models missing the first required field' do
|
|
277
|
+
expect do
|
|
278
|
+
described_class.new(amount: 100, type: 'COMMISSION')
|
|
279
|
+
end.to raise_error(ArgumentError, 'account_id cannot be nil')
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
283
|
+
fund_distribution = described_class.new({})
|
|
284
|
+
|
|
285
|
+
expect do
|
|
286
|
+
fund_distribution.to_hash
|
|
287
|
+
end.to raise_error(ArgumentError, 'account_id cannot be nil')
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
describe PCPServerSDK::Models::Payee do
|
|
292
|
+
it 'rejects partially initialized models missing required fields' do
|
|
293
|
+
expect do
|
|
294
|
+
described_class.new(name: 'Jane Doe')
|
|
295
|
+
end.to raise_error(ArgumentError, 'iban cannot be nil')
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
299
|
+
payee = described_class.new({})
|
|
300
|
+
|
|
301
|
+
expect do
|
|
302
|
+
payee.to_hash
|
|
303
|
+
end.to raise_error(ArgumentError, 'name cannot be nil')
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
it 'rejects missing required fields during deserialization' do
|
|
307
|
+
expect do
|
|
308
|
+
described_class.build_from_hash({ 'name' => 'Jane Doe' })
|
|
309
|
+
end.to raise_error(ArgumentError, 'iban cannot be nil')
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
describe PCPServerSDK::Models::PaymentInstructions do
|
|
314
|
+
let(:payee) { PCPServerSDK::Models::Payee.new(iban: 'DE89370400440532013000', name: 'Jane Doe') }
|
|
315
|
+
|
|
316
|
+
it 'rejects partially initialized models missing required fields' do
|
|
317
|
+
expect do
|
|
318
|
+
described_class.new(payee: payee)
|
|
319
|
+
end.to raise_error(ArgumentError, 'due_date cannot be nil')
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
323
|
+
instructions = described_class.new({})
|
|
324
|
+
|
|
325
|
+
expect do
|
|
326
|
+
instructions.to_hash
|
|
327
|
+
end.to raise_error(ArgumentError, 'payee cannot be nil')
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
it 'rejects missing required fields during deserialization' do
|
|
331
|
+
expect do
|
|
332
|
+
described_class.build_from_hash({
|
|
333
|
+
'payee' => { 'iban' => 'DE89370400440532013000', 'name' => 'Jane Doe' },
|
|
334
|
+
'referenceNumber' => 'REF-123'
|
|
335
|
+
})
|
|
336
|
+
end.to raise_error(ArgumentError, 'due_date cannot be nil')
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
describe PCPServerSDK::Models::ProcessingMandateInformation do
|
|
341
|
+
let(:bank_account_information) do
|
|
342
|
+
PCPServerSDK::Models::BankAccountInformation.new(iban: 'DE89370400440532013000', account_holder: 'Jane Doe')
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
it 'rejects partially initialized models missing required fields' do
|
|
346
|
+
expect do
|
|
347
|
+
described_class.new(bank_account_iban: bank_account_information)
|
|
348
|
+
end.to raise_error(ArgumentError, 'creditor_id cannot be nil')
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
352
|
+
mandate_information = described_class.new({})
|
|
353
|
+
|
|
354
|
+
expect do
|
|
355
|
+
mandate_information.to_hash
|
|
356
|
+
end.to raise_error(ArgumentError, 'bank_account_iban cannot be nil')
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
it 'rejects missing required fields during deserialization' do
|
|
360
|
+
expect do
|
|
361
|
+
described_class.build_from_hash({
|
|
362
|
+
'bankAccountIban' => { 'iban' => 'DE89370400440532013000', 'accountHolder' => 'Jane Doe' },
|
|
363
|
+
'dateOfSignature' => '20260424',
|
|
364
|
+
'creditorId' => 'DE98ZZZ09999999999',
|
|
365
|
+
'uniqueMandateReference' => 'MANDATE-123'
|
|
366
|
+
})
|
|
367
|
+
end.to raise_error(ArgumentError, 'recurrence_type cannot be nil')
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
describe PCPServerSDK::Models::PaymentInformationRefundRequest do
|
|
372
|
+
let(:amount_of_money) { PCPServerSDK::Models::PositiveAmountOfMoney.new(amount: 100, currency_code: 'EUR') }
|
|
373
|
+
|
|
374
|
+
it 'rejects partially initialized models missing required fields' do
|
|
375
|
+
expect do
|
|
376
|
+
described_class.new(account_holder: 'Jane Doe')
|
|
377
|
+
end.to raise_error(ArgumentError, 'amount_of_money cannot be nil')
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
381
|
+
refund_request = described_class.new({})
|
|
382
|
+
|
|
383
|
+
expect do
|
|
384
|
+
refund_request.to_hash
|
|
385
|
+
end.to raise_error(ArgumentError, 'amount_of_money cannot be nil')
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
it 'allows optional fields when the required amount is present' do
|
|
389
|
+
refund_request = described_class.new(amount_of_money: amount_of_money)
|
|
390
|
+
|
|
391
|
+
expect(refund_request.references).to be_nil
|
|
392
|
+
expect(refund_request.account_holder).to be_nil
|
|
393
|
+
end
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
describe PCPServerSDK::Models::PaymentExecutionSpecificInput do
|
|
397
|
+
let(:payment_references) { PCPServerSDK::Models::References.new(merchant_reference: 'payment-ref-123') }
|
|
398
|
+
|
|
399
|
+
it 'rejects partially initialized models missing required fields' do
|
|
400
|
+
expect do
|
|
401
|
+
described_class.new(amount_of_money: PCPServerSDK::Models::AmountOfMoney.new(amount: 100, currency_code: 'EUR'))
|
|
402
|
+
end.to raise_error(ArgumentError, 'payment_references cannot be nil')
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
406
|
+
specific_input = described_class.new({})
|
|
407
|
+
|
|
408
|
+
expect do
|
|
409
|
+
specific_input.to_hash
|
|
410
|
+
end.to raise_error(ArgumentError, 'payment_references cannot be nil')
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
it 'rejects missing required fields during deserialization' do
|
|
414
|
+
expect do
|
|
415
|
+
described_class.build_from_hash({
|
|
416
|
+
'amountOfMoney' => { 'amount' => 100, 'currencyCode' => 'EUR' }
|
|
417
|
+
})
|
|
418
|
+
end.to raise_error(ArgumentError, 'payment_references cannot be nil')
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
it 'rejects nil assignment after initialization' do
|
|
422
|
+
specific_input = described_class.new(payment_references: payment_references)
|
|
423
|
+
|
|
424
|
+
expect do
|
|
425
|
+
specific_input.payment_references = nil
|
|
426
|
+
end.to raise_error(ArgumentError, 'payment_references cannot be nil')
|
|
427
|
+
end
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
describe PCPServerSDK::Models::CreateCheckoutRequest do
|
|
431
|
+
it 'keeps optional defaults intact' do
|
|
432
|
+
request = described_class.new({})
|
|
433
|
+
|
|
434
|
+
expect(request.auto_execute_order).to be(false)
|
|
435
|
+
end
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
describe PCPServerSDK::Models::CompletePaymentProduct840SpecificInput do
|
|
439
|
+
it 'preserves existing enum validation for non-nil values' do
|
|
440
|
+
expect do
|
|
441
|
+
described_class.new(action: 'INVALID_ACTION')
|
|
442
|
+
end.to raise_error(ArgumentError, 'invalid value for "action", must be one of ["CONFIRM_ORDER_STATUS"].')
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
describe PCPServerSDK::Models::CancelItem do
|
|
447
|
+
it 'rejects partially initialized item models missing required fields' do
|
|
448
|
+
expect do
|
|
449
|
+
described_class.new(quantity: 1)
|
|
450
|
+
end.to raise_error(ArgumentError, 'id cannot be nil')
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
it 'rejects missing required item fields during serialization after empty initialization' do
|
|
454
|
+
item = described_class.new({})
|
|
455
|
+
|
|
456
|
+
expect do
|
|
457
|
+
item.to_hash
|
|
458
|
+
end.to raise_error(ArgumentError, 'id cannot be nil')
|
|
459
|
+
end
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
describe PCPServerSDK::Models::DeliverItem do
|
|
463
|
+
it 'rejects partially initialized item models missing required fields' do
|
|
464
|
+
expect do
|
|
465
|
+
described_class.new(quantity: 1)
|
|
466
|
+
end.to raise_error(ArgumentError, 'id cannot be nil')
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
it 'rejects missing required item fields during deserialization' do
|
|
470
|
+
expect do
|
|
471
|
+
described_class.build_from_hash({ 'quantity' => 1 })
|
|
472
|
+
end.to raise_error(ArgumentError, 'id cannot be nil')
|
|
473
|
+
end
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
describe PCPServerSDK::Models::LinkInformation do
|
|
477
|
+
it 'rejects partially initialized models missing required fields' do
|
|
478
|
+
expect do
|
|
479
|
+
described_class.new(type: 'application/json')
|
|
480
|
+
end.to raise_error(ArgumentError, 'href cannot be nil')
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
it 'rejects missing required fields during serialization after empty initialization' do
|
|
484
|
+
link_information = described_class.new({})
|
|
485
|
+
|
|
486
|
+
expect do
|
|
487
|
+
link_information.to_hash
|
|
488
|
+
end.to raise_error(ArgumentError, 'href cannot be nil')
|
|
489
|
+
end
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
describe PCPServerSDK::Models::OrderLineDetailsInput do
|
|
493
|
+
it 'rejects partially initialized models missing required fields' do
|
|
494
|
+
expect do
|
|
495
|
+
described_class.new(quantity: 1)
|
|
496
|
+
end.to raise_error(ArgumentError, 'product_price cannot be nil')
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
it 'keeps optional defaults intact when required fields are present' do
|
|
500
|
+
line_details = described_class.new(product_price: 480, quantity: 1)
|
|
501
|
+
|
|
502
|
+
expect(line_details.tax_amount_per_unit).to be(false)
|
|
503
|
+
expect(line_details.product_code).to be_nil
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
describe PCPServerSDK::Models::PaymentProduct3392SpecificInput do
|
|
508
|
+
let(:bank_account_information) do
|
|
509
|
+
PCPServerSDK::Models::BankAccountInformation.new(iban: 'DE89370400440532013000', account_holder: 'Jane Doe')
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
it 'rejects missing required nested objects during serialization after empty initialization' do
|
|
513
|
+
input = described_class.new({})
|
|
514
|
+
|
|
515
|
+
expect do
|
|
516
|
+
input.to_hash
|
|
517
|
+
end.to raise_error(ArgumentError, 'bank_account_information cannot be nil')
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
it 'rejects nil assignment for required nested objects after initialization' do
|
|
521
|
+
input = described_class.new(bank_account_information: bank_account_information)
|
|
522
|
+
|
|
523
|
+
expect do
|
|
524
|
+
input.bank_account_information = nil
|
|
525
|
+
end.to raise_error(ArgumentError, 'bank_account_information cannot be nil')
|
|
526
|
+
end
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
describe PCPServerSDK::Models::ReturnItem do
|
|
530
|
+
it 'rejects partially initialized item models missing required fields' do
|
|
531
|
+
expect do
|
|
532
|
+
described_class.new(quantity: 1)
|
|
533
|
+
end.to raise_error(ArgumentError, 'id cannot be nil')
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
it 'rejects missing required item fields during deserialization' do
|
|
537
|
+
expect do
|
|
538
|
+
described_class.build_from_hash({ 'quantity' => 1 })
|
|
539
|
+
end.to raise_error(ArgumentError, 'id cannot be nil')
|
|
540
|
+
end
|
|
541
|
+
end
|
|
542
|
+
|
|
543
|
+
describe PCPServerSDK::Models::CommerceCasesResponse do
|
|
544
|
+
it 'keeps array wrapper behavior unchanged' do
|
|
545
|
+
response = described_class.build_from_hash([])
|
|
546
|
+
|
|
547
|
+
expect(response).to be_a(described_class)
|
|
548
|
+
expect(response).to be_empty
|
|
549
|
+
end
|
|
550
|
+
end
|
|
551
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pcp-server-ruby-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- PAYONE GmbH
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: net-http
|
|
@@ -161,8 +161,10 @@ files:
|
|
|
161
161
|
- lib/PCP-server-Ruby-SDK/models/checkout_response.rb
|
|
162
162
|
- lib/PCP-server-Ruby-SDK/models/checkouts_response.rb
|
|
163
163
|
- lib/PCP-server-Ruby-SDK/models/commerce_case_response.rb
|
|
164
|
+
- lib/PCP-server-Ruby-SDK/models/commerce_cases_response.rb
|
|
164
165
|
- lib/PCP-server-Ruby-SDK/models/company_information.rb
|
|
165
166
|
- lib/PCP-server-Ruby-SDK/models/complete_financing_payment_method_specific_input.rb
|
|
167
|
+
- lib/PCP-server-Ruby-SDK/models/complete_order_request.rb
|
|
166
168
|
- lib/PCP-server-Ruby-SDK/models/complete_payment_method_specific_input.rb
|
|
167
169
|
- lib/PCP-server-Ruby-SDK/models/complete_payment_product840_specific_input.rb
|
|
168
170
|
- lib/PCP-server-Ruby-SDK/models/complete_payment_request.rb
|
|
@@ -231,6 +233,7 @@ files:
|
|
|
231
233
|
- lib/PCP-server-Ruby-SDK/models/payment_product840_customer_account.rb
|
|
232
234
|
- lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output.rb
|
|
233
235
|
- lib/PCP-server-Ruby-SDK/models/payment_references.rb
|
|
236
|
+
- lib/PCP-server-Ruby-SDK/models/payment_references_for_refund.rb
|
|
234
237
|
- lib/PCP-server-Ruby-SDK/models/payment_response.rb
|
|
235
238
|
- lib/PCP-server-Ruby-SDK/models/payment_status_output.rb
|
|
236
239
|
- lib/PCP-server-Ruby-SDK/models/payment_type.rb
|
|
@@ -254,6 +257,7 @@ files:
|
|
|
254
257
|
- lib/PCP-server-Ruby-SDK/models/refund_output.rb
|
|
255
258
|
- lib/PCP-server-Ruby-SDK/models/refund_payment_response.rb
|
|
256
259
|
- lib/PCP-server-Ruby-SDK/models/refund_request.rb
|
|
260
|
+
- lib/PCP-server-Ruby-SDK/models/required_field_validation.rb
|
|
257
261
|
- lib/PCP-server-Ruby-SDK/models/return_information.rb
|
|
258
262
|
- lib/PCP-server-Ruby-SDK/models/return_item.rb
|
|
259
263
|
- lib/PCP-server-Ruby-SDK/models/return_request.rb
|
|
@@ -296,6 +300,7 @@ files:
|
|
|
296
300
|
- spec/errors/api_error_response_exception_spec.rb
|
|
297
301
|
- spec/errors/api_exception_spec.rb
|
|
298
302
|
- spec/errors/api_response_retrieval_exception_spec.rb
|
|
303
|
+
- spec/models/required_field_validation_spec.rb
|
|
299
304
|
- spec/queries/get_checkouts_query_spec.rb
|
|
300
305
|
- spec/queries/get_commerce_cases_query_spec.rb
|
|
301
306
|
- spec/request_header_generator_spec.rb
|
|
@@ -327,16 +332,17 @@ specification_version: 4
|
|
|
327
332
|
summary: Commerce Platform API Ruby Gem
|
|
328
333
|
test_files:
|
|
329
334
|
- spec/communicator_configuration_spec.rb
|
|
330
|
-
- spec/endpoints/order_management_checkout_actions_api_client_spec.rb
|
|
331
|
-
- spec/endpoints/base_api_client_spec.rb
|
|
332
|
-
- spec/endpoints/payment_information_api_client_spec.rb
|
|
333
335
|
- spec/endpoints/payment_execution_api_client_spec.rb
|
|
334
|
-
- spec/endpoints/commerce_case_api_client_spec.rb
|
|
335
336
|
- spec/endpoints/checkout_api_client_spec.rb
|
|
337
|
+
- spec/endpoints/payment_information_api_client_spec.rb
|
|
338
|
+
- spec/endpoints/commerce_case_api_client_spec.rb
|
|
339
|
+
- spec/endpoints/base_api_client_spec.rb
|
|
340
|
+
- spec/endpoints/order_management_checkout_actions_api_client_spec.rb
|
|
336
341
|
- spec/endpoints/authentication_api_client_spec.rb
|
|
337
|
-
- spec/errors/api_error_response_exception_spec.rb
|
|
338
|
-
- spec/errors/api_response_retrieval_exception_spec.rb
|
|
339
342
|
- spec/errors/api_exception_spec.rb
|
|
343
|
+
- spec/errors/api_response_retrieval_exception_spec.rb
|
|
344
|
+
- spec/errors/api_error_response_exception_spec.rb
|
|
345
|
+
- spec/models/required_field_validation_spec.rb
|
|
340
346
|
- spec/queries/get_checkouts_query_spec.rb
|
|
341
347
|
- spec/queries/get_commerce_cases_query_spec.rb
|
|
342
348
|
- spec/request_header_generator_spec.rb
|