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 +4 -4
- data/README.md +214 -43
- data/VERSION +1 -1
- data/lib/paypal-api/access_token.rb +16 -2
- data/lib/paypal-api/api_collection.rb +29 -0
- data/lib/paypal-api/api_collections/authorized_payments.rb +4 -4
- data/lib/paypal-api/api_collections/captured_payments.rb +2 -2
- data/lib/paypal-api/api_collections/catalog_products.rb +2 -2
- data/lib/paypal-api/api_collections/disputes.rb +188 -0
- data/lib/paypal-api/api_collections/invoice_templates.rb +82 -0
- data/lib/paypal-api/api_collections/invoices.rb +196 -0
- data/lib/paypal-api/api_collections/orders.rb +7 -7
- data/lib/paypal-api/api_collections/payout_items.rb +47 -0
- data/lib/paypal-api/api_collections/payouts.rb +47 -0
- data/lib/paypal-api/api_collections/referenced_payout_items.rb +47 -0
- data/lib/paypal-api/api_collections/referenced_payouts.rb +47 -0
- data/lib/paypal-api/api_collections/refunds.rb +1 -1
- data/lib/paypal-api/api_collections/shipment_tracking.rb +2 -2
- data/lib/paypal-api/api_collections/subscription_plans.rb +106 -0
- data/lib/paypal-api/api_collections/subscriptions.rb +16 -98
- data/lib/paypal-api/api_collections/user_info.rb +47 -0
- data/lib/paypal-api/api_collections/users.rb +96 -0
- data/lib/paypal-api/api_collections/webhook_events.rb +78 -0
- data/lib/paypal-api/api_collections/webhook_lookups.rb +68 -0
- data/lib/paypal-api/api_collections/webhooks.rb +5 -108
- data/lib/paypal-api/client.rb +61 -0
- data/lib/paypal-api.rb +106 -12
- metadata +14 -2
@@ -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
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PaypalAPI
|
4
|
+
#
|
5
|
+
# The Referenced Payouts API enables partner merchants and developers to process individual referenced payouts to recipients.
|
6
|
+
#
|
7
|
+
# @see https://developer.paypal.com/docs/api/referenced-payouts/v1/
|
8
|
+
#
|
9
|
+
class ReferencedPayouts < 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 batch payout
|
22
|
+
#
|
23
|
+
# @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts_create_batch
|
24
|
+
#
|
25
|
+
# @macro request
|
26
|
+
#
|
27
|
+
def create(query: nil, body: nil, headers: nil)
|
28
|
+
client.post("/v1/payments/referenced-payouts", query: query, body: body, headers: headers)
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# List items in referenced batch payout
|
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 reference batch payout for which to list items.
|
37
|
+
# @macro request
|
38
|
+
#
|
39
|
+
def show(payout_batch_id, query: nil, body: nil, headers: nil)
|
40
|
+
client.get("/v1/payments/referenced-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
|
@@ -20,7 +20,7 @@ module PaypalAPI
|
|
20
20
|
# @macro request
|
21
21
|
#
|
22
22
|
def show(refund_id, query: nil, body: nil, headers: nil)
|
23
|
-
client.get("/v2/payments/refunds/#{refund_id}", query: query, body: body, headers: headers)
|
23
|
+
client.get("/v2/payments/refunds/#{encode(refund_id)}", query: query, body: body, headers: headers)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -37,7 +37,7 @@ module PaypalAPI
|
|
37
37
|
# @macro request
|
38
38
|
#
|
39
39
|
def update(id, query: nil, body: nil, headers: nil)
|
40
|
-
client.put("/v1/shipping/trackers/#{id}", query: query, body: body, headers: headers)
|
40
|
+
client.put("/v1/shipping/trackers/#{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 show(id, query: nil, body: nil, headers: nil)
|
52
|
-
client.get("/v1/shipping/trackers/#{id}", query: query, body: body, headers: headers)
|
52
|
+
client.get("/v1/shipping/trackers/#{encode(id)}", query: query, body: body, headers: headers)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PaypalAPI
|
4
|
+
#
|
5
|
+
# Manages subscriptions for recurring PayPal payments
|
6
|
+
#
|
7
|
+
# @see https://developer.paypal.com/docs/api/subscriptions/v1/
|
8
|
+
#
|
9
|
+
class SubscriptionPlans < 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
|
+
# Creates a plan that defines pricing and billing cycle details for subscriptions.
|
22
|
+
#
|
23
|
+
# @see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create
|
24
|
+
#
|
25
|
+
# @macro request
|
26
|
+
#
|
27
|
+
def create(query: nil, body: nil, headers: nil)
|
28
|
+
client.post("/v1/billing/plans", query: query, body: body, headers: headers)
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# List plans
|
33
|
+
#
|
34
|
+
# @see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_list
|
35
|
+
#
|
36
|
+
# @macro request
|
37
|
+
#
|
38
|
+
def list(query: nil, body: nil, headers: nil)
|
39
|
+
client.get("/v1/billing/plans", query: query, body: body, headers: headers)
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# Show plan details
|
44
|
+
#
|
45
|
+
# @see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_get
|
46
|
+
#
|
47
|
+
# @param plan_id [String] Plan ID
|
48
|
+
# @macro request
|
49
|
+
#
|
50
|
+
def show(plan_id, query: nil, body: nil, headers: nil)
|
51
|
+
client.get("/v1/billing/plans/#{encode(plan_id)}", query: query, body: body, headers: headers)
|
52
|
+
end
|
53
|
+
|
54
|
+
#
|
55
|
+
# Update plan
|
56
|
+
#
|
57
|
+
# @see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_patch
|
58
|
+
#
|
59
|
+
# @param plan_id [String] Plan ID
|
60
|
+
# @macro request
|
61
|
+
#
|
62
|
+
def update(plan_id, query: nil, body: nil, headers: nil)
|
63
|
+
client.patch("/v1/billing/plans/#{encode(plan_id)}", query: query, body: body, headers: headers)
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Activate plan
|
68
|
+
#
|
69
|
+
# @see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_activate
|
70
|
+
#
|
71
|
+
# @param plan_id [String] Plan ID
|
72
|
+
# @macro request
|
73
|
+
#
|
74
|
+
def activate(plan_id, query: nil, body: nil, headers: nil)
|
75
|
+
client.post("/v1/billing/plans/#{encode(plan_id)}/activate", query: query, body: body, headers: headers)
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Deactivate plan
|
80
|
+
#
|
81
|
+
# @see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_deactivate
|
82
|
+
#
|
83
|
+
# @param plan_id [String] Plan ID
|
84
|
+
# @macro request
|
85
|
+
#
|
86
|
+
def deactivate(plan_id, query: nil, body: nil, headers: nil)
|
87
|
+
client.post("/v1/billing/plans/#{encode(plan_id)}/deactivate", query: query, body: body, headers: headers)
|
88
|
+
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Update pricing
|
92
|
+
#
|
93
|
+
# @see https://developer.paypal.com/docs/api/subscriptions/v1/#plans_deactivate
|
94
|
+
#
|
95
|
+
# @param plan_id [String] Plan ID
|
96
|
+
# @macro request
|
97
|
+
#
|
98
|
+
def update_pricing(plan_id, query: nil, body: nil, headers: nil)
|
99
|
+
client.post("/v1/billing/plans/#{encode(plan_id)}/update-pricing-schemes", query: query, body: body, headers: headers)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
include APIs
|
104
|
+
extend APIs
|
105
|
+
end
|
106
|
+
end
|