paypal-server-sdk 0.5.2 → 0.6.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -18
  3. data/lib/paypal_server_sdk/controllers/base_controller.rb +1 -1
  4. data/lib/paypal_server_sdk/controllers/orders_controller.rb +171 -171
  5. data/lib/paypal_server_sdk/controllers/payments_controller.rb +49 -49
  6. data/lib/paypal_server_sdk/controllers/vault_controller.rb +52 -52
  7. data/lib/paypal_server_sdk/models/avs_code.rb +1 -1
  8. data/lib/paypal_server_sdk/models/blik_experience_context.rb +2 -2
  9. data/lib/paypal_server_sdk/models/blik_level0_payment_object.rb +2 -2
  10. data/lib/paypal_server_sdk/models/blik_one_click_payment_object.rb +2 -2
  11. data/lib/paypal_server_sdk/models/blik_one_click_payment_request.rb +2 -2
  12. data/lib/paypal_server_sdk/models/blik_payment_object.rb +4 -4
  13. data/lib/paypal_server_sdk/models/blik_payment_request.rb +8 -8
  14. data/lib/paypal_server_sdk/models/card_verification_processor_response.rb +2 -2
  15. data/lib/paypal_server_sdk/models/cvv_code.rb +1 -1
  16. data/lib/paypal_server_sdk/models/eci_flag.rb +1 -1
  17. data/lib/paypal_server_sdk/models/eps_payment_object.rb +2 -2
  18. data/lib/paypal_server_sdk/models/eps_payment_request.rb +2 -2
  19. data/lib/paypal_server_sdk/models/ideal_payment_object.rb +2 -2
  20. data/lib/paypal_server_sdk/models/ideal_payment_request.rb +2 -2
  21. data/lib/paypal_server_sdk/models/link_description.rb +1 -1
  22. data/lib/paypal_server_sdk/models/link_http_method.rb +1 -1
  23. data/lib/paypal_server_sdk/models/{my_bank_payment_object.rb → mybank_payment_object.rb} +2 -2
  24. data/lib/paypal_server_sdk/models/{my_bank_payment_request.rb → mybank_payment_request.rb} +2 -2
  25. data/lib/paypal_server_sdk/models/network_token.rb +1 -1
  26. data/lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb +2 -2
  27. data/lib/paypal_server_sdk/models/order_authorize_response_payment_source.rb +2 -2
  28. data/lib/paypal_server_sdk/models/order_capture_request_payment_source.rb +2 -2
  29. data/lib/paypal_server_sdk/models/pa_res_status.rb +1 -1
  30. data/lib/paypal_server_sdk/models/payment_source.rb +10 -10
  31. data/lib/paypal_server_sdk/models/payment_source_response.rb +10 -10
  32. data/lib/paypal_server_sdk/models/payment_token_response_payment_source.rb +2 -2
  33. data/lib/paypal_server_sdk/models/{pay_pal_experience_landing_page.rb → paypal_experience_landing_page.rb} +2 -2
  34. data/lib/paypal_server_sdk/models/{pay_pal_experience_user_action.rb → paypal_experience_user_action.rb} +2 -2
  35. data/lib/paypal_server_sdk/models/{pay_pal_payment_token.rb → paypal_payment_token.rb} +3 -3
  36. data/lib/paypal_server_sdk/models/{pay_pal_payment_token_customer_type.rb → paypal_payment_token_customer_type.rb} +2 -2
  37. data/lib/paypal_server_sdk/models/{pay_pal_payment_token_usage_pattern.rb → paypal_payment_token_usage_pattern.rb} +2 -2
  38. data/lib/paypal_server_sdk/models/{pay_pal_payment_token_usage_type.rb → paypal_payment_token_usage_type.rb} +2 -2
  39. data/lib/paypal_server_sdk/models/{pay_pal_wallet.rb → paypal_wallet.rb} +6 -6
  40. data/lib/paypal_server_sdk/models/{pay_pal_wallet_account_verification_status.rb → paypal_wallet_account_verification_status.rb} +2 -2
  41. data/lib/paypal_server_sdk/models/{pay_pal_wallet_attributes.rb → paypal_wallet_attributes.rb} +6 -6
  42. data/lib/paypal_server_sdk/models/{pay_pal_wallet_attributes_response.rb → paypal_wallet_attributes_response.rb} +4 -4
  43. data/lib/paypal_server_sdk/models/{pay_pal_wallet_customer.rb → paypal_wallet_customer.rb} +2 -2
  44. data/lib/paypal_server_sdk/models/{pay_pal_wallet_customer_request.rb → paypal_wallet_customer_request.rb} +3 -3
  45. data/lib/paypal_server_sdk/models/{pay_pal_wallet_experience_context.rb → paypal_wallet_experience_context.rb} +8 -8
  46. data/lib/paypal_server_sdk/models/{pay_pal_wallet_response.rb → paypal_wallet_response.rb} +5 -5
  47. data/lib/paypal_server_sdk/models/{pay_pal_wallet_vault_instruction.rb → paypal_wallet_vault_instruction.rb} +8 -8
  48. data/lib/paypal_server_sdk/models/{pay_pal_wallet_vault_response.rb → paypal_wallet_vault_response.rb} +5 -5
  49. data/lib/paypal_server_sdk/models/{pay_pal_wallet_vault_status.rb → paypal_wallet_vault_status.rb} +2 -2
  50. data/lib/paypal_server_sdk/models/processor_response.rb +2 -2
  51. data/lib/paypal_server_sdk/models/setup_token_request_payment_source.rb +2 -2
  52. data/lib/paypal_server_sdk/models/setup_token_response_payment_source.rb +2 -2
  53. data/lib/paypal_server_sdk/models/three_d_secure_authentication_response.rb +1 -1
  54. data/lib/paypal_server_sdk/models/universal_product_code.rb +1 -1
  55. data/lib/paypal_server_sdk/models/upc_type.rb +1 -1
  56. data/lib/paypal_server_sdk/models/{vault_pay_pal_wallet_request.rb → vault_paypal_wallet_request.rb} +2 -2
  57. data/lib/paypal_server_sdk.rb +150 -150
  58. metadata +22 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72e87c0a4a2bbe2a6d2851a6284a7fe4fafd5c2afaedd8e487562c92da9109a2
4
- data.tar.gz: dc7d7504f8cabf4e5cf33cff132365324001beaf7e6f9397d7e4ae8010bbc840
3
+ metadata.gz: 8ef7cf1b981945072fafad7189d7cc6ceb12a4f2db677b1225f68016501e3305
4
+ data.tar.gz: 15294fe30a97d130acb6a876e45cd776528d37994a61735034bfcc02bdb3b1c2
5
5
  SHA512:
6
- metadata.gz: a3601590d82e08b09c472677bed7194e64251216ae8fcdd64e52d5bb4910877487399fbe99d41f69ebf015fea49b8d0b86b3e152daedcbfc854b327b21b01486
7
- data.tar.gz: 836c7021ec50c5fd8d9026eeb46c92b47736060c3e0e6f6ddc9a32bfc7e2b5b67fed30646e5d6ccc074921d4cc64de4ca5e9d9e2c7767ef186feceaa6fcec783
6
+ metadata.gz: 10c77f1397acd49526daa9412c2fb74bd8846216866911752d43a67faa8fbd46252a02ab79427ffbb4e99b86453eaf3163da89aa79a45a8f34b766c3a3e200e3
7
+ data.tar.gz: 182a49bec88cf84e3125bc3de01651222d1bf2c464e27c556c8c1a377a8ce727809434946850dafb22aa6c1692135c11fc9bc63ccf0a4577d586ccdd653164e1
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # Getting Started with Paypal Server SDK
2
+ # Getting Started with PayPal Server SDK
3
3
 
4
4
  ## Introduction
5
5
 
@@ -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.5.2
30
+ gem install paypal-server-sdk -v 0.6.0
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.5.2'
36
+ gem 'paypal-server-sdk', '0.6.0'
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.5.2).
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).
40
40
 
41
41
  ## Initialize the API Client
42
42
 
43
- **_Note:_** Documentation for the client can be found [here.](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/client.md)
43
+ **_Note:_** Documentation for the client can be found [here.](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`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/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.5.2/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
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 |
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)`](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/auth/oauth-2-client-credentials-grant.md)
110
+ * [`Oauth2 (OAuth 2 Client Credentials Grant)`](__base_path/auth/oauth-2-client-credentials-grant.md)
111
111
 
112
112
  ## List of APIs
113
113
 
114
- * [Orders](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/controllers/orders.md)
115
- * [Payments](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/controllers/payments.md)
116
- * [Vault](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/controllers/vault.md)
114
+ * [Orders](doc/controllers/orders.md)
115
+ * [Payments](doc/controllers/payments.md)
116
+ * [Vault](doc/controllers/vault.md)
117
117
 
118
118
  ## Classes Documentation
119
119
 
120
- * [Utility Classes](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/utility-classes.md)
121
- * [HttpResponse](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/http-response.md)
122
- * [HttpRequest](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/http-request.md)
123
- * [LoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/logging-configuration.md)
124
- * [RequestLoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/request-logging-configuration.md)
125
- * [ResponseLoggingConfiguration](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/response-logging-configuration.md)
126
- * [Abstract Logger](https://www.github.com/paypal/PayPal-Ruby-Server-SDK/tree/0.5.2/doc/abstract-logger.md)
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)
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.5.2, on OS {os-info}'
13
+ 'PayPal REST API Ruby SDK, Version: 0.6.0, on OS {os-info}'
14
14
  end
15
15
 
16
16
  def self.user_agent_parameters
@@ -6,23 +6,19 @@
6
6
  module PaypalServerSdk
7
7
  # OrdersController
8
8
  class OrdersController < BaseController
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:
20
- # @param [String] pay_pal_request_id Optional parameter: The server stores
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.
19
+ # @param [String] paypal_request_id Optional parameter: The server stores
21
20
  # keys for 6 hours. The API callers can request the times to up to 72 hours
22
21
  # by speaking to their Account Manager.
23
- # @param [String] pay_pal_partner_attribution_id Optional parameter:
24
- # Example:
25
- # @param [String] pay_pal_client_metadata_id Optional parameter: Example:
26
22
  # @param [String] prefer Optional parameter: The preferred server response
27
23
  # upon successful completion of the request. Value
28
24
  # is:<ul><li><code>return=minimal</code>. The server returns a minimal
@@ -31,24 +27,33 @@ module PaypalServerSdk
31
27
  # HATEOAS links.</li><li><code>return=representation</code>. The server
32
28
  # returns a complete resource representation, including the current state of
33
29
  # the resource.</li></ul>
30
+ # @param [String] paypal_client_metadata_id Optional parameter: Example:
31
+ # @param [String] paypal_auth_assertion Optional parameter: An
32
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
33
+ # merchant. For details, see <a
34
+ # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
35
+ # n">PayPal-Auth-Assertion</a>.
36
+ # @param [OrderAuthorizeRequest] body Optional parameter: Example:
34
37
  # @return [ApiResponse] the complete http response with raw body and status code.
35
- def orders_create(options = {})
38
+ def orders_authorize(options = {})
36
39
  new_api_call_builder
37
40
  .request(new_request_builder(HttpMethodEnum::POST,
38
- '/v2/checkout/orders',
41
+ '/v2/checkout/orders/{id}/authorize',
39
42
  Server::DEFAULT)
43
+ .template_param(new_parameter(options['id'], key: 'id')
44
+ .should_encode(true))
40
45
  .header_param(new_parameter('application/json', key: 'Content-Type'))
41
- .body_param(new_parameter(options['body']))
42
- .header_param(new_parameter(options['pay_pal_request_id'], key: 'PayPal-Request-Id'))
43
- .header_param(new_parameter(options['pay_pal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id'))
44
- .header_param(new_parameter(options['pay_pal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
46
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
45
47
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
48
+ .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
49
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
50
+ .body_param(new_parameter(options['body']))
46
51
  .header_param(new_parameter('application/json', key: 'accept'))
47
52
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
48
53
  .auth(Single.new('Oauth2')))
49
54
  .response(new_response_handler
50
55
  .deserializer(APIHelper.method(:custom_type_deserializer))
51
- .deserialize_into(Order.method(:from_hash))
56
+ .deserialize_into(OrderAuthorizeResponse.method(:from_hash))
52
57
  .is_api_response(true)
53
58
  .local_error('400',
54
59
  'Request is not well-formed, syntactically incorrect, or'\
@@ -58,46 +63,131 @@ module PaypalServerSdk
58
63
  'Authentication failed due to missing authorization header, or'\
59
64
  ' invalid authentication credentials.',
60
65
  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)
61
73
  .local_error('422',
62
74
  'The requested action could not be performed, semantically'\
63
75
  ' incorrect, or failed business validation.',
64
76
  ErrorException)
77
+ .local_error('500',
78
+ 'An internal server error has occurred.',
79
+ ErrorException)
65
80
  .local_error('default',
66
81
  'The error response.',
67
82
  ErrorException))
68
83
  .execute
69
84
  end
70
85
 
71
- # Shows details for an order, by ID.<blockquote><strong>Note:</strong> For
72
- # error handling and troubleshooting, see <a
73
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ge
74
- # t-order">Orders v2 errors</a>.</blockquote>
75
- # @param [String] id Required parameter: The ID of the order for which to
76
- # show details.
77
- # @param [String] fields Optional parameter: A comma-separated list of
78
- # fields that should be returned for the order. Valid filter field is
79
- # `payment_source`.
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:
90
+ # @param [String] paypal_auth_assertion Optional parameter: An
91
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
92
+ # merchant. For details, see <a
93
+ # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
94
+ # n">PayPal-Auth-Assertion</a>.
80
95
  # @return [ApiResponse] the complete http response with raw body and status code.
81
- def orders_get(options = {})
96
+ def orders_track_create(options = {})
82
97
  new_api_call_builder
83
- .request(new_request_builder(HttpMethodEnum::GET,
84
- '/v2/checkout/orders/{id}',
98
+ .request(new_request_builder(HttpMethodEnum::POST,
99
+ '/v2/checkout/orders/{id}/track',
85
100
  Server::DEFAULT)
86
101
  .template_param(new_parameter(options['id'], key: 'id')
87
102
  .should_encode(true))
88
- .query_param(new_parameter(options['fields'], key: 'fields'))
103
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
104
+ .body_param(new_parameter(options['body']))
105
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
89
106
  .header_param(new_parameter('application/json', key: 'accept'))
107
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
90
108
  .auth(Single.new('Oauth2')))
91
109
  .response(new_response_handler
92
110
  .deserializer(APIHelper.method(:custom_type_deserializer))
93
111
  .deserialize_into(Order.method(:from_hash))
94
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
+ .auth(Single.new('Oauth2')))
176
+ .response(new_response_handler
177
+ .deserializer(APIHelper.method(:custom_type_deserializer))
178
+ .deserialize_into(Order.method(:from_hash))
179
+ .is_api_response(true)
180
+ .local_error('400',
181
+ 'Request is not well-formed, syntactically incorrect, or'\
182
+ ' violates schema.',
183
+ ErrorException)
95
184
  .local_error('401',
96
185
  'Authentication failed due to missing authorization header, or'\
97
186
  ' invalid authentication credentials.',
98
187
  ErrorException)
99
- .local_error('404',
100
- 'The specified resource does not exist.',
188
+ .local_error('422',
189
+ 'The requested action could not be performed, semantically'\
190
+ ' incorrect, or failed business validation.',
101
191
  ErrorException)
102
192
  .local_error('default',
103
193
  'The error response.',
@@ -203,70 +293,17 @@ module PaypalServerSdk
203
293
  .execute
204
294
  end
205
295
 
206
- # Payer confirms their intent to pay for the the Order with the given
207
- # payment source.
208
- # @param [String] id Required parameter: The ID of the order for which the
209
- # payer confirms their intent to pay.
210
- # @param [String] pay_pal_client_metadata_id Optional parameter: Example:
211
- # @param [String] prefer Optional parameter: The preferred server response
212
- # upon successful completion of the request. Value
213
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
214
- # response to optimize communication between the API caller and the server.
215
- # A minimal response includes the <code>id</code>, <code>status</code> and
216
- # HATEOAS links.</li><li><code>return=representation</code>. The server
217
- # returns a complete resource representation, including the current state of
218
- # the resource.</li></ul>
219
- # @param [ConfirmOrderRequest] body Optional parameter: Example:
220
- # @return [ApiResponse] the complete http response with raw body and status code.
221
- def orders_confirm(options = {})
222
- new_api_call_builder
223
- .request(new_request_builder(HttpMethodEnum::POST,
224
- '/v2/checkout/orders/{id}/confirm-payment-source',
225
- Server::DEFAULT)
226
- .template_param(new_parameter(options['id'], key: 'id')
227
- .should_encode(true))
228
- .header_param(new_parameter('application/json', key: 'Content-Type'))
229
- .header_param(new_parameter(options['pay_pal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
230
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
231
- .body_param(new_parameter(options['body']))
232
- .header_param(new_parameter('application/json', key: 'accept'))
233
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
234
- .auth(Single.new('Oauth2')))
235
- .response(new_response_handler
236
- .deserializer(APIHelper.method(:custom_type_deserializer))
237
- .deserialize_into(Order.method(:from_hash))
238
- .is_api_response(true)
239
- .local_error('400',
240
- 'Request is not well-formed, syntactically incorrect, or'\
241
- ' violates schema.',
242
- ErrorException)
243
- .local_error('403',
244
- 'Authorization failed due to insufficient permissions.',
245
- ErrorException)
246
- .local_error('422',
247
- 'The requested action could not be performed, semantically'\
248
- ' incorrect, or failed business validation.',
249
- ErrorException)
250
- .local_error('500',
251
- 'An internal server error has occurred.',
252
- ErrorException)
253
- .local_error('default',
254
- 'The error response.',
255
- ErrorException))
256
- .execute
257
- end
258
-
259
- # Authorizes payment for an order. To successfully authorize payment for an
296
+ # Captures payment for an order. To successfully capture payment for an
260
297
  # order, the buyer must first approve the order or a valid payment_source
261
298
  # must be provided in the request. A buyer can approve the order upon being
262
299
  # redirected to the rel:approve URL that was returned in the HATEOAS links
263
300
  # in the create order response.<blockquote><strong>Note:</strong> For error
264
301
  # handling and troubleshooting, see <a
265
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#au
266
- # thorize-order">Orders v2 errors</a>.</blockquote>
302
+ # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ca
303
+ # pture-order">Orders v2 errors</a>.</blockquote>
267
304
  # @param [String] id Required parameter: The ID of the order for which to
268
- # authorize.
269
- # @param [String] pay_pal_request_id Optional parameter: The server stores
305
+ # capture a payment.
306
+ # @param [String] paypal_request_id Optional parameter: The server stores
270
307
  # keys for 6 hours. The API callers can request the times to up to 72 hours
271
308
  # by speaking to their Account Manager.
272
309
  # @param [String] prefer Optional parameter: The preferred server response
@@ -277,33 +314,33 @@ module PaypalServerSdk
277
314
  # HATEOAS links.</li><li><code>return=representation</code>. The server
278
315
  # returns a complete resource representation, including the current state of
279
316
  # the resource.</li></ul>
280
- # @param [String] pay_pal_client_metadata_id Optional parameter: Example:
281
- # @param [String] pay_pal_auth_assertion Optional parameter: An
317
+ # @param [String] paypal_client_metadata_id Optional parameter: Example:
318
+ # @param [String] paypal_auth_assertion Optional parameter: An
282
319
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
283
320
  # merchant. For details, see <a
284
321
  # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
285
322
  # n">PayPal-Auth-Assertion</a>.
286
- # @param [OrderAuthorizeRequest] body Optional parameter: Example:
323
+ # @param [OrderCaptureRequest] body Optional parameter: Example:
287
324
  # @return [ApiResponse] the complete http response with raw body and status code.
288
- def orders_authorize(options = {})
325
+ def orders_capture(options = {})
289
326
  new_api_call_builder
290
327
  .request(new_request_builder(HttpMethodEnum::POST,
291
- '/v2/checkout/orders/{id}/authorize',
328
+ '/v2/checkout/orders/{id}/capture',
292
329
  Server::DEFAULT)
293
330
  .template_param(new_parameter(options['id'], key: 'id')
294
331
  .should_encode(true))
295
332
  .header_param(new_parameter('application/json', key: 'Content-Type'))
296
- .header_param(new_parameter(options['pay_pal_request_id'], key: 'PayPal-Request-Id'))
333
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
297
334
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
298
- .header_param(new_parameter(options['pay_pal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
299
- .header_param(new_parameter(options['pay_pal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
335
+ .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
336
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
300
337
  .body_param(new_parameter(options['body']))
301
338
  .header_param(new_parameter('application/json', key: 'accept'))
302
339
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
303
340
  .auth(Single.new('Oauth2')))
304
341
  .response(new_response_handler
305
342
  .deserializer(APIHelper.method(:custom_type_deserializer))
306
- .deserialize_into(OrderAuthorizeResponse.method(:from_hash))
343
+ .deserialize_into(Order.method(:from_hash))
307
344
  .is_api_response(true)
308
345
  .local_error('400',
309
346
  'Request is not well-formed, syntactically incorrect, or'\
@@ -333,103 +370,69 @@ module PaypalServerSdk
333
370
  .execute
334
371
  end
335
372
 
336
- # Captures payment for an order. To successfully capture payment for an
337
- # order, the buyer must first approve the order or a valid payment_source
338
- # must be provided in the request. A buyer can approve the order upon being
339
- # redirected to the rel:approve URL that was returned in the HATEOAS links
340
- # in the create order response.<blockquote><strong>Note:</strong> For error
341
- # handling and troubleshooting, see <a
342
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ca
343
- # pture-order">Orders v2 errors</a>.</blockquote>
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>
344
377
  # @param [String] id Required parameter: The ID of the order for which to
345
- # capture a payment.
346
- # @param [String] pay_pal_request_id Optional parameter: The server stores
347
- # keys for 6 hours. The API callers can request the times to up to 72 hours
348
- # by speaking to their Account Manager.
349
- # @param [String] prefer Optional parameter: The preferred server response
350
- # upon successful completion of the request. Value
351
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
352
- # response to optimize communication between the API caller and the server.
353
- # A minimal response includes the <code>id</code>, <code>status</code> and
354
- # HATEOAS links.</li><li><code>return=representation</code>. The server
355
- # returns a complete resource representation, including the current state of
356
- # the resource.</li></ul>
357
- # @param [String] pay_pal_client_metadata_id Optional parameter: Example:
358
- # @param [String] pay_pal_auth_assertion Optional parameter: An
359
- # API-caller-provided JSON Web Token (JWT) assertion that identifies the
360
- # merchant. For details, see <a
361
- # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
362
- # n">PayPal-Auth-Assertion</a>.
363
- # @param [OrderCaptureRequest] body Optional parameter: Example:
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`.
364
382
  # @return [ApiResponse] the complete http response with raw body and status code.
365
- def orders_capture(options = {})
383
+ def orders_get(options = {})
366
384
  new_api_call_builder
367
- .request(new_request_builder(HttpMethodEnum::POST,
368
- '/v2/checkout/orders/{id}/capture',
385
+ .request(new_request_builder(HttpMethodEnum::GET,
386
+ '/v2/checkout/orders/{id}',
369
387
  Server::DEFAULT)
370
388
  .template_param(new_parameter(options['id'], key: 'id')
371
389
  .should_encode(true))
372
- .header_param(new_parameter('application/json', key: 'Content-Type'))
373
- .header_param(new_parameter(options['pay_pal_request_id'], key: 'PayPal-Request-Id'))
374
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
375
- .header_param(new_parameter(options['pay_pal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
376
- .header_param(new_parameter(options['pay_pal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
377
- .body_param(new_parameter(options['body']))
390
+ .query_param(new_parameter(options['fields'], key: 'fields'))
378
391
  .header_param(new_parameter('application/json', key: 'accept'))
379
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
380
392
  .auth(Single.new('Oauth2')))
381
393
  .response(new_response_handler
382
394
  .deserializer(APIHelper.method(:custom_type_deserializer))
383
395
  .deserialize_into(Order.method(:from_hash))
384
396
  .is_api_response(true)
385
- .local_error('400',
386
- 'Request is not well-formed, syntactically incorrect, or'\
387
- ' violates schema.',
388
- ErrorException)
389
397
  .local_error('401',
390
398
  'Authentication failed due to missing authorization header, or'\
391
399
  ' invalid authentication credentials.',
392
400
  ErrorException)
393
- .local_error('403',
394
- 'The authorized payment failed due to insufficient permissions'\
395
- '.',
396
- ErrorException)
397
401
  .local_error('404',
398
402
  'The specified resource does not exist.',
399
403
  ErrorException)
400
- .local_error('422',
401
- 'The requested action could not be performed, semantically'\
402
- ' incorrect, or failed business validation.',
403
- ErrorException)
404
- .local_error('500',
405
- 'An internal server error has occurred.',
406
- ErrorException)
407
404
  .local_error('default',
408
405
  'The error response.',
409
406
  ErrorException))
410
407
  .execute
411
408
  end
412
409
 
413
- # Adds tracking information for an Order.
414
- # @param [String] id Required parameter: The ID of the order that the
415
- # tracking information is associated with.
416
- # @param [OrderTrackerRequest] body Required parameter: Example:
417
- # @param [String] pay_pal_auth_assertion Optional parameter: An
418
- # API-caller-provided JSON Web Token (JWT) assertion that identifies the
419
- # merchant. For details, see <a
420
- # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
421
- # n">PayPal-Auth-Assertion</a>.
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:
422
424
  # @return [ApiResponse] the complete http response with raw body and status code.
423
- def orders_track_create(options = {})
425
+ def orders_confirm(options = {})
424
426
  new_api_call_builder
425
427
  .request(new_request_builder(HttpMethodEnum::POST,
426
- '/v2/checkout/orders/{id}/track',
428
+ '/v2/checkout/orders/{id}/confirm-payment-source',
427
429
  Server::DEFAULT)
428
430
  .template_param(new_parameter(options['id'], key: 'id')
429
431
  .should_encode(true))
430
432
  .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'))
431
435
  .body_param(new_parameter(options['body']))
432
- .header_param(new_parameter(options['pay_pal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
433
436
  .header_param(new_parameter('application/json', key: 'accept'))
434
437
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
435
438
  .auth(Single.new('Oauth2')))
@@ -444,9 +447,6 @@ module PaypalServerSdk
444
447
  .local_error('403',
445
448
  'Authorization failed due to insufficient permissions.',
446
449
  ErrorException)
447
- .local_error('404',
448
- 'The specified resource does not exist.',
449
- ErrorException)
450
450
  .local_error('422',
451
451
  'The requested action could not be performed, semantically'\
452
452
  ' incorrect, or failed business validation.',