pcp-server-ruby-sdk 1.1.0 → 1.3.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 +24 -0
- data/PCP-server-Ruby-SDK.gemspec +1 -1
- data/README.md +30 -3
- data/api-definition.yaml +70 -4
- data/example-app/commerce_case_api_example.rb +9 -1
- data/example-app/example.rb +2 -1
- data/lib/PCP-server-Ruby-SDK/endpoints/authentication_api_client.rb +29 -0
- data/lib/PCP-server-Ruby-SDK/models/action_type.rb +34 -0
- data/lib/PCP-server-Ruby-SDK/models/api_error.rb +1 -1
- data/lib/PCP-server-Ruby-SDK/models/authentication_token.rb +189 -0
- data/lib/PCP-server-Ruby-SDK/models/avs_result.rb +52 -0
- data/lib/PCP-server-Ruby-SDK/models/business_relation.rb +30 -0
- data/lib/PCP-server-Ruby-SDK/models/card_fraud_results.rb +3 -2
- data/lib/PCP-server-Ruby-SDK/models/card_recurrence_details.rb +5 -2
- data/lib/PCP-server-Ruby-SDK/models/customer.rb +21 -6
- data/lib/PCP-server-Ruby-SDK/models/customer_account.rb +51 -0
- data/lib/PCP-server-Ruby-SDK/models/merchant_action.rb +3 -2
- data/lib/PCP-server-Ruby-SDK/models/order_line_details_input.rb +1 -1
- data/lib/PCP-server-Ruby-SDK/models/recurring_payment_sequence_indicator.rb +30 -0
- data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input.rb +14 -4
- data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
- data/lib/PCP-server-Ruby-SDK.rb +2 -0
- data/package-lock.json +130 -154
- data/package.json +1 -1
- data/spec/endpoints/authentication_api_client_spec.rb +78 -0
- metadata +27 -3
@@ -0,0 +1,78 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'net/http'
|
5
|
+
require 'json'
|
6
|
+
require_relative '../../lib/PCP-server-Ruby-SDK.rb'
|
7
|
+
|
8
|
+
|
9
|
+
RSpec.describe PCPServerSDK::Endpoints::AuthenticationApiClient do
|
10
|
+
let(:config) { double('PCPServerSDK::CommunicatorConfiguration', api_key: '', api_secret: '', host: 'https://api.example.com') }
|
11
|
+
let(:client) { PCPServerSDK::Endpoints::AuthenticationApiClient.new(config) }
|
12
|
+
|
13
|
+
describe '#get_authentication_tokens' do
|
14
|
+
let(:merchant_id) { 'merchant123' }
|
15
|
+
let(:request_id) { 'req-456' }
|
16
|
+
let(:success_response_body) {
|
17
|
+
{
|
18
|
+
token: 'jwt-token',
|
19
|
+
id: 'uuid-123',
|
20
|
+
creationDate: '2025-07-10T12:00:00Z',
|
21
|
+
expirationDate: '2025-07-10T12:10:00Z'
|
22
|
+
}.to_json
|
23
|
+
}
|
24
|
+
let(:error_body) {
|
25
|
+
PCPServerSDK::Models::ErrorResponse.new(
|
26
|
+
error_id: '1',
|
27
|
+
errors: [PCPServerSDK::Models::APIError.new(error_code: '1', message: 'Error 1')]
|
28
|
+
).to_body.to_json
|
29
|
+
}
|
30
|
+
|
31
|
+
context 'when request is successful' do
|
32
|
+
let(:response) { double('Response', body: success_response_body, code: 200) }
|
33
|
+
|
34
|
+
before do
|
35
|
+
allow(client).to receive(:get_response).and_return(response)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'returns an AuthenticationToken' do
|
39
|
+
token = client.get_authentication_tokens(merchant_id, request_id)
|
40
|
+
expect(token).to be_a(PCPServerSDK::Models::AuthenticationToken)
|
41
|
+
expect(token.token).to eq('jwt-token')
|
42
|
+
expect(token.id).to eq('uuid-123')
|
43
|
+
expect(token.creation_date).to be_a(Time)
|
44
|
+
expect(token.expiration_date).to be_a(Time)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'when request is unsuccessful (400)' do
|
49
|
+
let(:response) { double('Response', body: error_body, code: 400) }
|
50
|
+
|
51
|
+
before do
|
52
|
+
allow(client).to receive(:get_response).and_return(response)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'raises an PCPServerSDK::Errors::ApiErrorResponseException' do
|
56
|
+
expect { client.get_authentication_tokens(merchant_id, request_id) }.to raise_error(PCPServerSDK::Errors::ApiErrorResponseException)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'when request is unsuccessful (500)' do
|
61
|
+
let(:response) { double('Response', body: '{}', code: 500) }
|
62
|
+
|
63
|
+
before do
|
64
|
+
allow(client).to receive(:get_response).and_return(response)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'raises an PCPServerSDK::Errors::ApiResponseRetrievalException' do
|
68
|
+
expect { client.get_authentication_tokens(merchant_id, request_id) }.to raise_error(PCPServerSDK::Errors::ApiResponseRetrievalException)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when merchant_id is nil' do
|
73
|
+
it 'raises an ArgumentError' do
|
74
|
+
expect { client.get_authentication_tokens(nil, '2') }.to raise_error(TypeError, 'Merchant ID is required')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
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.3.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: 2025-
|
11
|
+
date: 2025-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-http
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lefthook.yml
|
103
103
|
- lib/PCP-server-Ruby-SDK.rb
|
104
104
|
- lib/PCP-server-Ruby-SDK/communicator_configuration.rb
|
105
|
+
- lib/PCP-server-Ruby-SDK/endpoints/authentication_api_client.rb
|
105
106
|
- lib/PCP-server-Ruby-SDK/endpoints/base_api_client.rb
|
106
107
|
- lib/PCP-server-Ruby-SDK/endpoints/checkout_api_client.rb
|
107
108
|
- lib/PCP-server-Ruby-SDK/endpoints/commerce_case_api_client.rb
|
@@ -111,6 +112,7 @@ files:
|
|
111
112
|
- lib/PCP-server-Ruby-SDK/errors/api_error_response_exception.rb
|
112
113
|
- lib/PCP-server-Ruby-SDK/errors/api_exception.rb
|
113
114
|
- lib/PCP-server-Ruby-SDK/errors/api_response_retrieval_exception.rb
|
115
|
+
- lib/PCP-server-Ruby-SDK/models/action_type.rb
|
114
116
|
- lib/PCP-server-Ruby-SDK/models/address.rb
|
115
117
|
- lib/PCP-server-Ruby-SDK/models/address_personal.rb
|
116
118
|
- lib/PCP-server-Ruby-SDK/models/allowed_payment_actions.rb
|
@@ -126,9 +128,12 @@ files:
|
|
126
128
|
- lib/PCP-server-Ruby-SDK/models/applepay/apple_pay_payment_method.rb
|
127
129
|
- lib/PCP-server-Ruby-SDK/models/applepay/apple_pay_payment_method_type.rb
|
128
130
|
- lib/PCP-server-Ruby-SDK/models/applepay/apple_pay_payment_token.rb
|
131
|
+
- lib/PCP-server-Ruby-SDK/models/authentication_token.rb
|
129
132
|
- lib/PCP-server-Ruby-SDK/models/authorization_mode.rb
|
133
|
+
- lib/PCP-server-Ruby-SDK/models/avs_result.rb
|
130
134
|
- lib/PCP-server-Ruby-SDK/models/bank_account_information.rb
|
131
135
|
- lib/PCP-server-Ruby-SDK/models/bank_payout_method_specific_input.rb
|
136
|
+
- lib/PCP-server-Ruby-SDK/models/business_relation.rb
|
132
137
|
- lib/PCP-server-Ruby-SDK/models/cancel_item.rb
|
133
138
|
- lib/PCP-server-Ruby-SDK/models/cancel_payment_request.rb
|
134
139
|
- lib/PCP-server-Ruby-SDK/models/cancel_payment_response.rb
|
@@ -167,6 +172,7 @@ files:
|
|
167
172
|
- lib/PCP-server-Ruby-SDK/models/create_commerce_case_response.rb
|
168
173
|
- lib/PCP-server-Ruby-SDK/models/create_payment_response.rb
|
169
174
|
- lib/PCP-server-Ruby-SDK/models/customer.rb
|
175
|
+
- lib/PCP-server-Ruby-SDK/models/customer_account.rb
|
170
176
|
- lib/PCP-server-Ruby-SDK/models/customer_device.rb
|
171
177
|
- lib/PCP-server-Ruby-SDK/models/deliver_item.rb
|
172
178
|
- lib/PCP-server-Ruby-SDK/models/deliver_request.rb
|
@@ -229,6 +235,7 @@ files:
|
|
229
235
|
- lib/PCP-server-Ruby-SDK/models/positive_amount_of_money.rb
|
230
236
|
- lib/PCP-server-Ruby-SDK/models/processing_mandate_information.rb
|
231
237
|
- lib/PCP-server-Ruby-SDK/models/product_type.rb
|
238
|
+
- lib/PCP-server-Ruby-SDK/models/recurring_payment_sequence_indicator.rb
|
232
239
|
- lib/PCP-server-Ruby-SDK/models/redirect_data.rb
|
233
240
|
- lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input.rb
|
234
241
|
- lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output.rb
|
@@ -273,6 +280,7 @@ files:
|
|
273
280
|
- scripts.sh
|
274
281
|
- sonar-project.properties
|
275
282
|
- spec/communicator_configuration_spec.rb
|
283
|
+
- spec/endpoints/authentication_api_client_spec.rb
|
276
284
|
- spec/endpoints/checkout_api_client_spec.rb
|
277
285
|
- spec/endpoints/commerce_case_api_client_spec.rb
|
278
286
|
- spec/endpoints/order_management_checkout_actions_api_client_spec.rb
|
@@ -310,4 +318,20 @@ rubygems_version: 3.4.20
|
|
310
318
|
signing_key:
|
311
319
|
specification_version: 4
|
312
320
|
summary: Commerce Platform API Ruby Gem
|
313
|
-
test_files:
|
321
|
+
test_files:
|
322
|
+
- spec/communicator_configuration_spec.rb
|
323
|
+
- spec/endpoints/checkout_api_client_spec.rb
|
324
|
+
- spec/endpoints/authentication_api_client_spec.rb
|
325
|
+
- spec/endpoints/commerce_case_api_client_spec.rb
|
326
|
+
- spec/endpoints/order_management_checkout_actions_api_client_spec.rb
|
327
|
+
- spec/endpoints/payment_execution_api_client_spec.rb
|
328
|
+
- spec/endpoints/payment_information_api_client_spec.rb
|
329
|
+
- spec/errors/api_response_retrieval_exception_spec.rb
|
330
|
+
- spec/errors/api_error_response_exception_spec.rb
|
331
|
+
- spec/errors/api_exception_spec.rb
|
332
|
+
- spec/queries/get_commerce_cases_query_spec.rb
|
333
|
+
- spec/queries/get_checkouts_query_spec.rb
|
334
|
+
- spec/request_header_generator_spec.rb
|
335
|
+
- spec/spec_helper.rb
|
336
|
+
- spec/transformer/apple_pay_transformer_spec.rb
|
337
|
+
- spec/utils/server_meta_info_spec.rb
|