paypal-server-sdk 0.6.0 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ef7cf1b981945072fafad7189d7cc6ceb12a4f2db677b1225f68016501e3305
4
- data.tar.gz: 15294fe30a97d130acb6a876e45cd776528d37994a61735034bfcc02bdb3b1c2
3
+ metadata.gz: 4f1caaad4e69a1c19100e13e2b37cdba8012c3fa15270cd030b3282259a45f6c
4
+ data.tar.gz: f2caa98f19472826f5d180d57c51e6c739b3ca3a004641994ea568373ec13a64
5
5
  SHA512:
6
- metadata.gz: 10c77f1397acd49526daa9412c2fb74bd8846216866911752d43a67faa8fbd46252a02ab79427ffbb4e99b86453eaf3163da89aa79a45a8f34b766c3a3e200e3
7
- data.tar.gz: 182a49bec88cf84e3125bc3de01651222d1bf2c464e27c556c8c1a377a8ce727809434946850dafb22aa6c1692135c11fc9bc63ccf0a4577d586ccdd653164e1
6
+ metadata.gz: e5c979d2bb459881dfd4130303006ddb0a53219defcf9da0f65450b0c4b9db54e97f0a318077ba3f1d6983c38744cfcff59db9b822df45183387f3b2b0b7c38d
7
+ data.tar.gz: 817fa05d3196ef08f6fdd52134730f0f88e39a1d431cb89a91dbc71aa1f243bc73a36f933808d7d0b30947fc403a76c612cd27467598805e471612b159e586c2
data/README.md CHANGED
@@ -27,20 +27,20 @@ Find out more here: [https://developer.paypal.com/docs/api/orders/v2/](https://d
27
27
  Install the gem from the command line:
28
28
 
29
29
  ```ruby
30
- gem install paypal-server-sdk -v 0.6.0
30
+ gem install paypal-server-sdk -v 0.6.1
31
31
  ```
32
32
 
33
33
  Or add the gem to your Gemfile and run `bundle`:
34
34
 
35
35
  ```ruby
36
- gem 'paypal-server-sdk', '0.6.0'
36
+ gem 'paypal-server-sdk', '0.6.1'
37
37
  ```
38
38
 
39
- For additional gem details, see the [RubyGems page for the paypal-server-sdk gem](https://rubygems.org/gems/paypal-server-sdk/versions/0.6.0).
39
+ For additional gem details, see the [RubyGems page for the paypal-server-sdk gem](https://rubygems.org/gems/paypal-server-sdk/versions/0.6.1).
40
40
 
41
41
  ## Initialize the API Client
42
42
 
43
- **_Note:_** Documentation for the client can be found [here.](doc/client.md)
43
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/client.md)
44
44
 
45
45
  The following parameters are configurable for the API Client:
46
46
 
@@ -56,8 +56,8 @@ The following parameters are configurable for the API Client:
56
56
  | `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
57
57
  | `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
58
58
  | `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
59
- | `logging_configuration` | [`LoggingConfiguration`](__base_path/logging-configuration.md) | The SDK logging configuration for API calls |
60
- | `client_credentials_auth_credentials` | [`ClientCredentialsAuthCredentials`](__base_path/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
59
+ | `logging_configuration` | [`LoggingConfiguration`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
60
+ | `client_credentials_auth_credentials` | [`ClientCredentialsAuthCredentials`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
61
61
 
62
62
  The API client can be initialized as follows:
63
63
 
@@ -107,21 +107,21 @@ The SDK can be configured to use a different environment for making API calls. A
107
107
 
108
108
  This API uses the following authentication schemes.
109
109
 
110
- * [`Oauth2 (OAuth 2 Client Credentials Grant)`](__base_path/auth/oauth-2-client-credentials-grant.md)
110
+ * [`Oauth2 (OAuth 2 Client Credentials Grant)`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/auth/oauth-2-client-credentials-grant.md)
111
111
 
112
112
  ## List of APIs
113
113
 
114
- * [Orders](doc/controllers/orders.md)
115
- * [Payments](doc/controllers/payments.md)
116
- * [Vault](doc/controllers/vault.md)
114
+ * [Orders](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/controllers/orders.md)
115
+ * [Payments](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/controllers/payments.md)
116
+ * [Vault](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/controllers/vault.md)
117
117
 
118
118
  ## Classes Documentation
119
119
 
120
- * [Utility Classes](doc/utility-classes.md)
121
- * [HttpResponse](doc/http-response.md)
122
- * [HttpRequest](doc/http-request.md)
123
- * [LoggingConfiguration](doc/logging-configuration.md)
124
- * [RequestLoggingConfiguration](doc/request-logging-configuration.md)
125
- * [ResponseLoggingConfiguration](doc/response-logging-configuration.md)
126
- * [Abstract Logger](doc/abstract-logger.md)
120
+ * [Utility Classes](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/utility-classes.md)
121
+ * [HttpResponse](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/http-response.md)
122
+ * [HttpRequest](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/http-request.md)
123
+ * [LoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/logging-configuration.md)
124
+ * [RequestLoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/request-logging-configuration.md)
125
+ * [ResponseLoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/response-logging-configuration.md)
126
+ * [Abstract Logger](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.6.1/doc/abstract-logger.md)
127
127
 
@@ -10,7 +10,7 @@ module PaypalServerSdk
10
10
  attr_accessor :config, :http_call_back
11
11
 
12
12
  def self.user_agent
13
- 'PayPal REST API Ruby SDK, Version: 0.6.0, on OS {os-info}'
13
+ 'PayPal REST API Ruby SDK, Version: 0.6.1, on OS {os-info}'
14
14
  end
15
15
 
16
16
  def self.user_agent_parameters
@@ -6,19 +6,26 @@
6
6
  module PaypalServerSdk
7
7
  # OrdersController
8
8
  class OrdersController < BaseController
9
- # Authorizes payment for an order. To successfully authorize payment for an
10
- # order, the buyer must first approve the order or a valid payment_source
11
- # must be provided in the request. A buyer can approve the order upon being
12
- # redirected to the rel:approve URL that was returned in the HATEOAS links
13
- # in the create order response.<blockquote><strong>Note:</strong> For error
14
- # handling and troubleshooting, see <a
15
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#au
16
- # thorize-order">Orders v2 errors</a>.</blockquote>
17
- # @param [String] id Required parameter: The ID of the order for which to
18
- # authorize.
9
+ # Creates an order. Merchants and partners can add Level 2 and 3 data to
10
+ # payments to reduce risk and payment processing costs. For more information
11
+ # about processing payments, see <a
12
+ # href="https://developer.paypal.com/docs/checkout/advanced/processing/">che
13
+ # ckout</a> or <a
14
+ # href="https://developer.paypal.com/docs/multiparty/checkout/advanced/proce
15
+ # ssing/">multiparty checkout</a>.<blockquote><strong>Note:</strong> For
16
+ # error handling and troubleshooting, see <a
17
+ # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#cr
18
+ # eate-order">Orders v2 errors</a>.</blockquote>
19
+ # @param [OrderRequest] body Required parameter: Example:
19
20
  # @param [String] paypal_request_id Optional parameter: The server stores
20
21
  # keys for 6 hours. The API callers can request the times to up to 72 hours
21
- # by speaking to their Account Manager.
22
+ # by speaking to their Account Manager. It is mandatory for all single-step
23
+ # create order calls (E.g. Create Order Request with payment source
24
+ # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
25
+ # etc).
26
+ # @param [String] paypal_partner_attribution_id Optional parameter:
27
+ # Example:
28
+ # @param [String] paypal_client_metadata_id Optional parameter: Example:
22
29
  # @param [String] prefer Optional parameter: The preferred server response
23
30
  # upon successful completion of the request. Value
24
31
  # is:<ul><li><code>return=minimal</code>. The server returns a minimal
@@ -27,33 +34,30 @@ module PaypalServerSdk
27
34
  # HATEOAS links.</li><li><code>return=representation</code>. The server
28
35
  # returns a complete resource representation, including the current state of
29
36
  # the resource.</li></ul>
30
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
31
37
  # @param [String] paypal_auth_assertion Optional parameter: An
32
38
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
33
39
  # merchant. For details, see <a
34
40
  # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
35
41
  # n">PayPal-Auth-Assertion</a>.
36
- # @param [OrderAuthorizeRequest] body Optional parameter: Example:
37
42
  # @return [ApiResponse] the complete http response with raw body and status code.
38
- def orders_authorize(options = {})
43
+ def orders_create(options = {})
39
44
  new_api_call_builder
40
45
  .request(new_request_builder(HttpMethodEnum::POST,
41
- '/v2/checkout/orders/{id}/authorize',
46
+ '/v2/checkout/orders',
42
47
  Server::DEFAULT)
43
- .template_param(new_parameter(options['id'], key: 'id')
44
- .should_encode(true))
45
48
  .header_param(new_parameter('application/json', key: 'Content-Type'))
49
+ .body_param(new_parameter(options['body']))
46
50
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
47
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
51
+ .header_param(new_parameter(options['paypal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id'))
48
52
  .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
53
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
49
54
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
50
- .body_param(new_parameter(options['body']))
51
55
  .header_param(new_parameter('application/json', key: 'accept'))
52
56
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
53
57
  .auth(Single.new('Oauth2')))
54
58
  .response(new_response_handler
55
59
  .deserializer(APIHelper.method(:custom_type_deserializer))
56
- .deserialize_into(OrderAuthorizeResponse.method(:from_hash))
60
+ .deserialize_into(Order.method(:from_hash))
57
61
  .is_api_response(true)
58
62
  .local_error('400',
59
63
  'Request is not well-formed, syntactically incorrect, or'\
@@ -63,131 +67,52 @@ module PaypalServerSdk
63
67
  'Authentication failed due to missing authorization header, or'\
64
68
  ' invalid authentication credentials.',
65
69
  ErrorException)
66
- .local_error('403',
67
- 'The authorized payment failed due to insufficient permissions'\
68
- '.',
69
- ErrorException)
70
- .local_error('404',
71
- 'The specified resource does not exist.',
72
- ErrorException)
73
70
  .local_error('422',
74
71
  'The requested action could not be performed, semantically'\
75
72
  ' incorrect, or failed business validation.',
76
73
  ErrorException)
77
- .local_error('500',
78
- 'An internal server error has occurred.',
79
- ErrorException)
80
74
  .local_error('default',
81
75
  'The error response.',
82
76
  ErrorException))
83
77
  .execute
84
78
  end
85
79
 
86
- # Adds tracking information for an Order.
87
- # @param [String] id Required parameter: The ID of the order that the
88
- # tracking information is associated with.
89
- # @param [OrderTrackerRequest] body Required parameter: Example:
80
+ # Shows details for an order, by ID.<blockquote><strong>Note:</strong> For
81
+ # error handling and troubleshooting, see <a
82
+ # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ge
83
+ # t-order">Orders v2 errors</a>.</blockquote>
84
+ # @param [String] id Required parameter: The ID of the order for which to
85
+ # show details.
90
86
  # @param [String] paypal_auth_assertion Optional parameter: An
91
87
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
92
88
  # merchant. For details, see <a
93
89
  # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
94
90
  # n">PayPal-Auth-Assertion</a>.
91
+ # @param [String] fields Optional parameter: A comma-separated list of
92
+ # fields that should be returned for the order. Valid filter field is
93
+ # `payment_source`.
95
94
  # @return [ApiResponse] the complete http response with raw body and status code.
96
- def orders_track_create(options = {})
95
+ def orders_get(options = {})
97
96
  new_api_call_builder
98
- .request(new_request_builder(HttpMethodEnum::POST,
99
- '/v2/checkout/orders/{id}/track',
97
+ .request(new_request_builder(HttpMethodEnum::GET,
98
+ '/v2/checkout/orders/{id}',
100
99
  Server::DEFAULT)
101
100
  .template_param(new_parameter(options['id'], key: 'id')
102
101
  .should_encode(true))
103
- .header_param(new_parameter('application/json', key: 'Content-Type'))
104
- .body_param(new_parameter(options['body']))
105
102
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
103
+ .query_param(new_parameter(options['fields'], key: 'fields'))
106
104
  .header_param(new_parameter('application/json', key: 'accept'))
107
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
108
- .auth(Single.new('Oauth2')))
109
- .response(new_response_handler
110
- .deserializer(APIHelper.method(:custom_type_deserializer))
111
- .deserialize_into(Order.method(:from_hash))
112
- .is_api_response(true)
113
- .local_error('400',
114
- 'Request is not well-formed, syntactically incorrect, or'\
115
- ' violates schema.',
116
- ErrorException)
117
- .local_error('403',
118
- 'Authorization failed due to insufficient permissions.',
119
- ErrorException)
120
- .local_error('404',
121
- 'The specified resource does not exist.',
122
- ErrorException)
123
- .local_error('422',
124
- 'The requested action could not be performed, semantically'\
125
- ' incorrect, or failed business validation.',
126
- ErrorException)
127
- .local_error('500',
128
- 'An internal server error has occurred.',
129
- ErrorException)
130
- .local_error('default',
131
- 'The error response.',
132
- ErrorException))
133
- .execute
134
- end
135
-
136
- # Creates an order. Merchants and partners can add Level 2 and 3 data to
137
- # payments to reduce risk and payment processing costs. For more information
138
- # about processing payments, see <a
139
- # href="https://developer.paypal.com/docs/checkout/advanced/processing/">che
140
- # ckout</a> or <a
141
- # href="https://developer.paypal.com/docs/multiparty/checkout/advanced/proce
142
- # ssing/">multiparty checkout</a>.<blockquote><strong>Note:</strong> For
143
- # error handling and troubleshooting, see <a
144
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#cr
145
- # eate-order">Orders v2 errors</a>.</blockquote>
146
- # @param [OrderRequest] body Required parameter: Example:
147
- # @param [String] paypal_request_id Optional parameter: The server stores
148
- # keys for 6 hours. The API callers can request the times to up to 72 hours
149
- # by speaking to their Account Manager.
150
- # @param [String] paypal_partner_attribution_id Optional parameter:
151
- # Example:
152
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
153
- # @param [String] prefer Optional parameter: The preferred server response
154
- # upon successful completion of the request. Value
155
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
156
- # response to optimize communication between the API caller and the server.
157
- # A minimal response includes the <code>id</code>, <code>status</code> and
158
- # HATEOAS links.</li><li><code>return=representation</code>. The server
159
- # returns a complete resource representation, including the current state of
160
- # the resource.</li></ul>
161
- # @return [ApiResponse] the complete http response with raw body and status code.
162
- def orders_create(options = {})
163
- new_api_call_builder
164
- .request(new_request_builder(HttpMethodEnum::POST,
165
- '/v2/checkout/orders',
166
- Server::DEFAULT)
167
- .header_param(new_parameter('application/json', key: 'Content-Type'))
168
- .body_param(new_parameter(options['body']))
169
- .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
170
- .header_param(new_parameter(options['paypal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id'))
171
- .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
172
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
173
- .header_param(new_parameter('application/json', key: 'accept'))
174
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
175
105
  .auth(Single.new('Oauth2')))
176
106
  .response(new_response_handler
177
107
  .deserializer(APIHelper.method(:custom_type_deserializer))
178
108
  .deserialize_into(Order.method(:from_hash))
179
109
  .is_api_response(true)
180
- .local_error('400',
181
- 'Request is not well-formed, syntactically incorrect, or'\
182
- ' violates schema.',
183
- ErrorException)
184
110
  .local_error('401',
185
111
  'Authentication failed due to missing authorization header, or'\
186
112
  ' invalid authentication credentials.',
187
113
  ErrorException)
188
- .local_error('422',
189
- 'The requested action could not be performed, semantically'\
190
- ' incorrect, or failed business validation.',
114
+ .local_error('404',
115
+ 'The specified resource does not exist.',
191
116
  ErrorException)
192
117
  .local_error('default',
193
118
  'The error response.',
@@ -256,6 +181,11 @@ module PaypalServerSdk
256
181
  # remove</td><td></td></tr><tr><td><code>application_context.client_configur
257
182
  # ation</code></td><td>replace, add</td><td></td></tr></tbody></table>
258
183
  # @param [String] id Required parameter: The ID of the order to update.
184
+ # @param [String] paypal_auth_assertion Optional parameter: An
185
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
186
+ # merchant. For details, see <a
187
+ # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
188
+ # n">PayPal-Auth-Assertion</a>.
259
189
  # @param [Array[Patch]] body Optional parameter: Example:
260
190
  # @return [ApiResponse] the complete http response with raw body and status code.
261
191
  def orders_patch(options = {})
@@ -266,6 +196,7 @@ module PaypalServerSdk
266
196
  .template_param(new_parameter(options['id'], key: 'id')
267
197
  .should_encode(true))
268
198
  .header_param(new_parameter('application/json', key: 'Content-Type'))
199
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
269
200
  .body_param(new_parameter(options['body']))
270
201
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
271
202
  .auth(Single.new('Oauth2')))
@@ -293,19 +224,81 @@ module PaypalServerSdk
293
224
  .execute
294
225
  end
295
226
 
296
- # Captures payment for an order. To successfully capture payment for an
227
+ # Payer confirms their intent to pay for the the Order with the given
228
+ # payment source.
229
+ # @param [String] id Required parameter: The ID of the order for which the
230
+ # payer confirms their intent to pay.
231
+ # @param [String] paypal_client_metadata_id Optional parameter: Example:
232
+ # @param [String] paypal_auth_assertion Optional parameter: An
233
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
234
+ # merchant. For details, see <a
235
+ # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
236
+ # n">PayPal-Auth-Assertion</a>.
237
+ # @param [String] prefer Optional parameter: The preferred server response
238
+ # upon successful completion of the request. Value
239
+ # is:<ul><li><code>return=minimal</code>. The server returns a minimal
240
+ # response to optimize communication between the API caller and the server.
241
+ # A minimal response includes the <code>id</code>, <code>status</code> and
242
+ # HATEOAS links.</li><li><code>return=representation</code>. The server
243
+ # returns a complete resource representation, including the current state of
244
+ # the resource.</li></ul>
245
+ # @param [ConfirmOrderRequest] body Optional parameter: Example:
246
+ # @return [ApiResponse] the complete http response with raw body and status code.
247
+ def orders_confirm(options = {})
248
+ new_api_call_builder
249
+ .request(new_request_builder(HttpMethodEnum::POST,
250
+ '/v2/checkout/orders/{id}/confirm-payment-source',
251
+ Server::DEFAULT)
252
+ .template_param(new_parameter(options['id'], key: 'id')
253
+ .should_encode(true))
254
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
255
+ .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
256
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
257
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
258
+ .body_param(new_parameter(options['body']))
259
+ .header_param(new_parameter('application/json', key: 'accept'))
260
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
261
+ .auth(Single.new('Oauth2')))
262
+ .response(new_response_handler
263
+ .deserializer(APIHelper.method(:custom_type_deserializer))
264
+ .deserialize_into(Order.method(:from_hash))
265
+ .is_api_response(true)
266
+ .local_error('400',
267
+ 'Request is not well-formed, syntactically incorrect, or'\
268
+ ' violates schema.',
269
+ ErrorException)
270
+ .local_error('403',
271
+ 'Authorization failed due to insufficient permissions.',
272
+ ErrorException)
273
+ .local_error('422',
274
+ 'The requested action could not be performed, semantically'\
275
+ ' incorrect, or failed business validation.',
276
+ ErrorException)
277
+ .local_error('500',
278
+ 'An internal server error has occurred.',
279
+ ErrorException)
280
+ .local_error('default',
281
+ 'The error response.',
282
+ ErrorException))
283
+ .execute
284
+ end
285
+
286
+ # Authorizes payment for an order. To successfully authorize payment for an
297
287
  # order, the buyer must first approve the order or a valid payment_source
298
288
  # must be provided in the request. A buyer can approve the order upon being
299
289
  # redirected to the rel:approve URL that was returned in the HATEOAS links
300
290
  # in the create order response.<blockquote><strong>Note:</strong> For error
301
291
  # handling and troubleshooting, see <a
302
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ca
303
- # pture-order">Orders v2 errors</a>.</blockquote>
292
+ # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#au
293
+ # thorize-order">Orders v2 errors</a>.</blockquote>
304
294
  # @param [String] id Required parameter: The ID of the order for which to
305
- # capture a payment.
295
+ # authorize.
306
296
  # @param [String] paypal_request_id Optional parameter: The server stores
307
297
  # keys for 6 hours. The API callers can request the times to up to 72 hours
308
- # by speaking to their Account Manager.
298
+ # by speaking to their Account Manager. It is mandatory for all single-step
299
+ # create order calls (E.g. Create Order Request with payment source
300
+ # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
301
+ # etc).
309
302
  # @param [String] prefer Optional parameter: The preferred server response
310
303
  # upon successful completion of the request. Value
311
304
  # is:<ul><li><code>return=minimal</code>. The server returns a minimal
@@ -320,12 +313,12 @@ module PaypalServerSdk
320
313
  # merchant. For details, see <a
321
314
  # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
322
315
  # n">PayPal-Auth-Assertion</a>.
323
- # @param [OrderCaptureRequest] body Optional parameter: Example:
316
+ # @param [OrderAuthorizeRequest] body Optional parameter: Example:
324
317
  # @return [ApiResponse] the complete http response with raw body and status code.
325
- def orders_capture(options = {})
318
+ def orders_authorize(options = {})
326
319
  new_api_call_builder
327
320
  .request(new_request_builder(HttpMethodEnum::POST,
328
- '/v2/checkout/orders/{id}/capture',
321
+ '/v2/checkout/orders/{id}/authorize',
329
322
  Server::DEFAULT)
330
323
  .template_param(new_parameter(options['id'], key: 'id')
331
324
  .should_encode(true))
@@ -340,7 +333,7 @@ module PaypalServerSdk
340
333
  .auth(Single.new('Oauth2')))
341
334
  .response(new_response_handler
342
335
  .deserializer(APIHelper.method(:custom_type_deserializer))
343
- .deserialize_into(Order.method(:from_hash))
336
+ .deserialize_into(OrderAuthorizeResponse.method(:from_hash))
344
337
  .is_api_response(true)
345
338
  .local_error('400',
346
339
  'Request is not well-formed, syntactically incorrect, or'\
@@ -370,69 +363,106 @@ module PaypalServerSdk
370
363
  .execute
371
364
  end
372
365
 
373
- # Shows details for an order, by ID.<blockquote><strong>Note:</strong> For
374
- # error handling and troubleshooting, see <a
375
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ge
376
- # t-order">Orders v2 errors</a>.</blockquote>
366
+ # Captures payment for an order. To successfully capture payment for an
367
+ # order, the buyer must first approve the order or a valid payment_source
368
+ # must be provided in the request. A buyer can approve the order upon being
369
+ # redirected to the rel:approve URL that was returned in the HATEOAS links
370
+ # in the create order response.<blockquote><strong>Note:</strong> For error
371
+ # handling and troubleshooting, see <a
372
+ # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ca
373
+ # pture-order">Orders v2 errors</a>.</blockquote>
377
374
  # @param [String] id Required parameter: The ID of the order for which to
378
- # show details.
379
- # @param [String] fields Optional parameter: A comma-separated list of
380
- # fields that should be returned for the order. Valid filter field is
381
- # `payment_source`.
375
+ # capture a payment.
376
+ # @param [String] paypal_request_id Optional parameter: The server stores
377
+ # keys for 6 hours. The API callers can request the times to up to 72 hours
378
+ # by speaking to their Account Manager. It is mandatory for all single-step
379
+ # create order calls (E.g. Create Order Request with payment source
380
+ # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
381
+ # etc).
382
+ # @param [String] prefer Optional parameter: The preferred server response
383
+ # upon successful completion of the request. Value
384
+ # is:<ul><li><code>return=minimal</code>. The server returns a minimal
385
+ # response to optimize communication between the API caller and the server.
386
+ # A minimal response includes the <code>id</code>, <code>status</code> and
387
+ # HATEOAS links.</li><li><code>return=representation</code>. The server
388
+ # returns a complete resource representation, including the current state of
389
+ # the resource.</li></ul>
390
+ # @param [String] paypal_client_metadata_id Optional parameter: Example:
391
+ # @param [String] paypal_auth_assertion Optional parameter: An
392
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
393
+ # merchant. For details, see <a
394
+ # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
395
+ # n">PayPal-Auth-Assertion</a>.
396
+ # @param [OrderCaptureRequest] body Optional parameter: Example:
382
397
  # @return [ApiResponse] the complete http response with raw body and status code.
383
- def orders_get(options = {})
398
+ def orders_capture(options = {})
384
399
  new_api_call_builder
385
- .request(new_request_builder(HttpMethodEnum::GET,
386
- '/v2/checkout/orders/{id}',
400
+ .request(new_request_builder(HttpMethodEnum::POST,
401
+ '/v2/checkout/orders/{id}/capture',
387
402
  Server::DEFAULT)
388
403
  .template_param(new_parameter(options['id'], key: 'id')
389
404
  .should_encode(true))
390
- .query_param(new_parameter(options['fields'], key: 'fields'))
405
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
406
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
407
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
408
+ .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
409
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
410
+ .body_param(new_parameter(options['body']))
391
411
  .header_param(new_parameter('application/json', key: 'accept'))
412
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
392
413
  .auth(Single.new('Oauth2')))
393
414
  .response(new_response_handler
394
415
  .deserializer(APIHelper.method(:custom_type_deserializer))
395
416
  .deserialize_into(Order.method(:from_hash))
396
417
  .is_api_response(true)
418
+ .local_error('400',
419
+ 'Request is not well-formed, syntactically incorrect, or'\
420
+ ' violates schema.',
421
+ ErrorException)
397
422
  .local_error('401',
398
423
  'Authentication failed due to missing authorization header, or'\
399
424
  ' invalid authentication credentials.',
400
425
  ErrorException)
426
+ .local_error('403',
427
+ 'The authorized payment failed due to insufficient permissions'\
428
+ '.',
429
+ ErrorException)
401
430
  .local_error('404',
402
431
  'The specified resource does not exist.',
403
432
  ErrorException)
433
+ .local_error('422',
434
+ 'The requested action could not be performed, semantically'\
435
+ ' incorrect, or failed business validation.',
436
+ ErrorException)
437
+ .local_error('500',
438
+ 'An internal server error has occurred.',
439
+ ErrorException)
404
440
  .local_error('default',
405
441
  'The error response.',
406
442
  ErrorException))
407
443
  .execute
408
444
  end
409
445
 
410
- # Payer confirms their intent to pay for the the Order with the given
411
- # payment source.
412
- # @param [String] id Required parameter: The ID of the order for which the
413
- # payer confirms their intent to pay.
414
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
415
- # @param [String] prefer Optional parameter: The preferred server response
416
- # upon successful completion of the request. Value
417
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
418
- # response to optimize communication between the API caller and the server.
419
- # A minimal response includes the <code>id</code>, <code>status</code> and
420
- # HATEOAS links.</li><li><code>return=representation</code>. The server
421
- # returns a complete resource representation, including the current state of
422
- # the resource.</li></ul>
423
- # @param [ConfirmOrderRequest] body Optional parameter: Example:
446
+ # Adds tracking information for an Order.
447
+ # @param [String] id Required parameter: The ID of the order that the
448
+ # tracking information is associated with.
449
+ # @param [OrderTrackerRequest] body Required parameter: Example:
450
+ # @param [String] paypal_auth_assertion Optional parameter: An
451
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
452
+ # merchant. For details, see <a
453
+ # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
454
+ # n">PayPal-Auth-Assertion</a>.
424
455
  # @return [ApiResponse] the complete http response with raw body and status code.
425
- def orders_confirm(options = {})
456
+ def orders_track_create(options = {})
426
457
  new_api_call_builder
427
458
  .request(new_request_builder(HttpMethodEnum::POST,
428
- '/v2/checkout/orders/{id}/confirm-payment-source',
459
+ '/v2/checkout/orders/{id}/track',
429
460
  Server::DEFAULT)
430
461
  .template_param(new_parameter(options['id'], key: 'id')
431
462
  .should_encode(true))
432
463
  .header_param(new_parameter('application/json', key: 'Content-Type'))
433
- .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
434
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
435
464
  .body_param(new_parameter(options['body']))
465
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
436
466
  .header_param(new_parameter('application/json', key: 'accept'))
437
467
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
438
468
  .auth(Single.new('Oauth2')))
@@ -447,6 +477,9 @@ module PaypalServerSdk
447
477
  .local_error('403',
448
478
  'Authorization failed due to insufficient permissions.',
449
479
  ErrorException)
480
+ .local_error('404',
481
+ 'The specified resource does not exist.',
482
+ ErrorException)
450
483
  .local_error('422',
451
484
  'The requested action could not be performed, semantically'\
452
485
  ' incorrect, or failed business validation.',
@@ -473,6 +506,11 @@ module PaypalServerSdk
473
506
  # @param [String] id Required parameter: The ID of the order that the
474
507
  # tracking information is associated with.
475
508
  # @param [String] tracker_id Required parameter: The order tracking ID.
509
+ # @param [String] paypal_auth_assertion Optional parameter: An
510
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
511
+ # merchant. For details, see <a
512
+ # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
513
+ # n">PayPal-Auth-Assertion</a>.
476
514
  # @param [Array[Patch]] body Optional parameter: Example:
477
515
  # @return [ApiResponse] the complete http response with raw body and status code.
478
516
  def orders_trackers_patch(options = {})
@@ -485,6 +523,7 @@ module PaypalServerSdk
485
523
  .template_param(new_parameter(options['tracker_id'], key: 'tracker_id')
486
524
  .should_encode(true))
487
525
  .header_param(new_parameter('application/json', key: 'Content-Type'))
526
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
488
527
  .body_param(new_parameter(options['body']))
489
528
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
490
529
  .auth(Single.new('Oauth2')))