paypal-server-sdk 1.0.0 → 1.1.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +42 -36
  3. data/lib/paypal_server_sdk/controllers/base_controller.rb +1 -1
  4. data/lib/paypal_server_sdk/controllers/orders_controller.rb +211 -171
  5. data/lib/paypal_server_sdk/controllers/payments_controller.rb +95 -92
  6. data/lib/paypal_server_sdk/controllers/vault_controller.rb +81 -81
  7. data/lib/paypal_server_sdk/exceptions/error_exception.rb +5 -3
  8. data/lib/paypal_server_sdk/exceptions/o_auth_provider_exception.rb +5 -3
  9. data/lib/paypal_server_sdk/models/apple_pay_attributes.rb +2 -1
  10. data/lib/paypal_server_sdk/models/apple_pay_experience_context.rb +68 -0
  11. data/lib/paypal_server_sdk/models/apple_pay_request.rb +18 -4
  12. data/lib/paypal_server_sdk/models/callback_configuration.rb +1 -2
  13. data/lib/paypal_server_sdk/models/card_brand.rb +1 -1
  14. data/lib/paypal_server_sdk/models/card_customer_information.rb +14 -4
  15. data/lib/paypal_server_sdk/models/customer_information.rb +16 -5
  16. data/lib/paypal_server_sdk/models/customer_response.rb +1 -2
  17. data/lib/paypal_server_sdk/models/google_pay_experience_context.rb +68 -0
  18. data/lib/paypal_server_sdk/models/google_pay_request.rb +17 -4
  19. data/lib/paypal_server_sdk/models/item.rb +14 -4
  20. data/lib/paypal_server_sdk/models/line_item.rb +22 -11
  21. data/lib/paypal_server_sdk/models/order_billing_plan.rb +93 -0
  22. data/lib/paypal_server_sdk/models/order_status.rb +5 -5
  23. data/lib/paypal_server_sdk/models/payment_token_response.rb +1 -2
  24. data/lib/paypal_server_sdk/models/paypal_wallet_contact_preference.rb +34 -0
  25. data/lib/paypal_server_sdk/models/paypal_wallet_customer.rb +14 -4
  26. data/lib/paypal_server_sdk/models/paypal_wallet_customer_request.rb +14 -4
  27. data/lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb +20 -6
  28. data/lib/paypal_server_sdk/models/shipping_options_purchase_unit.rb +24 -5
  29. data/lib/paypal_server_sdk/models/vault_customer.rb +15 -5
  30. data/lib/paypal_server_sdk/models/vault_response.rb +2 -1
  31. data/lib/paypal_server_sdk/models/vault_response_customer.rb +1 -1
  32. data/lib/paypal_server_sdk/models/venmo_wallet_customer_information.rb +24 -4
  33. data/lib/paypal_server_sdk.rb +149 -145
  34. metadata +6 -2
@@ -6,53 +6,92 @@
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 checkout or multiparty checkout. Note: For
12
- # error handling and troubleshooting, see Orders v2 errors.
13
- # @param [OrderRequest] body Required parameter: Example:
9
+ # Updates an order with a `CREATED` or `APPROVED` status. You cannot update
10
+ # an order with the `COMPLETED` status.<br/><br/>To make an update, you must
11
+ # provide a `reference_id`. If you omit this value with an order that
12
+ # contains only one purchase unit, PayPal sets the value to `default` which
13
+ # enables you to use the path:
14
+ # <code>\"/purchase_units/@reference_id=='default'/{attribute-or-object}\"</
15
+ # code>. Merchants and partners can add Level 2 and 3 data to payments to
16
+ # reduce risk and payment processing costs. For more information about
17
+ # processing payments, see <a
18
+ # href="https://developer.paypal.com/docs/checkout/advanced/processing/">che
19
+ # ckout</a> or <a
20
+ # href="https://developer.paypal.com/docs/multiparty/checkout/advanced/proce
21
+ # ssing/">multiparty checkout</a>.<blockquote><strong>Note:</strong> For
22
+ # error handling and troubleshooting, see <a
23
+ # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#pa
24
+ # tch-order">Orders v2 errors</a>.</blockquote>Patchable attributes or
25
+ # objects:<br/><br/><table><thead><th>Attribute</th><th>Op</th><th>Notes</th
26
+ # ></thead><tbody><tr><td><code>intent</code></td><td>replace</td><td></td><
27
+ # /tr><tr><td><code>payer</code></td><td>replace, add</td><td>Using replace
28
+ # op for <code>payer</code> will replace the whole <code>payer</code> object
29
+ # with the value sent in
30
+ # request.</td></tr><tr><td><code>purchase_units</code></td><td>replace,
31
+ # add</td><td></td></tr><tr><td><code>purchase_units[].custom_id</code></td>
32
+ # <td>replace, add,
33
+ # remove</td><td></td></tr><tr><td><code>purchase_units[].description</code>
34
+ # </td><td>replace, add,
35
+ # remove</td><td></td></tr><tr><td><code>purchase_units[].payee.email</code>
36
+ # </td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].shipping
37
+ # .name</code></td><td>replace,
38
+ # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.email_addres
39
+ # s</code></td><td>replace,
40
+ # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.phone_number
41
+ # </code></td><td>replace,
42
+ # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.options</cod
43
+ # e></td><td>replace,
44
+ # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.address</cod
45
+ # e></td><td>replace,
46
+ # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.type</code><
47
+ # /td><td>replace,
48
+ # add</td><td></td></tr><tr><td><code>purchase_units[].soft_descriptor</code
49
+ # ></td><td>replace,
50
+ # remove</td><td></td></tr><tr><td><code>purchase_units[].amount</code></td>
51
+ # <td>replace</td><td></td></tr><tr><td><code>purchase_units[].items</code><
52
+ # /td><td>replace, add,
53
+ # remove</td><td></td></tr><tr><td><code>purchase_units[].invoice_id</code><
54
+ # /td><td>replace, add,
55
+ # remove</td><td></td></tr><tr><td><code>purchase_units[].payment_instructio
56
+ # n</code></td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].
57
+ # payment_instruction.disbursement_mode</code></td><td>replace</td><td>By
58
+ # default, <code>disbursement_mode</code> is
59
+ # <code>INSTANT</code>.</td></tr><tr><td><code>purchase_units[].payment_inst
60
+ # ruction.payee_receivable_fx_rate_id</code></td><td>replace, add,
61
+ # remove</td><td></td></tr><tr><td><code>purchase_units[].payment_instructio
62
+ # n.platform_fees</code></td><td>replace, add,
63
+ # remove</td><td></td></tr><tr><td><code>purchase_units[].supplementary_data
64
+ # .airline</code></td><td>replace, add,
65
+ # remove</td><td></td></tr><tr><td><code>purchase_units[].supplementary_data
66
+ # .card</code></td><td>replace, add,
67
+ # remove</td><td></td></tr><tr><td><code>application_context.client_configur
68
+ # ation</code></td><td>replace, add</td><td></td></tr></tbody></table>
69
+ # @param [String] id Required parameter: The ID of the order to update.
14
70
  # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
15
71
  # uses a request header to invoke negative testing in the sandbox. This
16
72
  # header configures the sandbox into a negative testing state for
17
73
  # transactions that include the merchant.
18
- # @param [String] paypal_request_id Optional parameter: The server stores
19
- # keys for 6 hours. The API callers can request the times to up to 72 hours
20
- # by speaking to their Account Manager. It is mandatory for all single-step
21
- # create order calls (E.g. Create Order Request with payment source
22
- # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
23
- # etc).
24
- # @param [String] paypal_partner_attribution_id Optional parameter:
25
- # Example:
26
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
27
- # @param [String] prefer Optional parameter: The preferred server response
28
- # upon successful completion of the request. Value is: return=minimal. The
29
- # server returns a minimal response to optimize communication between the
30
- # API caller and the server. A minimal response includes the id, status and
31
- # HATEOAS links. return=representation. The server returns a complete
32
- # resource representation, including the current state of the resource.
33
74
  # @param [String] paypal_auth_assertion Optional parameter: An
34
75
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
35
76
  # merchant. For details, see PayPal-Auth-Assertion.
77
+ # @param [Array[Patch]] body Optional parameter: TODO: type description
78
+ # here
36
79
  # @return [ApiResponse] the complete http response with raw body and status code.
37
- def create_order(options = {})
80
+ def patch_order(options = {})
38
81
  new_api_call_builder
39
- .request(new_request_builder(HttpMethodEnum::POST,
40
- '/v2/checkout/orders',
82
+ .request(new_request_builder(HttpMethodEnum::PATCH,
83
+ '/v2/checkout/orders/{id}',
41
84
  Server::DEFAULT)
85
+ .template_param(new_parameter(options['id'], key: 'id')
86
+ .should_encode(true))
42
87
  .header_param(new_parameter('application/json', key: 'Content-Type'))
43
- .body_param(new_parameter(options['body']))
44
88
  .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
45
- .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
46
- .header_param(new_parameter(options['paypal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id'))
47
- .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
48
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
49
89
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
50
- .header_param(new_parameter('application/json', key: 'accept'))
90
+ .body_param(new_parameter(options['body']))
51
91
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
52
92
  .auth(Single.new('Oauth2')))
53
93
  .response(new_response_handler
54
- .deserializer(APIHelper.method(:custom_type_deserializer))
55
- .deserialize_into(Order.method(:from_hash))
94
+ .is_response_void(true)
56
95
  .is_api_response(true)
57
96
  .local_error('400',
58
97
  'Request is not well-formed, syntactically incorrect, or'\
@@ -62,6 +101,9 @@ module PaypalServerSdk
62
101
  'Authentication failed due to missing authorization header, or'\
63
102
  ' invalid authentication credentials.',
64
103
  ErrorException)
104
+ .local_error('404',
105
+ 'The specified resource does not exist.',
106
+ ErrorException)
65
107
  .local_error('422',
66
108
  'The requested action could not be performed, semantically'\
67
109
  ' incorrect, or failed business validation.',
@@ -72,100 +114,111 @@ module PaypalServerSdk
72
114
  .execute
73
115
  end
74
116
 
75
- # Shows details for an order, by ID. Note: For error handling and
117
+ # Authorizes payment for an order. To successfully authorize payment for an
118
+ # order, the buyer must first approve the order or a valid payment_source
119
+ # must be provided in the request. A buyer can approve the order upon being
120
+ # redirected to the rel:approve URL that was returned in the HATEOAS links
121
+ # in the create order response. Note: For error handling and
76
122
  # troubleshooting, see Orders v2 errors.
77
123
  # @param [String] id Required parameter: The ID of the order for which to
78
- # show details.
124
+ # authorize.
79
125
  # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
80
126
  # uses a request header to invoke negative testing in the sandbox. This
81
127
  # header configures the sandbox into a negative testing state for
82
128
  # transactions that include the merchant.
129
+ # @param [String] paypal_request_id Optional parameter: The server stores
130
+ # keys for 6 hours. The API callers can request the times to up to 72 hours
131
+ # by speaking to their Account Manager. It is mandatory for all single-step
132
+ # create order calls (E.g. Create Order Request with payment source
133
+ # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
134
+ # etc).
135
+ # @param [String] prefer Optional parameter: The preferred server response
136
+ # upon successful completion of the request. Value is: return=minimal. The
137
+ # server returns a minimal response to optimize communication between the
138
+ # API caller and the server. A minimal response includes the id, status and
139
+ # HATEOAS links. return=representation. The server returns a complete
140
+ # resource representation, including the current state of the resource.
141
+ # @param [String] paypal_client_metadata_id Optional parameter: TODO: type
142
+ # description here
83
143
  # @param [String] paypal_auth_assertion Optional parameter: An
84
144
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
85
145
  # merchant. For details, see PayPal-Auth-Assertion.
86
- # @param [String] fields Optional parameter: A comma-separated list of
87
- # fields that should be returned for the order. Valid filter field is
88
- # `payment_source`.
146
+ # @param [OrderAuthorizeRequest] body Optional parameter: TODO: type
147
+ # description here
89
148
  # @return [ApiResponse] the complete http response with raw body and status code.
90
- def get_order(options = {})
149
+ def authorize_order(options = {})
91
150
  new_api_call_builder
92
- .request(new_request_builder(HttpMethodEnum::GET,
93
- '/v2/checkout/orders/{id}',
151
+ .request(new_request_builder(HttpMethodEnum::POST,
152
+ '/v2/checkout/orders/{id}/authorize',
94
153
  Server::DEFAULT)
95
154
  .template_param(new_parameter(options['id'], key: 'id')
96
155
  .should_encode(true))
156
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
97
157
  .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
158
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
159
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
160
+ .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
98
161
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
99
- .query_param(new_parameter(options['fields'], key: 'fields'))
162
+ .body_param(new_parameter(options['body']))
100
163
  .header_param(new_parameter('application/json', key: 'accept'))
164
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
101
165
  .auth(Single.new('Oauth2')))
102
166
  .response(new_response_handler
103
167
  .deserializer(APIHelper.method(:custom_type_deserializer))
104
- .deserialize_into(Order.method(:from_hash))
168
+ .deserialize_into(OrderAuthorizeResponse.method(:from_hash))
105
169
  .is_api_response(true)
170
+ .local_error('400',
171
+ 'Request is not well-formed, syntactically incorrect, or'\
172
+ ' violates schema.',
173
+ ErrorException)
106
174
  .local_error('401',
107
175
  'Authentication failed due to missing authorization header, or'\
108
176
  ' invalid authentication credentials.',
109
177
  ErrorException)
178
+ .local_error('403',
179
+ 'The authorized payment failed due to insufficient permissions'\
180
+ '.',
181
+ ErrorException)
110
182
  .local_error('404',
111
183
  'The specified resource does not exist.',
112
184
  ErrorException)
185
+ .local_error('422',
186
+ 'The requested action could not be performed, semantically'\
187
+ ' incorrect, or failed business validation.',
188
+ ErrorException)
189
+ .local_error('500',
190
+ 'An internal server error has occurred.',
191
+ ErrorException)
113
192
  .local_error('default',
114
193
  'The error response.',
115
194
  ErrorException))
116
195
  .execute
117
196
  end
118
197
 
119
- # Updates an order with a `CREATED` or `APPROVED` status. You cannot update
120
- # an order with the `COMPLETED` status. To make an update, you must provide
121
- # a `reference_id`. If you omit this value with an order that contains only
122
- # one purchase unit, PayPal sets the value to `default` which enables you to
123
- # use the path:
124
- # \"/purchase_units/@reference_id=='default'/{attribute-or-object}\".
125
- # Merchants and partners can add Level 2 and 3 data to payments to reduce
126
- # risk and payment processing costs. For more information about processing
127
- # payments, see checkout or multiparty checkout. Note: For error handling
128
- # and troubleshooting, see Orders v2 errors. Patchable attributes or
129
- # objects: Attribute Op Notes intent replace payer replace, add Using
130
- # replace op for payer will replace the whole payer object with the value
131
- # sent in request. purchase_units replace, add purchase_units[].custom_id
132
- # replace, add, remove purchase_units[].description replace, add, remove
133
- # purchase_units[].payee.email replace purchase_units[].shipping.name
134
- # replace, add purchase_units[].shipping.email_address replace, add
135
- # purchase_units[].shipping.phone_number replace, add
136
- # purchase_units[].shipping.options replace, add
137
- # purchase_units[].shipping.address replace, add
138
- # purchase_units[].shipping.type replace, add
139
- # purchase_units[].soft_descriptor replace, remove purchase_units[].amount
140
- # replace purchase_units[].items replace, add, remove
141
- # purchase_units[].invoice_id replace, add, remove
142
- # purchase_units[].payment_instruction replace
143
- # purchase_units[].payment_instruction.disbursement_mode replace By default,
144
- # disbursement_mode is INSTANT.
145
- # purchase_units[].payment_instruction.payee_receivable_fx_rate_id replace,
146
- # add, remove purchase_units[].payment_instruction.platform_fees replace,
147
- # add, remove purchase_units[].supplementary_data.airline replace, add,
148
- # remove purchase_units[].supplementary_data.card replace, add, remove
149
- # application_context.client_configuration replace, add
150
- # @param [String] id Required parameter: The ID of the order to update.
151
- # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
152
- # uses a request header to invoke negative testing in the sandbox. This
153
- # header configures the sandbox into a negative testing state for
154
- # transactions that include the merchant.
198
+ # Updates or cancels the tracking information for a PayPal order, by ID.
199
+ # Updatable attributes or objects: Attribute Op Notes items replace Using
200
+ # replace op for items will replace the entire items object with the value
201
+ # sent in request. notify_payer replace, add status replace Only patching
202
+ # status to CANCELLED is currently supported.
203
+ # @param [String] id Required parameter: The ID of the order that the
204
+ # tracking information is associated with.
205
+ # @param [String] tracker_id Required parameter: The order tracking ID.
155
206
  # @param [String] paypal_auth_assertion Optional parameter: An
156
207
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
157
208
  # merchant. For details, see PayPal-Auth-Assertion.
158
- # @param [Array[Patch]] body Optional parameter: Example:
209
+ # @param [Array[Patch]] body Optional parameter: TODO: type description
210
+ # here
159
211
  # @return [ApiResponse] the complete http response with raw body and status code.
160
- def patch_order(options = {})
212
+ def update_order_tracking(options = {})
161
213
  new_api_call_builder
162
214
  .request(new_request_builder(HttpMethodEnum::PATCH,
163
- '/v2/checkout/orders/{id}',
215
+ '/v2/checkout/orders/{id}/trackers/{tracker_id}',
164
216
  Server::DEFAULT)
165
217
  .template_param(new_parameter(options['id'], key: 'id')
166
218
  .should_encode(true))
219
+ .template_param(new_parameter(options['tracker_id'], key: 'tracker_id')
220
+ .should_encode(true))
167
221
  .header_param(new_parameter('application/json', key: 'Content-Type'))
168
- .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
169
222
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
170
223
  .body_param(new_parameter(options['body']))
171
224
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
@@ -177,9 +230,8 @@ module PaypalServerSdk
177
230
  'Request is not well-formed, syntactically incorrect, or'\
178
231
  ' violates schema.',
179
232
  ErrorException)
180
- .local_error('401',
181
- 'Authentication failed due to missing authorization header, or'\
182
- ' invalid authentication credentials.',
233
+ .local_error('403',
234
+ 'Authorization failed due to insufficient permissions.',
183
235
  ErrorException)
184
236
  .local_error('404',
185
237
  'The specified resource does not exist.',
@@ -188,40 +240,34 @@ module PaypalServerSdk
188
240
  'The requested action could not be performed, semantically'\
189
241
  ' incorrect, or failed business validation.',
190
242
  ErrorException)
243
+ .local_error('500',
244
+ 'An internal server error has occurred.',
245
+ ErrorException)
191
246
  .local_error('default',
192
247
  'The error response.',
193
248
  ErrorException))
194
249
  .execute
195
250
  end
196
251
 
197
- # Payer confirms their intent to pay for the the Order with the given
198
- # payment source.
199
- # @param [String] id Required parameter: The ID of the order for which the
200
- # payer confirms their intent to pay.
201
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
252
+ # Adds tracking information for an Order.
253
+ # @param [String] id Required parameter: The ID of the order that the
254
+ # tracking information is associated with.
255
+ # @param [OrderTrackerRequest] body Required parameter: TODO: type
256
+ # description here
202
257
  # @param [String] paypal_auth_assertion Optional parameter: An
203
258
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
204
259
  # merchant. For details, see PayPal-Auth-Assertion.
205
- # @param [String] prefer Optional parameter: The preferred server response
206
- # upon successful completion of the request. Value is: return=minimal. The
207
- # server returns a minimal response to optimize communication between the
208
- # API caller and the server. A minimal response includes the id, status and
209
- # HATEOAS links. return=representation. The server returns a complete
210
- # resource representation, including the current state of the resource.
211
- # @param [ConfirmOrderRequest] body Optional parameter: Example:
212
260
  # @return [ApiResponse] the complete http response with raw body and status code.
213
- def confirm_order(options = {})
261
+ def create_order_tracking(options = {})
214
262
  new_api_call_builder
215
263
  .request(new_request_builder(HttpMethodEnum::POST,
216
- '/v2/checkout/orders/{id}/confirm-payment-source',
264
+ '/v2/checkout/orders/{id}/track',
217
265
  Server::DEFAULT)
218
266
  .template_param(new_parameter(options['id'], key: 'id')
219
267
  .should_encode(true))
220
268
  .header_param(new_parameter('application/json', key: 'Content-Type'))
221
- .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
222
- .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
223
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
224
269
  .body_param(new_parameter(options['body']))
270
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
225
271
  .header_param(new_parameter('application/json', key: 'accept'))
226
272
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
227
273
  .auth(Single.new('Oauth2')))
@@ -236,6 +282,9 @@ module PaypalServerSdk
236
282
  .local_error('403',
237
283
  'Authorization failed due to insufficient permissions.',
238
284
  ErrorException)
285
+ .local_error('404',
286
+ 'The specified resource does not exist.',
287
+ ErrorException)
239
288
  .local_error('422',
240
289
  'The requested action could not be performed, semantically'\
241
290
  ' incorrect, or failed business validation.',
@@ -249,14 +298,12 @@ module PaypalServerSdk
249
298
  .execute
250
299
  end
251
300
 
252
- # Authorizes payment for an order. To successfully authorize payment for an
253
- # order, the buyer must first approve the order or a valid payment_source
254
- # must be provided in the request. A buyer can approve the order upon being
255
- # redirected to the rel:approve URL that was returned in the HATEOAS links
256
- # in the create order response. Note: For error handling and
257
- # troubleshooting, see Orders v2 errors.
258
- # @param [String] id Required parameter: The ID of the order for which to
259
- # authorize.
301
+ # Creates an order. Merchants and partners can add Level 2 and 3 data to
302
+ # payments to reduce risk and payment processing costs. For more information
303
+ # about processing payments, see checkout or multiparty checkout. Note: For
304
+ # error handling and troubleshooting, see Orders v2 errors.
305
+ # @param [OrderRequest] body Required parameter: TODO: type description
306
+ # here
260
307
  # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
261
308
  # uses a request header to invoke negative testing in the sandbox. This
262
309
  # header configures the sandbox into a negative testing state for
@@ -267,38 +314,39 @@ module PaypalServerSdk
267
314
  # create order calls (E.g. Create Order Request with payment source
268
315
  # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
269
316
  # etc).
317
+ # @param [String] paypal_partner_attribution_id Optional parameter: TODO:
318
+ # type description here
319
+ # @param [String] paypal_client_metadata_id Optional parameter: TODO: type
320
+ # description here
270
321
  # @param [String] prefer Optional parameter: The preferred server response
271
322
  # upon successful completion of the request. Value is: return=minimal. The
272
323
  # server returns a minimal response to optimize communication between the
273
324
  # API caller and the server. A minimal response includes the id, status and
274
325
  # HATEOAS links. return=representation. The server returns a complete
275
326
  # resource representation, including the current state of the resource.
276
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
277
327
  # @param [String] paypal_auth_assertion Optional parameter: An
278
328
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
279
329
  # merchant. For details, see PayPal-Auth-Assertion.
280
- # @param [OrderAuthorizeRequest] body Optional parameter: Example:
281
330
  # @return [ApiResponse] the complete http response with raw body and status code.
282
- def authorize_order(options = {})
331
+ def create_order(options = {})
283
332
  new_api_call_builder
284
333
  .request(new_request_builder(HttpMethodEnum::POST,
285
- '/v2/checkout/orders/{id}/authorize',
334
+ '/v2/checkout/orders',
286
335
  Server::DEFAULT)
287
- .template_param(new_parameter(options['id'], key: 'id')
288
- .should_encode(true))
289
336
  .header_param(new_parameter('application/json', key: 'Content-Type'))
337
+ .body_param(new_parameter(options['body']))
290
338
  .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
291
339
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
292
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
340
+ .header_param(new_parameter(options['paypal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id'))
293
341
  .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
342
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
294
343
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
295
- .body_param(new_parameter(options['body']))
296
344
  .header_param(new_parameter('application/json', key: 'accept'))
297
345
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
298
346
  .auth(Single.new('Oauth2')))
299
347
  .response(new_response_handler
300
348
  .deserializer(APIHelper.method(:custom_type_deserializer))
301
- .deserialize_into(OrderAuthorizeResponse.method(:from_hash))
349
+ .deserialize_into(Order.method(:from_hash))
302
350
  .is_api_response(true)
303
351
  .local_error('400',
304
352
  'Request is not well-formed, syntactically incorrect, or'\
@@ -308,20 +356,10 @@ module PaypalServerSdk
308
356
  'Authentication failed due to missing authorization header, or'\
309
357
  ' invalid authentication credentials.',
310
358
  ErrorException)
311
- .local_error('403',
312
- 'The authorized payment failed due to insufficient permissions'\
313
- '.',
314
- ErrorException)
315
- .local_error('404',
316
- 'The specified resource does not exist.',
317
- ErrorException)
318
359
  .local_error('422',
319
360
  'The requested action could not be performed, semantically'\
320
361
  ' incorrect, or failed business validation.',
321
362
  ErrorException)
322
- .local_error('500',
323
- 'An internal server error has occurred.',
324
- ErrorException)
325
363
  .local_error('default',
326
364
  'The error response.',
327
365
  ErrorException))
@@ -352,11 +390,13 @@ module PaypalServerSdk
352
390
  # API caller and the server. A minimal response includes the id, status and
353
391
  # HATEOAS links. return=representation. The server returns a complete
354
392
  # resource representation, including the current state of the resource.
355
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
393
+ # @param [String] paypal_client_metadata_id Optional parameter: TODO: type
394
+ # description here
356
395
  # @param [String] paypal_auth_assertion Optional parameter: An
357
396
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
358
397
  # merchant. For details, see PayPal-Auth-Assertion.
359
- # @param [OrderCaptureRequest] body Optional parameter: Example:
398
+ # @param [OrderCaptureRequest] body Optional parameter: TODO: type
399
+ # description here
360
400
  # @return [ApiResponse] the complete http response with raw body and status code.
361
401
  def capture_order(options = {})
362
402
  new_api_call_builder
@@ -407,83 +447,86 @@ module PaypalServerSdk
407
447
  .execute
408
448
  end
409
449
 
410
- # Adds tracking information for an Order.
411
- # @param [String] id Required parameter: The ID of the order that the
412
- # tracking information is associated with.
413
- # @param [OrderTrackerRequest] body Required parameter: Example:
450
+ # Shows details for an order, by ID. Note: For error handling and
451
+ # troubleshooting, see Orders v2 errors.
452
+ # @param [String] id Required parameter: The ID of the order for which to
453
+ # show details.
454
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
455
+ # uses a request header to invoke negative testing in the sandbox. This
456
+ # header configures the sandbox into a negative testing state for
457
+ # transactions that include the merchant.
414
458
  # @param [String] paypal_auth_assertion Optional parameter: An
415
459
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
416
460
  # merchant. For details, see PayPal-Auth-Assertion.
461
+ # @param [String] fields Optional parameter: A comma-separated list of
462
+ # fields that should be returned for the order. Valid filter field is
463
+ # `payment_source`.
417
464
  # @return [ApiResponse] the complete http response with raw body and status code.
418
- def create_order_tracking(options = {})
465
+ def get_order(options = {})
419
466
  new_api_call_builder
420
- .request(new_request_builder(HttpMethodEnum::POST,
421
- '/v2/checkout/orders/{id}/track',
467
+ .request(new_request_builder(HttpMethodEnum::GET,
468
+ '/v2/checkout/orders/{id}',
422
469
  Server::DEFAULT)
423
470
  .template_param(new_parameter(options['id'], key: 'id')
424
471
  .should_encode(true))
425
- .header_param(new_parameter('application/json', key: 'Content-Type'))
426
- .body_param(new_parameter(options['body']))
472
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
427
473
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
474
+ .query_param(new_parameter(options['fields'], key: 'fields'))
428
475
  .header_param(new_parameter('application/json', key: 'accept'))
429
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
430
476
  .auth(Single.new('Oauth2')))
431
477
  .response(new_response_handler
432
478
  .deserializer(APIHelper.method(:custom_type_deserializer))
433
479
  .deserialize_into(Order.method(:from_hash))
434
480
  .is_api_response(true)
435
- .local_error('400',
436
- 'Request is not well-formed, syntactically incorrect, or'\
437
- ' violates schema.',
438
- ErrorException)
439
- .local_error('403',
440
- 'Authorization failed due to insufficient permissions.',
481
+ .local_error('401',
482
+ 'Authentication failed due to missing authorization header, or'\
483
+ ' invalid authentication credentials.',
441
484
  ErrorException)
442
485
  .local_error('404',
443
486
  'The specified resource does not exist.',
444
487
  ErrorException)
445
- .local_error('422',
446
- 'The requested action could not be performed, semantically'\
447
- ' incorrect, or failed business validation.',
448
- ErrorException)
449
- .local_error('500',
450
- 'An internal server error has occurred.',
451
- ErrorException)
452
488
  .local_error('default',
453
489
  'The error response.',
454
490
  ErrorException))
455
491
  .execute
456
492
  end
457
493
 
458
- # Updates or cancels the tracking information for a PayPal order, by ID.
459
- # Updatable attributes or objects: Attribute Op Notes items replace Using
460
- # replace op for items will replace the entire items object with the value
461
- # sent in request. notify_payer replace, add status replace Only patching
462
- # status to CANCELLED is currently supported.
463
- # @param [String] id Required parameter: The ID of the order that the
464
- # tracking information is associated with.
465
- # @param [String] tracker_id Required parameter: The order tracking ID.
494
+ # Payer confirms their intent to pay for the the Order with the given
495
+ # payment source.
496
+ # @param [String] id Required parameter: The ID of the order for which the
497
+ # payer confirms their intent to pay.
498
+ # @param [String] paypal_client_metadata_id Optional parameter: TODO: type
499
+ # description here
466
500
  # @param [String] paypal_auth_assertion Optional parameter: An
467
501
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
468
502
  # merchant. For details, see PayPal-Auth-Assertion.
469
- # @param [Array[Patch]] body Optional parameter: Example:
503
+ # @param [String] prefer Optional parameter: The preferred server response
504
+ # upon successful completion of the request. Value is: return=minimal. The
505
+ # server returns a minimal response to optimize communication between the
506
+ # API caller and the server. A minimal response includes the id, status and
507
+ # HATEOAS links. return=representation. The server returns a complete
508
+ # resource representation, including the current state of the resource.
509
+ # @param [ConfirmOrderRequest] body Optional parameter: TODO: type
510
+ # description here
470
511
  # @return [ApiResponse] the complete http response with raw body and status code.
471
- def update_order_tracking(options = {})
512
+ def confirm_order(options = {})
472
513
  new_api_call_builder
473
- .request(new_request_builder(HttpMethodEnum::PATCH,
474
- '/v2/checkout/orders/{id}/trackers/{tracker_id}',
514
+ .request(new_request_builder(HttpMethodEnum::POST,
515
+ '/v2/checkout/orders/{id}/confirm-payment-source',
475
516
  Server::DEFAULT)
476
517
  .template_param(new_parameter(options['id'], key: 'id')
477
518
  .should_encode(true))
478
- .template_param(new_parameter(options['tracker_id'], key: 'tracker_id')
479
- .should_encode(true))
480
519
  .header_param(new_parameter('application/json', key: 'Content-Type'))
520
+ .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
481
521
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
522
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
482
523
  .body_param(new_parameter(options['body']))
524
+ .header_param(new_parameter('application/json', key: 'accept'))
483
525
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
484
526
  .auth(Single.new('Oauth2')))
485
527
  .response(new_response_handler
486
- .is_response_void(true)
528
+ .deserializer(APIHelper.method(:custom_type_deserializer))
529
+ .deserialize_into(Order.method(:from_hash))
487
530
  .is_api_response(true)
488
531
  .local_error('400',
489
532
  'Request is not well-formed, syntactically incorrect, or'\
@@ -492,9 +535,6 @@ module PaypalServerSdk
492
535
  .local_error('403',
493
536
  'Authorization failed due to insufficient permissions.',
494
537
  ErrorException)
495
- .local_error('404',
496
- 'The specified resource does not exist.',
497
- ErrorException)
498
538
  .local_error('422',
499
539
  'The requested action could not be performed, semantically'\
500
540
  ' incorrect, or failed business validation.',