paypal-rest-api 0.0.3 → 0.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 +320 -44
  3. data/VERSION +1 -1
  4. data/lib/paypal-api/access_token.rb +16 -2
  5. data/lib/paypal-api/api_collection.rb +29 -0
  6. data/lib/paypal-api/api_collections/authorized_payments.rb +4 -4
  7. data/lib/paypal-api/api_collections/captured_payments.rb +2 -2
  8. data/lib/paypal-api/api_collections/catalog_products.rb +2 -2
  9. data/lib/paypal-api/api_collections/disputes.rb +188 -0
  10. data/lib/paypal-api/api_collections/invoice_templates.rb +82 -0
  11. data/lib/paypal-api/api_collections/invoices.rb +196 -0
  12. data/lib/paypal-api/api_collections/orders.rb +7 -7
  13. data/lib/paypal-api/api_collections/payout_items.rb +47 -0
  14. data/lib/paypal-api/api_collections/payouts.rb +47 -0
  15. data/lib/paypal-api/api_collections/referenced_payout_items.rb +47 -0
  16. data/lib/paypal-api/api_collections/referenced_payouts.rb +47 -0
  17. data/lib/paypal-api/api_collections/refunds.rb +1 -1
  18. data/lib/paypal-api/api_collections/shipment_tracking.rb +2 -2
  19. data/lib/paypal-api/api_collections/subscription_plans.rb +106 -0
  20. data/lib/paypal-api/api_collections/subscriptions.rb +16 -98
  21. data/lib/paypal-api/api_collections/user_info.rb +47 -0
  22. data/lib/paypal-api/api_collections/users.rb +96 -0
  23. data/lib/paypal-api/api_collections/webhook_events.rb +78 -0
  24. data/lib/paypal-api/api_collections/webhook_lookups.rb +68 -0
  25. data/lib/paypal-api/api_collections/webhooks.rb +5 -108
  26. data/lib/paypal-api/client.rb +129 -5
  27. data/lib/paypal-api/config.rb +6 -2
  28. data/lib/paypal-api/request.rb +53 -21
  29. data/lib/paypal-api/request_executor.rb +81 -66
  30. data/lib/paypal-api/response.rb +42 -5
  31. data/lib/paypal-api/webhook_verifier/certs_cache.rb +75 -0
  32. data/lib/paypal-api/webhook_verifier.rb +104 -0
  33. data/lib/paypal-api.rb +120 -12
  34. metadata +17 -3
@@ -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
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PaypalAPI
4
+ #
5
+ # Manages invoice templates
6
+ #
7
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/
8
+ #
9
+ class InvoiceTemplates < 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
+ # Create invoice template
22
+ #
23
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#templates_create
24
+ #
25
+ # @macro request
26
+ #
27
+ def create(query: nil, body: nil, headers: nil)
28
+ client.post("/v2/invoicing/templates", query: query, body: body, headers: headers)
29
+ end
30
+
31
+ #
32
+ # List templates
33
+ #
34
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#templates_list
35
+ #
36
+ # @macro request
37
+ #
38
+ def list(query: nil, body: nil, headers: nil)
39
+ client.get("/v2/invoicing/templates", query: query, body: body, headers: headers)
40
+ end
41
+
42
+ #
43
+ # Show template details
44
+ #
45
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#templates_get
46
+ #
47
+ # @param template_id [String] Template ID
48
+ # @macro request
49
+ #
50
+ def show(template_id, query: nil, body: nil, headers: nil)
51
+ client.get("/v2/invoicing/templates/#{encode(template_id)}", query: query, body: body, headers: headers)
52
+ end
53
+
54
+ #
55
+ # Fully update template
56
+ #
57
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#templates_update
58
+ #
59
+ # @param template_id [String] Template ID
60
+ # @macro request
61
+ #
62
+ def update(template_id, query: nil, body: nil, headers: nil)
63
+ client.put("/v2/invoicing/templates/#{encode(template_id)}", query: query, body: body, headers: headers)
64
+ end
65
+
66
+ #
67
+ # Fully update template
68
+ #
69
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#templates_delete
70
+ #
71
+ # @param template_id [String] Template ID
72
+ # @macro request
73
+ #
74
+ def delete(template_id, query: nil, body: nil, headers: nil)
75
+ client.delete("/v2/invoicing/templates/#{encode(template_id)}", query: query, body: body, headers: headers)
76
+ end
77
+ end
78
+
79
+ include APIs
80
+ extend APIs
81
+ end
82
+ end
@@ -0,0 +1,196 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PaypalAPI
4
+ #
5
+ # Manages invoice templates
6
+ #
7
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/
8
+ #
9
+ class Invoices < 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
+ # Create draft invoice
22
+ #
23
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_create
24
+ #
25
+ # @macro request
26
+ #
27
+ def create(query: nil, body: nil, headers: nil)
28
+ client.post("/v2/invoicing/invoices", query: query, body: body, headers: headers)
29
+ end
30
+
31
+ #
32
+ # List invoices
33
+ #
34
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_list
35
+ #
36
+ # @macro request
37
+ #
38
+ def list(query: nil, body: nil, headers: nil)
39
+ client.get("/v2/invoicing/invoices", query: query, body: body, headers: headers)
40
+ end
41
+
42
+ #
43
+ # Show invoice details
44
+ #
45
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_get
46
+ # @param invoice_id [String] Invoice ID
47
+ # @macro request
48
+ #
49
+ def show(invoice_id, query: nil, body: nil, headers: nil)
50
+ client.get("/v2/invoicing/invoices/#{encode(invoice_id)}", query: query, body: body, headers: headers)
51
+ end
52
+
53
+ #
54
+ # Fully update invoice
55
+ #
56
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_update
57
+ # @param invoice_id [String] Invoice ID
58
+ # @macro request
59
+ #
60
+ def update(invoice_id, query: nil, body: nil, headers: nil)
61
+ client.put("/v2/invoicing/invoices/#{encode(invoice_id)}", query: query, body: body, headers: headers)
62
+ end
63
+
64
+ #
65
+ # Delete invoice
66
+ #
67
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_delete
68
+ # @param invoice_id [String] Invoice ID
69
+ # @macro request
70
+ #
71
+ def delete(invoice_id, query: nil, body: nil, headers: nil)
72
+ client.delete("/v2/invoicing/invoices/#{encode(invoice_id)}", query: query, body: body, headers: headers)
73
+ end
74
+
75
+ #
76
+ # Search for invoices
77
+ #
78
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_search-invoices
79
+ #
80
+ # @macro request
81
+ #
82
+ def search(query: nil, body: nil, headers: nil)
83
+ client.post("/v2/invoicing/search-invoices", query: query, body: body, headers: headers)
84
+ end
85
+
86
+ #
87
+ # Send invoice reminder
88
+ #
89
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_remind
90
+ # @param invoice_id [String] Invoice ID
91
+ # @macro request
92
+ #
93
+ def remind(invoice_id, query: nil, body: nil, headers: nil)
94
+ client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/remind", query: query, body: body, headers: headers)
95
+ end
96
+
97
+ #
98
+ # Delete external refund
99
+ #
100
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_refunds-delete
101
+ # @param invoice_id [String] Invoice ID
102
+ # @param transaction_id [String] The ID of the external refund transaction to delete.
103
+ # @macro request
104
+ #
105
+ def delete_refund(invoice_id, transaction_id, query: nil, body: nil, headers: nil)
106
+ client.delete(
107
+ "/v2/invoicing/invoices/#{encode(invoice_id)}/refunds/#{encode(transaction_id)}",
108
+ query: query, body: body, headers: headers
109
+ )
110
+ end
111
+
112
+ #
113
+ # Delete external payment
114
+ #
115
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_payment-delete
116
+ # @param invoice_id [String] Invoice ID
117
+ # @param transaction_id [String] The ID of the external payment transaction to delete.
118
+ # @macro request
119
+ #
120
+ def delete_payment(invoice_id, transaction_id, query: nil, body: nil, headers: nil)
121
+ client.delete(
122
+ "/v2/invoicing/invoices/#{encode(invoice_id)}/payments/#{encode(transaction_id)}",
123
+ query: query, body: body, headers: headers
124
+ )
125
+ end
126
+
127
+ #
128
+ # Record payment for invoice
129
+ #
130
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_payments
131
+ # @param invoice_id [String] Invoice ID
132
+ # @macro request
133
+ #
134
+ def record_payment(invoice_id, query: nil, body: nil, headers: nil)
135
+ client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/payments", query: query, body: body, headers: headers)
136
+ end
137
+
138
+ #
139
+ # Record refund for invoice
140
+ #
141
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_refunds
142
+ # @param invoice_id [String] Invoice ID
143
+ # @macro request
144
+ #
145
+ def record_refund(invoice_id, query: nil, body: nil, headers: nil)
146
+ client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/refunds", query: query, body: body, headers: headers)
147
+ end
148
+
149
+ #
150
+ # Send invoice
151
+ #
152
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_send
153
+ # @param invoice_id [String] Invoice ID
154
+ # @macro request
155
+ #
156
+ def send_invoice(invoice_id, query: nil, body: nil, headers: nil)
157
+ client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/send", query: query, body: body, headers: headers)
158
+ end
159
+
160
+ #
161
+ # Cancel sent invoice
162
+ #
163
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_cancel
164
+ # @param invoice_id [String] Invoice ID
165
+ # @macro request
166
+ #
167
+ def cancel(invoice_id, query: nil, body: nil, headers: nil)
168
+ client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/cancel", query: query, body: body, headers: headers)
169
+ end
170
+
171
+ #
172
+ # Generate QR code
173
+ #
174
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_generate-qr-code
175
+ # @param invoice_id [String] Invoice ID
176
+ # @macro request
177
+ #
178
+ def generate_qr_code(invoice_id, query: nil, body: nil, headers: nil)
179
+ client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/generate-qr-code", query: query, body: body, headers: headers)
180
+ end
181
+
182
+ #
183
+ # Generate invoice number
184
+ #
185
+ # @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_generate-next-invoice-number
186
+ # @macro request
187
+ #
188
+ def generate_invoice_number(query: nil, body: nil, headers: nil)
189
+ client.post("/v2/invoicing/generate-next-invoice-number", query: query, body: body, headers: headers)
190
+ end
191
+ end
192
+
193
+ include APIs
194
+ extend APIs
195
+ end
196
+ end
@@ -37,7 +37,7 @@ module PaypalAPI
37
37
  # @macro request
38
38
  #
39
39
  def show(id, query: nil, body: nil, headers: nil)
40
- client.get("/v2/checkout/orders/#{id}", query: query, body: body, headers: headers)
40
+ client.get("/v2/checkout/orders/#{encode(id)}", query: query, body: body, headers: headers)
41
41
  end
42
42
 
43
43
  #
@@ -49,7 +49,7 @@ module PaypalAPI
49
49
  # @macro request
50
50
  #
51
51
  def update(id, query: nil, body: nil, headers: nil)
52
- client.patch("/v2/checkout/orders/#{id}", query: query, body: body, headers: headers)
52
+ client.patch("/v2/checkout/orders/#{encode(id)}", query: query, body: body, headers: headers)
53
53
  end
54
54
 
55
55
  #
@@ -61,7 +61,7 @@ module PaypalAPI
61
61
  # @macro request
62
62
  #
63
63
  def confirm(id, query: nil, body: nil, headers: nil)
64
- client.post("/v2/checkout/orders/#{id}/confirm-payment-source", query: query, body: body, headers: headers)
64
+ client.post("/v2/checkout/orders/#{encode(id)}/confirm-payment-source", query: query, body: body, headers: headers)
65
65
  end
66
66
 
67
67
  #
@@ -73,7 +73,7 @@ module PaypalAPI
73
73
  # @macro request
74
74
  #
75
75
  def authorize(id, query: nil, body: nil, headers: nil)
76
- client.post("/v2/checkout/orders/#{id}/authorize", query: query, body: body, headers: headers)
76
+ client.post("/v2/checkout/orders/#{encode(id)}/authorize", query: query, body: body, headers: headers)
77
77
  end
78
78
 
79
79
  #
@@ -85,7 +85,7 @@ module PaypalAPI
85
85
  # @macro request
86
86
  #
87
87
  def capture(id, query: nil, body: nil, headers: nil)
88
- client.post("/v2/checkout/orders/#{id}/capture", query: query, body: body, headers: headers)
88
+ client.post("/v2/checkout/orders/#{encode(id)}/capture", query: query, body: body, headers: headers)
89
89
  end
90
90
 
91
91
  #
@@ -97,7 +97,7 @@ module PaypalAPI
97
97
  # @macro request
98
98
  #
99
99
  def track(id, query: nil, body: nil, headers: nil)
100
- client.post("/v2/checkout/orders/#{id}/track", query: query, body: body, headers: headers)
100
+ client.post("/v2/checkout/orders/#{encode(id)}/track", query: query, body: body, headers: headers)
101
101
  end
102
102
 
103
103
  #
@@ -110,7 +110,7 @@ module PaypalAPI
110
110
  # @macro request
111
111
  #
112
112
  def update_tracker(id, tracker_id, query: nil, body: nil, headers: nil)
113
- client.patch("/v2/checkout/orders/#{id}/trackers/#{tracker_id}", query: query, body: body, headers: headers)
113
+ client.patch("/v2/checkout/orders/#{encode(id)}/trackers/#{encode(tracker_id)}", query: query, body: body, headers: headers)
114
114
  end
115
115
  end
116
116
 
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PaypalAPI
4
+ #
5
+ # Makes payments to multiple PayPal or Venmo recipients
6
+ #
7
+ # @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/
8
+ #
9
+ class PayoutItems < 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
+ # Cancel unclaimed payout item
22
+ #
23
+ # @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts-item_cancel
24
+ # @param payout_item_id [String] The ID of the payout item to cancel
25
+ # @macro request
26
+ #
27
+ def cancel(payout_item_id, query: nil, body: nil, headers: nil)
28
+ client.post("/v1/payments/payouts-item/#{encode(payout_item_id)}/cancel", query: query, body: body, headers: headers)
29
+ end
30
+
31
+ #
32
+ # Show payout item details
33
+ #
34
+ # @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts-item_get
35
+ #
36
+ # @param payout_item_id [String] The ID of the payout item
37
+ # @macro request
38
+ #
39
+ def show(payout_item_id, query: nil, body: nil, headers: nil)
40
+ client.get("/v1/payments/payouts-item/#{encode(payout_item_id)}", query: query, body: body, headers: headers)
41
+ end
42
+ end
43
+
44
+ include APIs
45
+ extend APIs
46
+ end
47
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PaypalAPI
4
+ #
5
+ # Makes payments to multiple PayPal or Venmo recipients
6
+ #
7
+ # @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/
8
+ #
9
+ class Payouts < 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
+ # Create batch payout
22
+ #
23
+ # @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts_post
24
+ #
25
+ # @macro request
26
+ #
27
+ def create(query: nil, body: nil, headers: nil)
28
+ client.post("/v1/payments/payouts", query: query, body: body, headers: headers)
29
+ end
30
+
31
+ #
32
+ # Show payout batch details
33
+ #
34
+ # @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts_get
35
+ #
36
+ # @param payout_batch_id [String] The ID of the payout for which to show details.
37
+ # @macro request
38
+ #
39
+ def show(payout_batch_id, query: nil, body: nil, headers: nil)
40
+ client.get("/v1/payments/payouts/#{encode(payout_batch_id)}", query: query, body: body, headers: headers)
41
+ end
42
+ end
43
+
44
+ include APIs
45
+ extend APIs
46
+ end
47
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PaypalAPI
4
+ #
5
+ # Enables partner merchants and developers to process individual referenced payouts to recipients.
6
+ #
7
+ # @seehttps://developer.paypal.com/docs/api/referenced-payouts/v1/
8
+ #
9
+ class ReferencedPayoutItems < 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
+ # Create referenced payout item
22
+ #
23
+ # @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts-items_create
24
+ #
25
+ # @macro request
26
+ #
27
+ def create(query: nil, body: nil, headers: nil)
28
+ client.post("/v1/payments/referenced-payouts-items", query: query, body: body, headers: headers)
29
+ end
30
+
31
+ #
32
+ # Show referenced payout item details
33
+ #
34
+ # @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts-items_get
35
+ #
36
+ # @param payouts_item_id [String] The ID of the referenced payout item for which to show details.
37
+ # @macro request
38
+ #
39
+ def show(payouts_item_id, query: nil, body: nil, headers: nil)
40
+ client.get("/v1/payments/referenced-payouts-items/#{encode(payouts_item_id)}", query: query, body: body, headers: headers)
41
+ end
42
+ end
43
+
44
+ include APIs
45
+ extend APIs
46
+ end
47
+ end