Class: PaypalServerSdk::OrdersController
- Inherits:
-
BaseController
- Object
- BaseController
- PaypalServerSdk::OrdersController
- Defined in:
- lib/paypal_server_sdk/controllers/orders_controller.rb
Overview
OrdersController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#orders_authorize(options = {}) ⇒ ApiResponse
Authorizes payment for an order.
-
#orders_capture(options = {}) ⇒ ApiResponse
Captures payment for an order.
-
#orders_confirm(options = {}) ⇒ ApiResponse
Payer confirms their intent to pay for the the Order with the given payment source.
-
#orders_create(options = {}) ⇒ ApiResponse
Creates an order.
-
#orders_get(options = {}) ⇒ ApiResponse
Shows details for an order, by ID.<blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href=“developer.paypal.com/api/rest/reference/orders/v2/errors/#ge t-order”>Orders v2 errors</a>.</blockquote> show details.
-
#orders_patch(options = {}) ⇒ ApiResponse
Updates an order with a ‘CREATED` or `APPROVED` status.
-
#orders_track_create(options = {}) ⇒ ApiResponse
Adds tracking information for an Order.
-
#orders_trackers_patch(options = {}) ⇒ ApiResponse
Updates or cancels the tracking information for a PayPal order, by ID.
Methods inherited from BaseController
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from PaypalServerSdk::BaseController
Instance Method Details
#orders_authorize(options = {}) ⇒ ApiResponse
Authorizes payment for an order. To successfully authorize payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response.<blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href=“developer.paypal.com/api/rest/reference/orders/v2/errors/#au thorize-order”>Orders v2 errors</a>.</blockquote> authorize. keys for 6 hours. The API callers can request the times to up to 72 hours by speaking to their Account Manager. upon successful completion of the request. Value is:<ul><li>return=minimal
. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id
, status
and HATEOAS links.</li><li>return=representation
. The server returns a complete resource representation, including the current state of the resource.</li></ul> API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see <a href=“developer.paypal.com/api/rest/requests/#paypal-auth-assertio n”>PayPal-Auth-Assertion</a>.
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 288 def ( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/checkout/orders/{id}/authorize', Server::DEFAULT) .template_param(new_parameter(['id'], key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(['pay_pal_request_id'], key: 'PayPal-Request-Id')) .header_param(new_parameter(['prefer'], key: 'Prefer')) .header_param(new_parameter(['pay_pal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id')) .header_param(new_parameter(['pay_pal_auth_assertion'], key: 'PayPal-Auth-Assertion')) .body_param(new_parameter(['body'])) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Oauth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(OrderAuthorizeResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Request is not well-formed, syntactically incorrect, or'\ ' violates schema.', ErrorException) .local_error('401', 'Authentication failed due to missing authorization header, or'\ ' invalid authentication credentials.', ErrorException) .local_error('403', 'The authorized payment failed due to insufficient permissions'\ '.', ErrorException) .local_error('404', 'The specified resource does not exist.', ErrorException) .local_error('422', 'The requested action could not be performed, semantically'\ ' incorrect, or failed business validation.', ErrorException) .local_error('500', 'An internal server error has occurred.', ErrorException) .local_error('default', 'The error response.', ErrorException)) .execute end |
#orders_capture(options = {}) ⇒ ApiResponse
Captures payment for an order. To successfully capture payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response.<blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href=“developer.paypal.com/api/rest/reference/orders/v2/errors/#ca pture-order”>Orders v2 errors</a>.</blockquote> capture a payment. keys for 6 hours. The API callers can request the times to up to 72 hours by speaking to their Account Manager. upon successful completion of the request. Value is:<ul><li>return=minimal
. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id
, status
and HATEOAS links.</li><li>return=representation
. The server returns a complete resource representation, including the current state of the resource.</li></ul> API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see <a href=“developer.paypal.com/api/rest/requests/#paypal-auth-assertio n”>PayPal-Auth-Assertion</a>.
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 365 def orders_capture( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/checkout/orders/{id}/capture', Server::DEFAULT) .template_param(new_parameter(['id'], key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(['pay_pal_request_id'], key: 'PayPal-Request-Id')) .header_param(new_parameter(['prefer'], key: 'Prefer')) .header_param(new_parameter(['pay_pal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id')) .header_param(new_parameter(['pay_pal_auth_assertion'], key: 'PayPal-Auth-Assertion')) .body_param(new_parameter(['body'])) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Oauth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Order.method(:from_hash)) .is_api_response(true) .local_error('400', 'Request is not well-formed, syntactically incorrect, or'\ ' violates schema.', ErrorException) .local_error('401', 'Authentication failed due to missing authorization header, or'\ ' invalid authentication credentials.', ErrorException) .local_error('403', 'The authorized payment failed due to insufficient permissions'\ '.', ErrorException) .local_error('404', 'The specified resource does not exist.', ErrorException) .local_error('422', 'The requested action could not be performed, semantically'\ ' incorrect, or failed business validation.', ErrorException) .local_error('500', 'An internal server error has occurred.', ErrorException) .local_error('default', 'The error response.', ErrorException)) .execute end |
#orders_confirm(options = {}) ⇒ ApiResponse
Payer confirms their intent to pay for the the Order with the given payment source. payer confirms their intent to pay. upon successful completion of the request. Value is:<ul><li>return=minimal
. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id
, status
and HATEOAS links.</li><li>return=representation
. The server returns a complete resource representation, including the current state of the resource.</li></ul>
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 221 def orders_confirm( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/checkout/orders/{id}/confirm-payment-source', Server::DEFAULT) .template_param(new_parameter(['id'], key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(['pay_pal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id')) .header_param(new_parameter(['prefer'], key: 'Prefer')) .body_param(new_parameter(['body'])) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Oauth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Order.method(:from_hash)) .is_api_response(true) .local_error('400', 'Request is not well-formed, syntactically incorrect, or'\ ' violates schema.', ErrorException) .local_error('403', 'Authorization failed due to insufficient permissions.', ErrorException) .local_error('422', 'The requested action could not be performed, semantically'\ ' incorrect, or failed business validation.', ErrorException) .local_error('500', 'An internal server error has occurred.', ErrorException) .local_error('default', 'The error response.', ErrorException)) .execute end |
#orders_create(options = {}) ⇒ ApiResponse
Creates an order. Merchants and partners can add Level 2 and 3 data to payments to reduce risk and payment processing costs. For more information about processing payments, see <a href=“developer.paypal.com/docs/checkout/advanced/processing/”>che ckout</a> or <a href=“developer.paypal.com/docs/multiparty/checkout/advanced/proce ssing/”>multiparty checkout</a>.<blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href=“developer.paypal.com/api/rest/reference/orders/v2/errors/#cr eate-order”>Orders v2 errors</a>.</blockquote> keys for 6 hours. The API callers can request the times to up to 72 hours by speaking to their Account Manager. Example: upon successful completion of the request. Value is:<ul><li>return=minimal
. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id
, status
and HATEOAS links.</li><li>return=representation
. The server returns a complete resource representation, including the current state of the resource.</li></ul>
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 35 def orders_create( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/checkout/orders', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(['body'])) .header_param(new_parameter(['pay_pal_request_id'], key: 'PayPal-Request-Id')) .header_param(new_parameter(['pay_pal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id')) .header_param(new_parameter(['pay_pal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id')) .header_param(new_parameter(['prefer'], key: 'Prefer')) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Oauth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Order.method(:from_hash)) .is_api_response(true) .local_error('400', 'Request is not well-formed, syntactically incorrect, or'\ ' violates schema.', ErrorException) .local_error('401', 'Authentication failed due to missing authorization header, or'\ ' invalid authentication credentials.', ErrorException) .local_error('422', 'The requested action could not be performed, semantically'\ ' incorrect, or failed business validation.', ErrorException) .local_error('default', 'The error response.', ErrorException)) .execute end |
#orders_get(options = {}) ⇒ ApiResponse
Shows details for an order, by ID.<blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href=“developer.paypal.com/api/rest/reference/orders/v2/errors/#ge t-order”>Orders v2 errors</a>.</blockquote> show details. fields that should be returned for the order. Valid filter field is ‘payment_source`.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 81 def orders_get( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/checkout/orders/{id}', Server::DEFAULT) .template_param(new_parameter(['id'], key: 'id') .should_encode(true)) .query_param(new_parameter(['fields'], key: 'fields')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('Oauth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Order.method(:from_hash)) .is_api_response(true) .local_error('401', 'Authentication failed due to missing authorization header, or'\ ' invalid authentication credentials.', ErrorException) .local_error('404', 'The specified resource does not exist.', ErrorException) .local_error('default', 'The error response.', ErrorException)) .execute end |
#orders_patch(options = {}) ⇒ ApiResponse
Updates an order with a ‘CREATED` or `APPROVED` status. You cannot update an order with the `COMPLETED` status.<br/><br/>To make an update, you must provide a `reference_id`. If you omit this value with an order that contains only one purchase unit, PayPal sets the value to `default` which enables you to use the path: \"/purchase_units/@reference_id=='default'/{attribute-or-object}\"</ code>. Merchants and partners can add Level 2 and 3 data to payments to reduce risk and payment processing costs. For more information about processing payments, see <a href="https://developer.paypal.com/docs/checkout/advanced/processing/">che ckout</a> or <a href="https://developer.paypal.com/docs/multiparty/checkout/advanced/proce ssing/">multiparty checkout</a>.<blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#pa tch-order">Orders v2 errors</a>.</blockquote>Patchable attributes or objects:<br/><br/><table><thead><th>Attribute</th><th>Op</th><th>Notes</th ></thead><tbody><tr><td><code>intent
</td><td>replace</td><td></td>< /tr><tr><td>payer
</td><td>replace, add</td><td>Using replace op for payer
will replace the whole payer
object with the value sent in request.</td></tr><tr><td>purchase_units
</td><td>replace, add</td><td></td></tr><tr><td>purchase_units[].custom_id
</td> <td>replace, add, remove</td><td></td></tr><tr><td>purchase_units[].description
</td><td>replace, add, remove</td><td></td></tr><tr><td>purchase_units[].payee.email
</td><td>replace</td><td></td></tr><tr><td>purchase_units[].shipping .name
</td><td>replace, add</td><td></td></tr><tr><td>purchase_units[].shipping.email_addres s
</td><td>replace, add</td><td></td></tr><tr><td>purchase_units[].shipping.phone_number
</td><td>replace, add</td><td></td></tr><tr><td>purchase_units[].shipping.options</cod e></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.address</cod e></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.type
< /td><td>replace, add</td><td></td></tr><tr><td>purchase_units[].soft_descriptor</code ></td><td>replace, remove</td><td></td></tr><tr><td><code>purchase_units[].amount
</td> <td>replace</td><td></td></tr><tr><td>purchase_units[].items
< /td><td>replace, add, remove</td><td></td></tr><tr><td>purchase_units[].invoice_id
< /td><td>replace, add, remove</td><td></td></tr><tr><td>purchase_units[].payment_instructio n
</td><td>replace</td><td></td></tr><tr><td>purchase_units[]. payment_instruction.disbursement_mode
</td><td>replace</td><td>By default, disbursement_mode
is INSTANT
.</td></tr><tr><td>purchase_units[].payment_inst ruction.payee_receivable_fx_rate_id
</td><td>replace, add, remove</td><td></td></tr><tr><td>purchase_units[].payment_instructio n.platform_fees
</td><td>replace, add, remove</td><td></td></tr><tr><td>purchase_units[].supplementary_data .airline
</td><td>replace, add, remove</td><td></td></tr><tr><td>purchase_units[].supplementary_data .card
</td><td>replace, add, remove</td><td></td></tr><tr><td>application_context.client_configur ation
</td><td>replace, add</td><td></td></tr></tbody></table>
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 171 def orders_patch( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PATCH, '/v2/checkout/orders/{id}', Server::DEFAULT) .template_param(new_parameter(['id'], key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(['body'])) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Oauth2'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('400', 'Request is not well-formed, syntactically incorrect, or'\ ' violates schema.', ErrorException) .local_error('401', 'Authentication failed due to missing authorization header, or'\ ' invalid authentication credentials.', ErrorException) .local_error('404', 'The specified resource does not exist.', ErrorException) .local_error('422', 'The requested action could not be performed, semantically'\ ' incorrect, or failed business validation.', ErrorException) .local_error('default', 'The error response.', ErrorException)) .execute end |
#orders_track_create(options = {}) ⇒ ApiResponse
Adds tracking information for an Order. tracking information is associated with. API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see <a href=“developer.paypal.com/api/rest/requests/#paypal-auth-assertio n”>PayPal-Auth-Assertion</a>.
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 423 def orders_track_create( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/checkout/orders/{id}/track', Server::DEFAULT) .template_param(new_parameter(['id'], key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(['body'])) .header_param(new_parameter(['pay_pal_auth_assertion'], key: 'PayPal-Auth-Assertion')) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Oauth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Order.method(:from_hash)) .is_api_response(true) .local_error('400', 'Request is not well-formed, syntactically incorrect, or'\ ' violates schema.', ErrorException) .local_error('403', 'Authorization failed due to insufficient permissions.', ErrorException) .local_error('404', 'The specified resource does not exist.', ErrorException) .local_error('422', 'The requested action could not be performed, semantically'\ ' incorrect, or failed business validation.', ErrorException) .local_error('500', 'An internal server error has occurred.', ErrorException) .local_error('default', 'The error response.', ErrorException)) .execute end |
#orders_trackers_patch(options = {}) ⇒ ApiResponse
Updates or cancels the tracking information for a PayPal order, by ID. Updatable attributes or objects:<br/><br/><table><thead><th>Attribute</th><th>Op</th><th>Notes</th ></thead><tbody></tr><tr><td>items
</td><td>replace</td><td>Us ing replace op for items
will replace the entire items
object with the value sent in request.</td></tr><tr><td>notify_payer
</td><td>replace, add</td><td></td></tr><tr><td>status
</td><td>replace</td><td> Only patching status to CANCELLED is currently supported.</td></tr></tbody></table> tracking information is associated with.
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 478 def orders_trackers_patch( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PATCH, '/v2/checkout/orders/{id}/trackers/{tracker_id}', Server::DEFAULT) .template_param(new_parameter(['id'], key: 'id') .should_encode(true)) .template_param(new_parameter(['tracker_id'], key: 'tracker_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(['body'])) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Oauth2'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('400', 'Request is not well-formed, syntactically incorrect, or'\ ' violates schema.', ErrorException) .local_error('403', 'Authorization failed due to insufficient permissions.', ErrorException) .local_error('404', 'The specified resource does not exist.', ErrorException) .local_error('422', 'The requested action could not be performed, semantically'\ ' incorrect, or failed business validation.', ErrorException) .local_error('500', 'An internal server error has occurred.', ErrorException) .local_error('default', 'The error response.', ErrorException)) .execute end |