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. It is mandatory for all single-step create order calls (E.g. Create Order Request with payment source information like Card, PayPal.vault_id, PayPal.billing_agreement_id, etc). 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>.
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 318 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(['paypal_request_id'], key: 'PayPal-Request-Id')) .header_param(new_parameter(['prefer'], key: 'Prefer')) .header_param(new_parameter(['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id')) .header_param(new_parameter(['paypal_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. It is mandatory for all single-step create order calls (E.g. Create Order Request with payment source information like Card, PayPal.vault_id, PayPal.billing_agreement_id, etc). 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>.
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 398 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(['paypal_request_id'], key: 'PayPal-Request-Id')) .header_param(new_parameter(['prefer'], key: 'Prefer')) .header_param(new_parameter(['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id')) .header_param(new_parameter(['paypal_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. 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>. 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>
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 247 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(['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id')) .header_param(new_parameter(['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion')) .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. It is mandatory for all single-step create order calls (E.g. Create Order Request with payment source information like Card, PayPal.vault_id, PayPal.billing_agreement_id, etc). 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> 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>.
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 70 71 72 73 74 75 76 77 78 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 43 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(['paypal_request_id'], key: 'PayPal-Request-Id')) .header_param(new_parameter(['paypal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id')) .header_param(new_parameter(['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id')) .header_param(new_parameter(['prefer'], key: 'Prefer')) .header_param(new_parameter(['paypal_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('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. 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>. fields that should be returned for the order. Valid filter field is ‘payment_source`.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 95 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)) .header_param(new_parameter(['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion')) .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> 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>.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 191 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')) .header_param(new_parameter(['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion')) .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>.
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 456 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(['paypal_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. 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>.
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'lib/paypal_server_sdk/controllers/orders_controller.rb', line 516 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')) .header_param(new_parameter(['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion')) .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 |