paypal-rest-api 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dac5031d1b2e2fe6f58b269801cd0e818280d4ed9b54fafc948e1b758d99b87
4
- data.tar.gz: 4992abcc8678eca0bbc31702d49e6d6a596f7e614f3e8d6966a5716004adde26
3
+ metadata.gz: f8570bf045fe3986e03358401550d77f16dc5667c9da1c3e233fd07b95231c3e
4
+ data.tar.gz: e41098ed451a8997eff6bc0720f0c957c68fd843f8d2bee7b44cbd794c7913f0
5
5
  SHA512:
6
- metadata.gz: 63cc5c666b4483eb92bd6d5282173cb2841b517eb39762421c5c546b23d4c2b1e44fe689495aa75dca15f1a86ac66064e9db7fa77d4d389deb1f0e370de107aa
7
- data.tar.gz: 2e0e52e4fb9e324017f2af0fefe410daab14b01a3f7b322a686c00fb64ca8c1987bec7ece18958eb0c85327bb25f5f20e5fefdb5111043023efa29a049c8a893
6
+ metadata.gz: 193437cd7bf07228015eaead34a84952c14e02e3eca154df7df6df1eabcd28a26c4cc99a92ee16df03810b7c1c6824a4605fadf8e3008cf98053d1fa6cd1c883
7
+ data.tar.gz: dd2098b7c52ba4b8d1fc41a2152d7848168b7c831a2705acdfcacb5aab9ea3c80194401a2d883f7853fd8614cd4079c49788da0c6e7cfd35c614a7d41ff27f8c
data/README.md CHANGED
@@ -16,36 +16,66 @@ bundle add paypal-rest-api
16
16
 
17
17
  ## Usage
18
18
 
19
- - All APIs accept optional `:query`, `:body` and `:headers` keyword parameters.
20
- - Response has `#body` method to get parsed JSON body.
21
- This body has `symbolized` hash keys.
22
- - Response contains methods to get original HTTP response.
23
- - Failed request error (for non `2**` status codes) contains HTTP request and
24
- response
25
- - Failed request error (for network errors) contains request and original error
19
+ There are two options:
20
+
21
+ - Setting global client
22
+ - Setting local client (for possibility to use multiple PayPal environments)
23
+
24
+ ### Setting global client
26
25
 
27
26
  ```ruby
28
- # Initiate client
27
+ # in config/initializers/paypal_rest_api.rb
28
+ PaypalAPI.client = PaypalAPI::Client.new(
29
+ client_id: ENV['PAYPAL_CLIENT_ID'],
30
+ client_secret: ENV['PAYPAL_CLIENT_SECRET'],
31
+ live: false
32
+ )
33
+
34
+ # in your business logic
35
+ response = PaypalAPI::Orders.show(order_id)
36
+ response = PaypalAPI::Orders.create(body: body)
37
+ ```
38
+
39
+ ### Setting local client
40
+
41
+ ```ruby
42
+ # in your business logic
29
43
  client = PaypalAPI::Client.new(
30
44
  client_id: ENV['PAYPAL_CLIENT_ID'],
31
45
  client_secret: ENV['PAYPAL_CLIENT_SECRET'],
32
46
  live: false
33
47
  )
34
48
 
35
- # Usage example:
36
- response = client.orders.create(body: body)
37
49
  response = client.orders.show(order_id)
38
- response = client.authorized_payments.capture(authorization_id, headers: headers)
39
- response = client.webhooks.list(query: query)
50
+ response = client.orders.create(body: body)
51
+ ```
52
+
53
+ ### Client REST methods
54
+
55
+ Client can call HTTP methods directly:
40
56
 
41
- # Client also can send requests directly, bypassing specific resources methods
57
+ ```ruby
42
58
  response = client.post(path, query: query, body: body, headers: headers)
43
59
  response = client.get(path, query: query, body: body, headers: headers)
44
60
  response = client.patch(path, query: query, body: body, headers: headers)
45
61
  response = client.put(path, query: query, body: body, headers: headers)
46
62
  response = client.delete(path, query: query, body: body, headers: headers)
47
63
 
48
- # Getting response
64
+ # Or, after setting global client:
65
+ response = PaypalAPI.post(path, query: query, body: body, headers: headers)
66
+ response = PaypalAPI.get(path, query: query, body: body, headers: headers)
67
+ response = PaypalAPI.patch(path, query: query, body: body, headers: headers)
68
+ response = PaypalAPI.put(path, query: query, body: body, headers: headers)
69
+ response = PaypalAPI.delete(path, query: query, body: body, headers: headers)
70
+ ```
71
+
72
+ ### Parsing response
73
+
74
+ `response.body` is a main method that returns parsed JSON respoonse as a HASH.
75
+
76
+ There are also many others helpful methods:
77
+
78
+ ```
49
79
  response.body # Parsed JSON. JSON is parsed lazyly, keys are symbolized.
50
80
  response[:foo] # Gets :foo attribute from parsed body
51
81
  response.fetch(:foo) # Fetches :foo attribute from parsed body
@@ -56,32 +86,6 @@ response.http_headers # Hash with response headers (keys are strings)
56
86
  response.requested_at # Time when request was sent
57
87
  ```
58
88
 
59
- Also PaypalAPI client can be added globally and class methods can be used instead:
60
-
61
- ```ruby
62
- # in config/initializers/paypal_api.rb
63
- PaypalAPI.client = PaypalAPI::Client.new(
64
- client_id: ENV['PAYPAL_CLIENT_ID'],
65
- client_secret: ENV['PAYPAL_CLIENT_SECRET'],
66
- live: false
67
- )
68
-
69
- # in your business logic
70
- response = PaypalAPI.orders.create(body: body)
71
- response = PaypalAPI.webhooks.verify(body: body)
72
-
73
- # same
74
- PaypalAPI::Orders.create(body: body)
75
- PaypalAPI::Webhooks.verify(body: body)
76
-
77
- # Also now PaypalAPI class can be used as a client
78
- response = PaypalAPI.post(path, query: query, body: body, headers: headers)
79
- response = PaypalAPI.get(path, query: query, body: body, headers: headers)
80
- response = PaypalAPI.patch(path, query: query, body: body, headers: headers)
81
- response = PaypalAPI.put(path, query: query, body: body, headers: headers)
82
- response = PaypalAPI.delete(path, query: query, body: body, headers: headers)
83
- ```
84
-
85
89
  ## Configuration options
86
90
 
87
91
  PaypalAPI client accepts this additional options: `:live`, `:retries`, `:http_opts`
@@ -168,11 +172,12 @@ All errors have additional methods:
168
172
 
169
173
  ```ruby
170
174
  begin
171
- response = PaypalAPI.payments.capture(authorization_id, body: body)
175
+ response = PaypalAPI.authorized_payments.capture(authorization_id, body: body)
172
176
  rescue PaypalAPI::Error => error
173
177
  YourLogger.error(
174
178
  error,
175
179
  context: {
180
+ paypal_request_id: error.paypal_request_id,
176
181
  error_name: error.error_name,
177
182
  error_message: error.error_message,
178
183
  error_debug_id: error.error_debug_id,
@@ -184,17 +189,183 @@ end
184
189
 
185
190
  ```
186
191
 
192
+ ## APIs
193
+
194
+ All API endpoints accept this parameters:
195
+
196
+ - `resource_id` - Resource ID (Unless `create`/`list` endpoint)
197
+ - `query` - Hash with request query params
198
+ - `body` - Hash with request body params
199
+ - `headers` - Hash with request headers
200
+
201
+ ### Orders
202
+
203
+ - `PaypalAPI::Orders.create`
204
+ - `PaypalAPI::Orders.show`
205
+ - `PaypalAPI::Orders.update`
206
+ - `PaypalAPI::Orders.confirm`
207
+ - `PaypalAPI::Orders.authorize`
208
+ - `PaypalAPI::Orders.capture`
209
+ - `PaypalAPI::Orders.track`
210
+ - `PaypalAPI::Orders.update_tracker`
211
+
212
+ ### Payments
213
+
214
+ - `PaypalAPI::AuthorizedPayment.show`
215
+ - `PaypalAPI::AuthorizedPayment.capture`
216
+ - `PaypalAPI::AuthorizedPayment.reauthorize`
217
+ - `PaypalAPI::AuthorizedPayment.void`
218
+
219
+ <!-- -->
220
+
221
+ - `PaypalAPI::CapturedPayment.show`
222
+ - `PaypalAPI::CapturedPayment.refund`
223
+
224
+ <!-- -->
225
+
226
+ - `PaypalAPI::Refunds.show`
227
+
228
+ ### Webhooks
229
+
230
+ - `PaypalAPI::Webhooks.create`
231
+ - `PaypalAPI::Webhooks.list`
232
+ - `PaypalAPI::Webhooks.show`
233
+ - `PaypalAPI::Webhooks.update`
234
+ - `PaypalAPI::Webhooks.delete`
235
+ - `PaypalAPI::Webhooks.event_types`
236
+ - `PaypalAPI::Webhooks.verify`
237
+
238
+ <!-- -->
239
+
240
+ - `PaypalAPI::WebhookEvents.available`
241
+ - `PaypalAPI::WebhookEvents.list`
242
+ - `PaypalAPI::WebhookEvents.show`
243
+ - `PaypalAPI::WebhookEvents.resend`
244
+ - `PaypalAPI::WebhookEvents.simulate`
245
+
246
+ <!-- -->
247
+
248
+ - `PaypalAPI::WebhookLookups.create`
249
+ - `PaypalAPI::WebhookLookups.list`
250
+ - `PaypalAPI::WebhookLookups.show`
251
+ - `PaypalAPI::WebhookLookups.delete`
252
+
253
+ ### Subscriptions
254
+
255
+ - `PaypalAPI::Subscriptions.create`
256
+ - `PaypalAPI::Subscriptions.show`
257
+ - `PaypalAPI::Subscriptions.update`
258
+ - `PaypalAPI::Subscriptions.revise`
259
+ - `PaypalAPI::Subscriptions.suspend`
260
+ - `PaypalAPI::Subscriptions.cancel`
261
+ - `PaypalAPI::Subscriptions.activate`
262
+ - `PaypalAPI::Subscriptions.capture`
263
+ - `PaypalAPI::Subscriptions.transactions`
264
+
265
+ <!-- -->
266
+
267
+ - `PaypalAPI::SubscriptionPlans.create`
268
+ - `PaypalAPI::SubscriptionPlans.list`
269
+ - `PaypalAPI::SubscriptionPlans.show`
270
+ - `PaypalAPI::SubscriptionPlans.update`
271
+ - `PaypalAPI::SubscriptionPlans.activate`
272
+ - `PaypalAPI::SubscriptionPlans.deactivate`
273
+ - `PaypalAPI::SubscriptionPlans.update_pricing`
274
+
275
+ ### Shipment Tracking
276
+
277
+ - `PaypalAPI::ShipmentTracking.add`
278
+ - `PaypalAPI::ShipmentTracking.update`
279
+ - `PaypalAPI::ShipmentTracking.show`
280
+
281
+ ### Catalog Products
282
+
283
+ - `PaypalAPI::CatalogProducts.create`
284
+ - `PaypalAPI::CatalogProducts.list`
285
+ - `PaypalAPI::CatalogProducts.show`
286
+ - `PaypalAPI::CatalogProducts.update`
287
+
288
+ ### Disputes
289
+
290
+ - `PaypalAPI::Disputes.appeal`
291
+ - `PaypalAPI::Disputes.make_offer`
292
+ - `PaypalAPI::Disputes.show`
293
+ - `PaypalAPI::Disputes.update`
294
+ - `PaypalAPI::Disputes.send_message`
295
+ - `PaypalAPI::Disputes.provide_supporting_info`
296
+ - `PaypalAPI::Disputes.update_status`
297
+ - `PaypalAPI::Disputes.deny_offer`
298
+ - `PaypalAPI::Disputes.provide_evidence`
299
+ - `PaypalAPI::Disputes.settle`
300
+ - `PaypalAPI::Disputes.acknowledge_return_item`
301
+ - `PaypalAPI::Disputes.accept_claim`
302
+ - `PaypalAPI::Disputes.list`
303
+ - `PaypalAPI::Disputes.escalate`
304
+ - `PaypalAPI::Disputes.accept_offer`
305
+
306
+ ### UserInfo
307
+
308
+ - `PaypalAPI::UserInfo.show`
309
+
310
+ ### Users
311
+
312
+ - `PaypalAPI::Users.create`
313
+ - `PaypalAPI::Users.list`
314
+ - `PaypalAPI::Users.show`
315
+ - `PaypalAPI::Users.update`
316
+ - `PaypalAPI::Users.delete`
317
+
318
+ ### Invoices
319
+
320
+ - `PaypalAPI::Invoices.create`
321
+ - `PaypalAPI::Invoices.list`
322
+ - `PaypalAPI::Invoices.show`
323
+ - `PaypalAPI::Invoices.update`
324
+ - `PaypalAPI::Invoices.delete`
325
+ - `PaypalAPI::Invoices.search`
326
+ - `PaypalAPI::Invoices.remind`
327
+ - `PaypalAPI::Invoices.delete_refund`
328
+ - `PaypalAPI::Invoices.delete_payment`
329
+ - `PaypalAPI::Invoices.record_refund`
330
+ - `PaypalAPI::Invoices.record_payment`
331
+ - `PaypalAPI::Invoices.send_invoice`
332
+ - `PaypalAPI::Invoices.cancel`
333
+ - `PaypalAPI::Invoices.generate_qr_code`
334
+ - `PaypalAPI::Invoices.generate_invoice_number`
335
+
336
+ ### InvoiceTemplates
337
+
338
+ - `PaypalAPI::InvoiceTemplates.create`
339
+ - `PaypalAPI::InvoiceTemplates.list`
340
+ - `PaypalAPI::InvoiceTemplates.show`
341
+ - `PaypalAPI::InvoiceTemplates.update`
342
+ - `PaypalAPI::InvoiceTemplates.delete`
343
+
344
+ ### Payouts
345
+
346
+ - `PaypalAPI::Payouts.create`
347
+ - `PaypalAPI::Payouts.show`
348
+ - `PaypalAPI::PayoutItems.show`
349
+ - `PaypalAPI::PayoutItems.cancel`
350
+
351
+ ### ReferencedPayouts
352
+
353
+ - `PaypalAPI::ReferencedPayouts.create`
354
+ - `PaypalAPI::ReferencedPayouts.show`
355
+ - `PaypalAPI::ReferencedPayoutItems.create`
356
+ - `PaypalAPI::ReferencedPayoutItems.show`
357
+
187
358
  ## Development
188
359
 
189
360
  ```bash
190
- bundle install
191
361
  rubocop
192
362
  rspec
363
+ mdl README.md CHANGELOG.md RELEASE.md
193
364
  ```
194
365
 
195
366
  ## Contributing
196
367
 
197
- Bug reports and pull requests are welcome on GitHub at <https://github.com/aglushkov/paypal-api>.
368
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/aglushkov/paypal-rest-api>.
198
369
 
199
370
  ## License
200
371
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -4,8 +4,20 @@ module PaypalAPI
4
4
  #
5
5
  # AccessToken object stores authorization string and its expire time.
6
6
  #
7
+ # @api private
8
+ #
7
9
  class AccessToken
8
- attr_reader :requested_at, :expires_at, :authorization_string
10
+ # Time when access token request was sent
11
+ # @return [Time] Time
12
+ attr_reader :requested_at
13
+
14
+ # Time when access token request expires
15
+ # @return [Time] Time
16
+ attr_reader :expires_at
17
+
18
+ # Authorization string
19
+ # @return [String] Authorization string
20
+ attr_reader :authorization_string
9
21
 
10
22
  #
11
23
  # Initializes AccessToken object
@@ -32,7 +44,9 @@ module PaypalAPI
32
44
  end
33
45
 
34
46
  #
35
- # Instance representation string. Default was overwritten to hide original access_token
47
+ # Instance representation string
48
+ #
49
+ # @return [String] Inspect value
36
50
  #
37
51
  def inspect
38
52
  "#<#{self.class.name} methods: (requested_at, expires_at, expired?, authorization_string)>"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "uri"
4
+
3
5
  module PaypalAPI
4
6
  #
5
7
  # Base class for all PayPal API collections classes
@@ -22,5 +24,32 @@ module PaypalAPI
22
24
  def self.client
23
25
  PaypalAPI.client
24
26
  end
27
+
28
+ # Encodes URI component
29
+ # @param id [String] Unencoded URI component
30
+ # @return [String] Encoded URI component
31
+ def encode(id)
32
+ self.class.encode(id)
33
+ end
34
+
35
+ # :nocov:
36
+ if URI.respond_to?(:encode_uri_component)
37
+ # Encodes URI component
38
+ # @param id [String] Unencoded URI component
39
+ # @return [String] Encoded URI component
40
+ def self.encode(id)
41
+ URI.encode_uri_component(id)
42
+ end
43
+ else
44
+ # Encodes URI component
45
+ # @param id [String] Unencoded URI component
46
+ # @return [String] Encoded URI component
47
+ def self.encode(id)
48
+ encoded_id = URI.encode_www_form_component(id)
49
+ encoded_id.gsub!("+", "%20")
50
+ encoded_id
51
+ end
52
+ end
53
+ # :nocov:
25
54
  end
26
55
  end
@@ -26,7 +26,7 @@ module PaypalAPI
26
26
  # @macro request
27
27
  #
28
28
  def show(authorization_id, query: nil, body: nil, headers: nil)
29
- client.get("/v2/payments/authorizations/#{authorization_id}", query: query, body: body, headers: headers)
29
+ client.get("/v2/payments/authorizations/#{encode(authorization_id)}", query: query, body: body, headers: headers)
30
30
  end
31
31
 
32
32
  #
@@ -38,7 +38,7 @@ module PaypalAPI
38
38
  # @macro request
39
39
  #
40
40
  def capture(authorization_id, query: nil, body: nil, headers: nil)
41
- client.post("/v2/payments/authorizations/#{authorization_id}/capture", query: query, body: body, headers: headers)
41
+ client.post("/v2/payments/authorizations/#{encode(authorization_id)}/capture", query: query, body: body, headers: headers)
42
42
  end
43
43
 
44
44
  # Reauthorize authorized payment
@@ -49,7 +49,7 @@ module PaypalAPI
49
49
  # @macro request
50
50
  #
51
51
  def reauthorize(authorization_id, query: nil, body: nil, headers: nil)
52
- client.post("/v2/payments/authorizations/#{authorization_id}/reauthorize", query: query, body: body, headers: headers)
52
+ client.post("/v2/payments/authorizations/#{encode(authorization_id)}/reauthorize", query: query, body: body, headers: headers)
53
53
  end
54
54
 
55
55
  # Void authorized payment
@@ -60,7 +60,7 @@ module PaypalAPI
60
60
  # @macro request
61
61
  #
62
62
  def void(authorization_id, query: nil, body: nil, headers: nil)
63
- client.post("/v2/payments/authorizations/#{authorization_id}/void", query: query, body: body, headers: headers)
63
+ client.post("/v2/payments/authorizations/#{encode(authorization_id)}/void", query: query, body: body, headers: headers)
64
64
  end
65
65
  end
66
66
 
@@ -26,7 +26,7 @@ module PaypalAPI
26
26
  # @macro request
27
27
  #
28
28
  def show(capture_id, query: nil, body: nil, headers: nil)
29
- client.get("/v2/payments/captures/#{capture_id}", query: query, body: body, headers: headers)
29
+ client.get("/v2/payments/captures/#{encode(capture_id)}", query: query, body: body, headers: headers)
30
30
  end
31
31
 
32
32
  #
@@ -38,7 +38,7 @@ module PaypalAPI
38
38
  # @macro request
39
39
  #
40
40
  def refund(capture_id, query: nil, body: nil, headers: nil)
41
- client.post("/v2/payments/captures/#{capture_id}/refund", query: query, body: body, headers: headers)
41
+ client.post("/v2/payments/captures/#{encode(capture_id)}/refund", query: query, body: body, headers: headers)
42
42
  end
43
43
  end
44
44
 
@@ -48,7 +48,7 @@ module PaypalAPI
48
48
  # @macro request
49
49
  #
50
50
  def show(product_id, query: nil, body: nil, headers: nil)
51
- client.get("/v1/catalogs/products/#{product_id}", query: query, body: body, headers: headers)
51
+ client.get("/v1/catalogs/products/#{encode(product_id)}", query: query, body: body, headers: headers)
52
52
  end
53
53
 
54
54
  #
@@ -60,7 +60,7 @@ module PaypalAPI
60
60
  # @macro request
61
61
  #
62
62
  def update(product_id, query: nil, body: nil, headers: nil)
63
- client.patch("/v1/catalogs/products/#{product_id}", query: query, body: body, headers: headers)
63
+ client.patch("/v1/catalogs/products/#{encode(product_id)}", query: query, body: body, headers: headers)
64
64
  end
65
65
  end
66
66
 
@@ -0,0 +1,188 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PaypalAPI
4
+ #
5
+ # Manages customer disputes
6
+ #
7
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/
8
+ #
9
+ class Disputes < APICollection
10
+ #
11
+ # Common class and instance methods
12
+ #
13
+ module APIs
14
+ # @!macro [new] request
15
+ # @param query [Hash, nil] Request query parameters
16
+ # @param body [Hash, nil] Request body parameters
17
+ # @param headers [Hash, nil] Request headers
18
+ # @return [Response] Response object
19
+
20
+ #
21
+ # Appeal dispute
22
+ #
23
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_appeal
24
+ # @param dispute_id [String] Dispute ID
25
+ # @macro request
26
+ #
27
+ def appeal(dispute_id, query: nil, body: nil, headers: nil)
28
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/appeal", query: query, body: body, headers: headers)
29
+ end
30
+
31
+ #
32
+ # Make offer to resolve dispute
33
+ #
34
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_make-offer
35
+ # @param dispute_id [String] Dispute ID
36
+ # @macro request
37
+ #
38
+ def make_offer(dispute_id, query: nil, body: nil, headers: nil)
39
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/make-offer", query: query, body: body, headers: headers)
40
+ end
41
+
42
+ #
43
+ # Show dispute details
44
+ #
45
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_get
46
+ # @param dispute_id [String] Dispute ID
47
+ # @macro request
48
+ #
49
+ def show(dispute_id, query: nil, body: nil, headers: nil)
50
+ client.get("/v1/customer/disputes/#{encode(dispute_id)}", query: query, body: body, headers: headers)
51
+ end
52
+
53
+ #
54
+ # Update dispute
55
+ #
56
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_patch
57
+ # @param dispute_id [String] Dispute ID
58
+ # @macro request
59
+ #
60
+ def update(dispute_id, query: nil, body: nil, headers: nil)
61
+ client.patch("/v1/customer/disputes/#{encode(dispute_id)}", query: query, body: body, headers: headers)
62
+ end
63
+
64
+ #
65
+ # Send message about dispute to other party
66
+ #
67
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_send-message
68
+ # @param dispute_id [String] Dispute ID
69
+ # @macro request
70
+ #
71
+ def send_message(dispute_id, query: nil, body: nil, headers: nil)
72
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/send-message", query: query, body: body, headers: headers)
73
+ end
74
+
75
+ #
76
+ # Provide supporting information for dispute
77
+ #
78
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_provide-supporting-info
79
+ # @param dispute_id [String] Dispute ID
80
+ # @macro request
81
+ #
82
+ def provide_supporting_info(dispute_id, query: nil, body: nil, headers: nil)
83
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/provide-supporting-info", query: query, body: body, headers: headers)
84
+ end
85
+
86
+ #
87
+ # Update dispute status
88
+ #
89
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_require-evidence
90
+ # @param dispute_id [String] Dispute ID
91
+ # @macro request
92
+ #
93
+ def update_status(dispute_id, query: nil, body: nil, headers: nil)
94
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/require-evidence", query: query, body: body, headers: headers)
95
+ end
96
+
97
+ #
98
+ # Deny offer to resolve dispute
99
+ #
100
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_deny-offer
101
+ # @param dispute_id [String] Dispute ID
102
+ # @macro request
103
+ #
104
+ def deny_offer(dispute_id, query: nil, body: nil, headers: nil)
105
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/deny-offer", query: query, body: body, headers: headers)
106
+ end
107
+
108
+ #
109
+ # Provide evidence
110
+ #
111
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_provide-evidence
112
+ # @param dispute_id [String] Dispute ID
113
+ # @macro request
114
+ #
115
+ def provide_evidence(dispute_id, query: nil, body: nil, headers: nil)
116
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/provide-evidence", query: query, body: body, headers: headers)
117
+ end
118
+
119
+ #
120
+ # Settle dispute
121
+ #
122
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_adjudicate
123
+ # @param dispute_id [String] Dispute ID
124
+ # @macro request
125
+ #
126
+ def settle(dispute_id, query: nil, body: nil, headers: nil)
127
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/adjudicate", query: query, body: body, headers: headers)
128
+ end
129
+
130
+ #
131
+ # Acknowledge returned item
132
+ #
133
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_acknowledge-return-item
134
+ # @param dispute_id [String] Dispute ID
135
+ # @macro request
136
+ #
137
+ def acknowledge_return_item(dispute_id, query: nil, body: nil, headers: nil)
138
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/acknowledge-return-item", query: query, body: body, headers: headers)
139
+ end
140
+
141
+ #
142
+ # Accept claim
143
+ #
144
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_accept-claim
145
+ # @param dispute_id [String] Dispute ID
146
+ # @macro request
147
+ #
148
+ def accept_claim(dispute_id, query: nil, body: nil, headers: nil)
149
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/accept-claim", query: query, body: body, headers: headers)
150
+ end
151
+
152
+ #
153
+ # List disputes
154
+ #
155
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_list
156
+ # @macro request
157
+ #
158
+ def list(query: nil, body: nil, headers: nil)
159
+ client.get("/v1/customer/disputes", query: query, body: body, headers: headers)
160
+ end
161
+
162
+ #
163
+ # Escalate dispute to claim
164
+ #
165
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_escalate
166
+ # @param dispute_id [String] Dispute ID
167
+ # @macro request
168
+ #
169
+ def escalate(dispute_id, query: nil, body: nil, headers: nil)
170
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/escalate", query: query, body: body, headers: headers)
171
+ end
172
+
173
+ #
174
+ # Accept offer to resolve dispute
175
+ #
176
+ # @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_accept-offer
177
+ # @param dispute_id [String] Dispute ID
178
+ # @macro request
179
+ #
180
+ def accept_offer(dispute_id, query: nil, body: nil, headers: nil)
181
+ client.post("/v1/customer/disputes/#{encode(dispute_id)}/accept-offer", query: query, body: body, headers: headers)
182
+ end
183
+ end
184
+
185
+ include APIs
186
+ extend APIs
187
+ end
188
+ end