pcp-server-ruby-sdk 1.3.0 → 1.4.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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/README.md +105 -0
  4. data/example-app/example.rb +71 -0
  5. data/lib/PCP-server-Ruby-SDK/communicator_configuration.rb +6 -3
  6. data/lib/PCP-server-Ruby-SDK/endpoints/authentication_api_client.rb +4 -0
  7. data/lib/PCP-server-Ruby-SDK/endpoints/base_api_client.rb +59 -8
  8. data/lib/PCP-server-Ruby-SDK/endpoints/checkout_api_client.rb +2 -2
  9. data/lib/PCP-server-Ruby-SDK/endpoints/commerce_case_api_client.rb +2 -2
  10. data/lib/PCP-server-Ruby-SDK/endpoints/order_management_checkout_actions_api_client.rb +2 -2
  11. data/lib/PCP-server-Ruby-SDK/endpoints/payment_execution_api_client.rb +2 -2
  12. data/lib/PCP-server-Ruby-SDK/endpoints/payment_information_api_client.rb +2 -2
  13. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output.rb +16 -6
  14. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input.rb +30 -6
  15. data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
  16. data/package-lock.json +179 -179
  17. data/package.json +1 -1
  18. data/spec/communicator_configuration_spec.rb +27 -0
  19. data/spec/endpoints/authentication_api_client_spec.rb +1 -1
  20. data/spec/endpoints/base_api_client_spec.rb +222 -0
  21. data/spec/endpoints/checkout_api_client_spec.rb +1 -1
  22. data/spec/endpoints/commerce_case_api_client_spec.rb +1 -1
  23. data/spec/endpoints/order_management_checkout_actions_api_client_spec.rb +1 -1
  24. data/spec/endpoints/payment_execution_api_client_spec.rb +1 -1
  25. data/spec/endpoints/payment_information_api_client_spec.rb +1 -1
  26. data/spec/spec_helper.rb +9 -0
  27. metadata +10 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb0118721663f462f5bc434e7b2df5d76e517f2865d03d666cd32dbce5133fca
4
- data.tar.gz: 37c389d8f6d02e865f4713f93b7d0745c232846acc797e697a1295de7921db43
3
+ metadata.gz: 91bbea2101c1d5ab290390d1915b301b2cf18ca80dbef0fd49f4930513e81ea5
4
+ data.tar.gz: 2963319a0835827e6d9d69aeacb3f3beef0ba62188c92b144788dffaff335a2e
5
5
  SHA512:
6
- metadata.gz: 4f2912be3416517cb213a8d50196879fe2fa60248d011d83d19bced6d1f4b6d20abbf279b59dd68f837dd1d8df0f243431b50c571a2012a2ae940ca264512b07
7
- data.tar.gz: 48c4c4540f71b982ca05b17c7e4d357835eee938b7164e059890a2dc85a906018a720201c5f3840fb0dc86494f25026beba0e7c5fcbb1108d1574f5f1c99c3ff
6
+ metadata.gz: 704252b2436fbc2de0e1d42c5e78df92665644451eda832f1ada9aa6d676abd7f8be832d0c2e1d60ca91bd8cf6fe6b665354a65e72c422dcc6b3a51a43352551
7
+ data.tar.gz: 0ce58ca90c7fb6deacce228ebaddbabcb6b00f3c9d377fc96f365d4792d5f880d9b3bdea8076a4aee890d02407cf0397a5e303de40c4bb914b14a535a6f73b53
data/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ # [1.4.0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v1.3.1...v1.4.0) (2025-09-26)
2
+
3
+ ### Features
4
+
5
+ * feat: add paypal parameters ([854b72d2699f3250ccfec7b09beda3b82c5d22bd](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/854b72d2699f3250ccfec7b09beda3b82c5d22bd))
6
+
7
+ ## [1.3.1](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v0.0.6...v1.3.1) (2025-09-04)
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix: update version script to actually set the version ([9193d60c4e3f3160ef628c8e093573394a802bc4](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/9193d60c4e3f3160ef628c8e093573394a802bc4))
12
+
13
+ ### Documentation
14
+
15
+ * docs: add section about custom http client to readme ([07992f759ba6fe9b435ce37a17eb3aeff537456c](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/07992f759ba6fe9b435ce37a17eb3aeff537456c))
16
+ * docs: clarify comment for category attribute in APIError class ([ccafb6db2bc474bb07a30a1fda7ff6e730a8137d](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/ccafb6db2bc474bb07a30a1fda7ff6e730a8137d))
17
+ * docs: improve comment clarity for tax_amount_per_unit attribute in OrderLineDetailsInput model ([37fcf28f22a1a9ccf93689c21c07f06d2e3249a8](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/37fcf28f22a1a9ccf93689c21c07f06d2e3249a8))
18
+ * docs: update docs ([a4b33ef94dc183847f5be0288c84312c0dd8cfba](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/a4b33ef94dc183847f5be0288c84312c0dd8cfba))
19
+ * docs: update readme ([39af578246533fda6b3bed100a4fbf66371885b7](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/39af578246533fda6b3bed100a4fbf66371885b7))
20
+ * docs: update README with new badge links and API version ([c69507cd4b9da665fb686576c0900570462fc1bf](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/c69507cd4b9da665fb686576c0900570462fc1bf))
21
+
22
+ ### Features
23
+
24
+ * feat: add apple pay transformer and tests ([110182da3735202d0d3ee2b6bde2f57739221d49](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/110182da3735202d0d3ee2b6bde2f57739221d49))
25
+ * feat: add auth client ([c8fd009b11a8ec3416a33ecab949ec2c51406e7e](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/c8fd009b11a8ec3416a33ecab949ec2c51406e7e))
26
+ * feat: add BusinessRelation class and update customer model to use it ([68ab9fc5c41aad7f3f967b75b1ecdd0ac02cba63](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/68ab9fc5c41aad7f3f967b75b1ecdd0ac02cba63))
27
+ * feat: add CustomerAccount class and integrate it into Customer class ([ee1600ec78d66498cc758b4c931f510dd3ffb4c7](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/ee1600ec78d66498cc758b4c931f510dd3ffb4c7))
28
+ * feat: add fraud_net_id attribute to RedirectPaymentProduct840SpecificInput model ([27ec17cce2fb42eb37116790ce2dd106502487c0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/27ec17cce2fb42eb37116790ce2dd106502487c0))
29
+ * feat: add RecurringPaymentSequenceIndicator class and update CardRecurrenceDetails to use it ([e2507f4328a297dc700fa1635029a1599fa58101](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/e2507f4328a297dc700fa1635029a1599fa58101))
30
+ * feat: allow customization of http client ([98df1ad32cfa6956b3710f3b22dd6ad1cd61fa3c](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/98df1ad32cfa6956b3710f3b22dd6ad1cd61fa3c))
31
+ * feat: implement ActionType class and update MerchantAction to use it ([8e259dc45f4e20ea0a10a351a3abdc86926b91f1](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/8e259dc45f4e20ea0a10a351a3abdc86926b91f1))
32
+ * feat: implement api level 1.28.0 ([b26df0bc2da08cd900775c45bd64f5db120ede0a](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/b26df0bc2da08cd900775c45bd64f5db120ede0a))
33
+ * feat: implement AvsResult enum class and update CardFraudResults to use it ([c0a40cc08aa878afaae93851be1619907e7c5e86](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/c0a40cc08aa878afaae93851be1619907e7c5e86))
34
+
1
35
  # [1.3.0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v1.2.0...v1.3.0) (2025-07-10)
2
36
 
3
37
  ### Features
data/README.md CHANGED
@@ -113,6 +113,111 @@ When making a request any client may throw a `PCPServerSDK::Errors::ApiException
113
113
 
114
114
  Network errors are not wrap, you can should handle the standard `IOExeption`.
115
115
 
116
+ ### HTTP Client Customization
117
+
118
+ The SDK allows you to customize the underlying HTTP client used for API requests. This provides flexibility to configure timeouts, SSL settings, proxies, and other HTTP-specific options according to your application's needs.
119
+
120
+ #### Global HTTP Client Configuration
121
+
122
+ You can set a global HTTP client that will be used by all API clients:
123
+
124
+ ```rb
125
+ require 'pcp-server-ruby-sdk'
126
+
127
+ # Option 1: Using a custom Net::HTTP instance
128
+ custom_http = Net::HTTP.new('api.preprod.commerce.payone.com', 443)
129
+ custom_http.use_ssl = true
130
+ custom_http.read_timeout = 30
131
+ custom_http.open_timeout = 10
132
+
133
+ communicator_configuration = PCPServerSDK::CommunicatorConfiguration.new(
134
+ api_key,
135
+ api_secret,
136
+ 'https://api.preprod.commerce.payone.com',
137
+ custom_http
138
+ )
139
+
140
+ # Option 2: Using a factory proc for dynamic client creation
141
+ http_factory = proc do |uri|
142
+ http = Net::HTTP.new(uri.host, uri.port)
143
+ http.use_ssl = uri.scheme == 'https'
144
+ http.read_timeout = 60
145
+ http.open_timeout = 15
146
+ # Add custom headers, proxy settings, etc.
147
+ http
148
+ end
149
+
150
+ communicator_configuration = PCPServerSDK::CommunicatorConfiguration.new(
151
+ api_key,
152
+ api_secret,
153
+ 'https://api.preprod.commerce.payone.com',
154
+ http_factory
155
+ )
156
+
157
+ # Option 3: Set after initialization
158
+ communicator_configuration.http_client = custom_http
159
+ ```
160
+
161
+ #### Client-Specific HTTP Client Configuration
162
+
163
+ You can also set HTTP clients for individual API clients, which will override the global configuration:
164
+
165
+ ```rb
166
+ require 'pcp-server-ruby-sdk'
167
+
168
+ # Create a specific HTTP client for this API client
169
+ commerce_case_http = Net::HTTP.new('api.preprod.commerce.payone.com', 443)
170
+ commerce_case_http.use_ssl = true
171
+ commerce_case_http.read_timeout = 45
172
+
173
+ # Pass it to the API client constructor
174
+ commerce_case_client = PCPServerSDK::Endpoints::CommerceCaseApiClient.new(
175
+ communicator_configuration,
176
+ commerce_case_http
177
+ )
178
+
179
+ # Or set it after initialization
180
+ commerce_case_client.http_client = commerce_case_http
181
+ ```
182
+
183
+ #### Priority Logic
184
+
185
+ The SDK uses the following priority order when determining which HTTP client to use:
186
+
187
+ 1. **Client-specific HTTP client** (set on individual API client instances)
188
+ 2. **Global HTTP client** (set in CommunicatorConfiguration)
189
+ 3. **Default HTTP client** (created automatically by the SDK)
190
+
191
+ #### HTTP Client Factory Pattern
192
+
193
+ For advanced use cases, you can provide a factory (Proc or any callable object) that creates HTTP clients dynamically:
194
+
195
+ ```rb
196
+ # Factory that creates clients with different configurations based on the URI
197
+ adaptive_factory = proc do |uri|
198
+ http = Net::HTTP.new(uri.host, uri.port)
199
+ http.use_ssl = uri.scheme == 'https'
200
+
201
+ # Configure based on environment or URI
202
+ if uri.host.include?('preprod')
203
+ http.read_timeout = 60 # Longer timeout for preprod
204
+ else
205
+ http.read_timeout = 30 # Standard timeout for production
206
+ end
207
+
208
+ http
209
+ end
210
+
211
+ communicator_configuration.http_client = adaptive_factory
212
+ ```
213
+
214
+ This customization allows you to:
215
+ - Configure custom timeouts and connection settings
216
+ - Set up proxy configurations
217
+ - Add custom SSL/TLS settings
218
+ - Implement retry logic or circuit breakers
219
+ - Add request/response logging or monitoring
220
+
116
221
  ### Client Side
117
222
 
118
223
  For most [payment methods](https://docs.payone.com/pcp/commerce-platform-payment-methods) some information from the client is needed, e.g. payment information given by Apple when a payment via ApplePay suceeds. PAYONE provides client side SDKs which helps you interact the third party payment providers. You can find the SDKs under the [PAYONE GitHub organization](https://github.com/PAYONE-GmbH). Either way ensure to never store or even send credit card information to your server. The PAYONE Commerce Platform never needs access to the credit card information. The client side is responsible for safely retrieving a credit card token. This token must be used with this SDK.
@@ -3,6 +3,74 @@
3
3
  require_relative '../lib/PCP-server-Ruby-SDK.rb'
4
4
  require_relative 'commerce_case_api_example'
5
5
 
6
+ def demonstrate_http_client_customization(api_key, api_secret)
7
+ puts "\n=== HTTP Client Customization Examples ==="
8
+
9
+ # Example 1: Global HTTP client with custom timeouts
10
+ puts "\n1. Global HTTP client with custom timeouts:"
11
+ custom_http = Net::HTTP.new('api.preprod.commerce.payone.com', 443)
12
+ custom_http.use_ssl = true
13
+ custom_http.read_timeout = 30
14
+ custom_http.open_timeout = 10
15
+
16
+ config_with_custom_http = PCPServerSDK::CommunicatorConfiguration.new(
17
+ api_key,
18
+ api_secret,
19
+ 'https://api.preprod.commerce.payone.com',
20
+ custom_http
21
+ )
22
+
23
+ puts " - Read timeout: #{config_with_custom_http.http_client.read_timeout}s"
24
+ puts " - Open timeout: #{config_with_custom_http.http_client.open_timeout}s"
25
+
26
+ # Example 2: HTTP client factory with dynamic configuration
27
+ puts "\n2. HTTP client factory with dynamic configuration:"
28
+ http_factory = proc do |uri|
29
+ puts " - Creating HTTP client for: #{uri.host}:#{uri.port}"
30
+ http = Net::HTTP.new(uri.host, uri.port)
31
+ http.use_ssl = uri.scheme == 'https'
32
+ http.read_timeout = 60
33
+ http.open_timeout = 15
34
+ http
35
+ end
36
+
37
+ config_with_factory = PCPServerSDK::CommunicatorConfiguration.new(
38
+ api_key,
39
+ api_secret,
40
+ 'https://api.preprod.commerce.payone.com',
41
+ http_factory
42
+ )
43
+
44
+ puts " - Factory configured for dynamic client creation"
45
+
46
+ # Example 3: Client-specific HTTP client
47
+ puts "\n3. Client-specific HTTP client override:"
48
+ client_specific_http = Net::HTTP.new('api.preprod.commerce.payone.com', 443)
49
+ client_specific_http.use_ssl = true
50
+ client_specific_http.read_timeout = 45
51
+
52
+ commerce_case_client = PCPServerSDK::Endpoints::CommerceCaseApiClient.new(
53
+ config_with_custom_http,
54
+ client_specific_http
55
+ )
56
+
57
+ puts " - Client-specific timeout: #{commerce_case_client.http_client.read_timeout}s"
58
+ puts " - This overrides the global configuration"
59
+
60
+ # Example 4: Setting HTTP client after initialization
61
+ puts "\n4. Setting HTTP client after initialization:"
62
+ auth_client = PCPServerSDK::Endpoints::AuthenticationApiClient.new(config_with_custom_http)
63
+
64
+ post_init_http = Net::HTTP.new('api.preprod.commerce.payone.com', 443)
65
+ post_init_http.use_ssl = true
66
+ post_init_http.read_timeout = 20
67
+
68
+ auth_client.http_client = post_init_http
69
+ puts " - HTTP client set after initialization with #{auth_client.http_client.read_timeout}s timeout"
70
+
71
+ puts "\n=== HTTP Client Customization Examples Complete ==="
72
+ end
73
+
6
74
  def run
7
75
  api_key = ENV['API_KEY']
8
76
  api_secret = ENV['API_SECRET']
@@ -29,6 +97,9 @@ def run
29
97
  # commerce_case_api_client_example.run_get_one
30
98
  # commerce_case_api_client_example.run_update_one
31
99
  commerce_case_api_client_example.run_auth_token_example
100
+
101
+ # Demonstrate HTTP client customization
102
+ demonstrate_http_client_customization(api_key, api_secret)
32
103
  end
33
104
 
34
105
  run
@@ -2,15 +2,18 @@
2
2
  module PCPServerSDK
3
3
  class CommunicatorConfiguration
4
4
  attr_reader :api_key, :api_secret, :host
5
-
5
+ attr_accessor :http_client
6
+
6
7
  # The constructor
7
8
  # @param [String] api_key
8
9
  # @param [String] api_secret
9
10
  # @param [String] host
10
- def initialize(api_key, api_secret, host)
11
+ # @param [Net::HTTP, Proc, nil] http_client Optional HTTP client instance or factory proc
12
+ def initialize(api_key, api_secret, host, http_client = nil)
11
13
  @api_key = api_key
12
14
  @api_secret = api_secret
13
15
  @host = host
16
+ @http_client = http_client
14
17
  end
15
- end
18
+ end
16
19
  end
@@ -9,6 +9,10 @@ module PCPServerSDK
9
9
  module Endpoints
10
10
  # Client for authentication token operations
11
11
  class AuthenticationApiClient < BaseApiClient
12
+ def initialize(config, http_client = nil)
13
+ super(config, http_client)
14
+ end
15
+
12
16
  def get_authentication_tokens(merchant_id, request_id = nil)
13
17
  raise TypeError, MERCHANT_ID_REQUIRED_ERROR if merchant_id.nil? || merchant_id.empty?
14
18
 
@@ -15,11 +15,13 @@ PAYLOAD_REQUIRED_ERROR = 'Payload is required'
15
15
 
16
16
  module PCPServerSDK
17
17
  module Endpoints
18
-
19
18
  class BaseApiClient
20
- def initialize(config)
19
+ attr_accessor :http_client
20
+
21
+ def initialize(config, http_client = nil)
21
22
  @config = config
22
23
  @request_header_generator = RequestHeaderGenerator.new(config)
24
+ @http_client = http_client
23
25
  end
24
26
 
25
27
  protected
@@ -33,13 +35,12 @@ module PCPServerSDK
33
35
  # @param [Hash] request_init
34
36
  def make_api_call(url, request_init)
35
37
  uri = URI.parse(url)
36
- http = Net::HTTP.new(uri.host, uri.port)
37
- http.use_ssl = uri.scheme == 'https'
38
-
38
+ http = get_http_client(uri)
39
+
39
40
  modified_request = @request_header_generator.generate_additional_request_headers(url, request_init || {})
40
-
41
+
41
42
  request = build_http_request(uri, modified_request)
42
- response = get_response(http, request)
43
+ response = get_response(http, request)
43
44
  handle_error(response)
44
45
 
45
46
  JSON.parse(response.body)
@@ -51,12 +52,62 @@ module PCPServerSDK
51
52
 
52
53
  private
53
54
 
55
+ # Get the HTTP client with priority logic:
56
+ # 1. Client-specific http_client (instance variable)
57
+ # 2. Global http_client from configuration
58
+ # 3. Default Net::HTTP client
59
+ # @param [URI] uri
60
+ # @return [Net::HTTP]
61
+ def get_http_client(uri)
62
+ # Priority 1: Client-specific HTTP client
63
+ if @http_client
64
+ return resolve_http_client(@http_client, uri)
65
+ end
66
+
67
+ # Priority 2: Global HTTP client from configuration
68
+ if @config.http_client
69
+ return resolve_http_client(@config.http_client, uri)
70
+ end
71
+
72
+ # Priority 3: Default HTTP client
73
+ create_default_http_client(uri)
74
+ end
75
+
76
+ # Resolve HTTP client from various input types
77
+ # @param [Net::HTTP, Proc, Object] client_or_factory
78
+ # @param [URI] uri
79
+ # @return [Net::HTTP]
80
+ def resolve_http_client(client_or_factory, uri)
81
+ case client_or_factory
82
+ when Net::HTTP
83
+ client_or_factory
84
+ when Proc
85
+ client_or_factory.call(uri)
86
+ else
87
+ # If it responds to call, treat it as a factory
88
+ if client_or_factory.respond_to?(:call)
89
+ client_or_factory.call(uri)
90
+ else
91
+ raise ArgumentError, "HTTP client must be a Net::HTTP instance, Proc, or respond to :call"
92
+ end
93
+ end
94
+ end
95
+
96
+ # Create default HTTP client
97
+ # @param [URI] uri
98
+ # @return [Net::HTTP]
99
+ def create_default_http_client(uri)
100
+ http = Net::HTTP.new(uri.host, uri.port)
101
+ http.use_ssl = uri.scheme == 'https'
102
+ http
103
+ end
104
+
54
105
  # Get the response
55
106
  # @param [Net::HTTP] http
56
107
  # @param [Net::HTTP::Request] request
57
108
  # @return [Net::HTTP::Response]
58
109
  def get_response(http, request)
59
- http.request(request)
110
+ http.request(request)
60
111
  end
61
112
 
62
113
  def handle_error(response)
@@ -11,8 +11,8 @@ module PCPServerSDK
11
11
  module Endpoints
12
12
 
13
13
  class CheckoutApiClient < BaseApiClient
14
- def initialize(config)
15
- super(config)
14
+ def initialize(config, http_client = nil)
15
+ super(config, http_client)
16
16
  end
17
17
 
18
18
  # Create a checkout
@@ -10,8 +10,8 @@ module PCPServerSDK
10
10
  module Endpoints
11
11
 
12
12
  class CommerceCaseApiClient < BaseApiClient
13
- def initialize(config)
14
- super(config)
13
+ def initialize(config, http_client = nil)
14
+ super(config, http_client)
15
15
  end
16
16
 
17
17
  # Create a commerce case
@@ -10,8 +10,8 @@ module PCPServerSDK
10
10
  module Endpoints
11
11
 
12
12
  class OrderManagementCheckoutActionsApiClient < BaseApiClient
13
- def initialize(config)
14
- super(config)
13
+ def initialize(config, http_client = nil)
14
+ super(config, http_client)
15
15
  end
16
16
 
17
17
  # Create an order
@@ -13,8 +13,8 @@ module PCPServerSDK
13
13
  class PaymentExecutionApiClient < BaseApiClient
14
14
  PAYMENT_EXECUTION_ID_REQUIRED_ERROR = 'Payment Execution ID is required'
15
15
 
16
- def initialize(config)
17
- super(config)
16
+ def initialize(config, http_client = nil)
17
+ super(config, http_client)
18
18
  end
19
19
 
20
20
  # Create a payment
@@ -11,8 +11,8 @@ module PCPServerSDK
11
11
  class PaymentInformationApiClient < BaseApiClient
12
12
  PAYMENT_INFORMATION_ID_REQUIRED_ERROR = 'Payment Information ID is required'
13
13
 
14
- def initialize(config)
15
- super(config)
14
+ def initialize(config, http_client = nil)
15
+ super(config, http_client)
16
16
  end
17
17
 
18
18
  # Create a payment information
@@ -12,12 +12,16 @@ module PCPServerSDK
12
12
 
13
13
  attr_accessor :shipping_address
14
14
 
15
+ # PayPal transaction ID
16
+ attr_accessor :pay_pal_transaction_id
17
+
15
18
  # Attribute mapping from ruby-style variable name to JSON key.
16
19
  def self.attribute_map
17
20
  {
18
21
  :'billing_address' => :'billingAddress',
19
22
  :'customer_account' => :'customerAccount',
20
- :'shipping_address' => :'shippingAddress'
23
+ :'shipping_address' => :'shippingAddress',
24
+ :'pay_pal_transaction_id' => :'payPalTransactionId'
21
25
  }
22
26
  end
23
27
 
@@ -31,7 +35,8 @@ module PCPServerSDK
31
35
  {
32
36
  :'billing_address' => :'Address',
33
37
  :'customer_account' => :'PaymentProduct840CustomerAccount',
34
- :'shipping_address' => :'Address'
38
+ :'shipping_address' => :'Address',
39
+ :'pay_pal_transaction_id' => :'String'
35
40
  }
36
41
  end
37
42
 
@@ -67,6 +72,10 @@ module PCPServerSDK
67
72
  if attributes.key?(:'shipping_address')
68
73
  self.shipping_address = attributes[:'shipping_address']
69
74
  end
75
+
76
+ if attributes.key?(:'pay_pal_transaction_id')
77
+ self.pay_pal_transaction_id = attributes[:'pay_pal_transaction_id']
78
+ end
70
79
  end
71
80
 
72
81
  # Checks equality by comparing each attribute.
@@ -74,9 +83,10 @@ module PCPServerSDK
74
83
  def ==(o)
75
84
  return true if self.equal?(o)
76
85
  self.class == o.class &&
77
- billing_address == o.billing_address &&
78
- customer_account == o.customer_account &&
79
- shipping_address == o.shipping_address
86
+ billing_address == o.billing_address &&
87
+ customer_account == o.customer_account &&
88
+ shipping_address == o.shipping_address &&
89
+ pay_pal_transaction_id == o.pay_pal_transaction_id
80
90
  end
81
91
 
82
92
  # @see the `==` method
@@ -88,7 +98,7 @@ module PCPServerSDK
88
98
  # Calculates hash code according to all attributes.
89
99
  # @return [Integer] Hash code
90
100
  def hash
91
- [billing_address, customer_account, shipping_address].hash
101
+ [billing_address, customer_account, shipping_address, pay_pal_transaction_id].hash
92
102
  end
93
103
 
94
104
  # Builds the object from hash
@@ -9,14 +9,26 @@ module PCPServerSDK
9
9
  # Indicates whether to use PayPal Express Checkout Shortcut. * true = When shortcut is enabled, the consumer can select a shipping address during PayPal checkout. * false = When shortcut is disabled, the consumer cannot change the shipping address. Default value is false. Please note that this field is ignored when order.additionalInput.typeInformation.purchaseType is set to \"digital\"
10
10
  attr_accessor :address_selection_at_pay_pal
11
11
 
12
- # A unique ID determined by the merchant, to link a Paypal transaction to a FraudNet PayPal risk session. Only applicable to customer-initiated transactions, when the FraudNet SDK is used, and to be passed in the API request the same tracking ID value (FraudNet Session Identifier).
12
+ # A unique ID determined by the merchant, to link a Paypal transaction to a FraudNet PayPal risk session. Only applicable to customer-initiated transactions, when the FraudNet SDK is used, and to be passed in the API request the same tracking ID value (FraudNet Session Identifier). This SDK is available here https://developer.paypal.com/docs/checkout/apm/pay-upon-invoice/fraudnet/
13
13
  attr_accessor :fraud_net_id
14
14
 
15
+ # Required parameter which defines how PayPal is being integrated inside the checkout page.
16
+ # * true = the current integration uses PayPal SDK
17
+ # * false = classic usage with PayPal Redirect flow
18
+ # @return [Boolean]
19
+ attr_accessor :java_script_sdk_flow
20
+
21
+ # Required parameter for a COMPLETE CALL (not only an ORDER CALL) which one value "CONFIRM_ORDER_STATUS" signals process is finished on merchant side.
22
+ # @return [String] Only value: "CONFIRM_ORDER_STATUS"
23
+ attr_accessor :action
24
+
15
25
  # Attribute mapping from ruby-style variable name to JSON key.
16
26
  def self.attribute_map
17
27
  {
18
28
  :'address_selection_at_pay_pal' => :'addressSelectionAtPayPal',
19
- :'fraud_net_id' => :'fraudNetId'
29
+ :'fraud_net_id' => :'fraudNetId',
30
+ :'java_script_sdk_flow' => :'javaScriptSdkFlow',
31
+ :'action' => :'action'
20
32
  }
21
33
  end
22
34
 
@@ -29,7 +41,9 @@ module PCPServerSDK
29
41
  def self.openapi_types
30
42
  {
31
43
  :'address_selection_at_pay_pal' => :'Boolean',
32
- :'fraud_net_id' => :'String'
44
+ :'fraud_net_id' => :'String',
45
+ :'java_script_sdk_flow' => :'Boolean',
46
+ :'action' => :'String'
33
47
  }
34
48
  end
35
49
 
@@ -61,6 +75,14 @@ module PCPServerSDK
61
75
  if attributes.key?(:'fraud_net_id')
62
76
  self.fraud_net_id = attributes[:'fraud_net_id']
63
77
  end
78
+
79
+ if attributes.key?(:'java_script_sdk_flow')
80
+ self.java_script_sdk_flow = attributes[:'java_script_sdk_flow']
81
+ end
82
+
83
+ if attributes.key?(:'action')
84
+ self.action = attributes[:'action']
85
+ end
64
86
  end
65
87
 
66
88
  # Checks equality by comparing each attribute.
@@ -68,8 +90,10 @@ module PCPServerSDK
68
90
  def ==(o)
69
91
  return true if self.equal?(o)
70
92
  self.class == o.class &&
71
- address_selection_at_pay_pal == o.address_selection_at_pay_pal &&
72
- fraud_net_id == o.fraud_net_id
93
+ address_selection_at_pay_pal == o.address_selection_at_pay_pal &&
94
+ fraud_net_id == o.fraud_net_id &&
95
+ java_script_sdk_flow == o.java_script_sdk_flow &&
96
+ action == o.action
73
97
  end
74
98
 
75
99
  # @see the `==` method
@@ -81,7 +105,7 @@ module PCPServerSDK
81
105
  # Calculates hash code according to all attributes.
82
106
  # @return [Integer] Hash code
83
107
  def hash
84
- [address_selection_at_pay_pal, fraud_net_id].hash
108
+ [address_selection_at_pay_pal, fraud_net_id, java_script_sdk_flow, action].hash
85
109
  end
86
110
 
87
111
  # Builds the object from hash
@@ -1,4 +1,4 @@
1
1
 
2
2
  module PCPServerSDK
3
- VERSION = '1.3.0'
3
+ VERSION = '1.4.0'
4
4
  end