paystack_sdk 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +401 -2
- data/lib/paystack_sdk/client.rb +90 -0
- data/lib/paystack_sdk/resources/apple_pay.rb +74 -0
- data/lib/paystack_sdk/resources/bulk_charges.rb +131 -0
- data/lib/paystack_sdk/resources/direct_debits.rb +61 -0
- data/lib/paystack_sdk/resources/integrations.rb +48 -0
- data/lib/paystack_sdk/resources/orders.rb +146 -0
- data/lib/paystack_sdk/resources/pages.rb +192 -0
- data/lib/paystack_sdk/resources/products.rb +167 -0
- data/lib/paystack_sdk/resources/storefronts.rb +204 -0
- data/lib/paystack_sdk/resources/terminals.rb +170 -0
- data/lib/paystack_sdk/resources/virtual_terminals.rb +186 -0
- data/lib/paystack_sdk/version.rb +1 -1
- metadata +11 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Generated by bin/paystack-scaffold from Paystack's OpenAPI spec (PaystackOSS/openapi@d9d444d).
|
|
4
|
+
# Do not edit by hand: regenerate it with `bin/paystack-scaffold Virtual Terminal`. Hand-written extras go in lib/paystack_sdk/resources/extensions/virtual_terminals.rb.
|
|
5
|
+
# scaffold-digest: 9302433893249a59feb8c11b215838d8364c0cb4e51090af609d1dfab2a656d4
|
|
6
|
+
|
|
7
|
+
require_relative "base"
|
|
8
|
+
|
|
9
|
+
module PaystackSdk
|
|
10
|
+
module Resources
|
|
11
|
+
# Virtual Terminal operations.
|
|
12
|
+
class VirtualTerminals < PaystackSdk::Resources::Base
|
|
13
|
+
# Ruby keyword => the parameter name Paystack documents.
|
|
14
|
+
WIRE_NAMES = {per_page: "perPage"}.freeze
|
|
15
|
+
|
|
16
|
+
# List Virtual Terminals.
|
|
17
|
+
#
|
|
18
|
+
# List Virtual Terminals on your integration
|
|
19
|
+
#
|
|
20
|
+
# @param per_page [Integer] The number of records to fetch per request
|
|
21
|
+
# @param page [Integer] The offset to retrieve data from
|
|
22
|
+
# @param status [String] Filter virtual terminals by status, active or inactive.
|
|
23
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
24
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
25
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#list
|
|
26
|
+
def list(per_page: nil, page: nil, status: nil)
|
|
27
|
+
validate_positive_integer!(value: per_page, name: "perPage")
|
|
28
|
+
validate_positive_integer!(value: page, name: "page")
|
|
29
|
+
|
|
30
|
+
wire_query = to_wire({per_page:, page:, status:}, WIRE_NAMES)
|
|
31
|
+
|
|
32
|
+
handle_response(@connection.get("/virtual_terminal", wire_query))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Create Virtual Terminal.
|
|
36
|
+
#
|
|
37
|
+
# Create a Virtual Terminal on your integration
|
|
38
|
+
#
|
|
39
|
+
# @param name [String] The name of the virtual terminal
|
|
40
|
+
# @param destinations [Array] Array of objects containing recipients for payment notifications for the Virtual Terminal.
|
|
41
|
+
# @param split_code [String] Split code to associate with the virtual terminal
|
|
42
|
+
# @param metadata [Hash] Additional custom data as key-value pairs
|
|
43
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
44
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
45
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#create
|
|
46
|
+
def create(name:, destinations:, split_code: nil, metadata: nil)
|
|
47
|
+
validate_presence!(value: name, name: "name")
|
|
48
|
+
validate_presence!(value: destinations, name: "destinations")
|
|
49
|
+
|
|
50
|
+
wire_body = to_wire({name:, destinations:, split_code:, metadata:}, WIRE_NAMES)
|
|
51
|
+
|
|
52
|
+
handle_response(@connection.post("/virtual_terminal", wire_body))
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Fetch Virtual Terminal.
|
|
56
|
+
#
|
|
57
|
+
# Fetch a Virtual Terminal on your integration
|
|
58
|
+
#
|
|
59
|
+
# @param code [String] Code of the Virtual Terminal
|
|
60
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
61
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
62
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#fetch
|
|
63
|
+
def fetch(code:)
|
|
64
|
+
validate_presence!(value: code, name: "code")
|
|
65
|
+
|
|
66
|
+
handle_response(@connection.get("/virtual_terminal/#{escape_path(code, name: "code")}"))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Update Virtual Terminal.
|
|
70
|
+
#
|
|
71
|
+
# Update a Virtual Terminal on your integration
|
|
72
|
+
#
|
|
73
|
+
# @param code [String] Code of the Virtual Terminal
|
|
74
|
+
# @param name [String] Name of the virtual terminal
|
|
75
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
76
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
77
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#update
|
|
78
|
+
def update(code:, name:)
|
|
79
|
+
validate_presence!(value: code, name: "code")
|
|
80
|
+
validate_presence!(value: name, name: "name")
|
|
81
|
+
|
|
82
|
+
wire_body = to_wire({name:}, WIRE_NAMES)
|
|
83
|
+
|
|
84
|
+
handle_response(
|
|
85
|
+
@connection.put("/virtual_terminal/#{escape_path(code, name: "code")}", wire_body)
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Deactivate Virtual Terminal.
|
|
90
|
+
#
|
|
91
|
+
# Deactivate a Virtual Terminal on your integration
|
|
92
|
+
#
|
|
93
|
+
# @param code [String] Code of the Virtual Terminal
|
|
94
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
95
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
96
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#deactivate
|
|
97
|
+
def deactivate(code:)
|
|
98
|
+
validate_presence!(value: code, name: "code")
|
|
99
|
+
|
|
100
|
+
handle_response(
|
|
101
|
+
@connection.put("/virtual_terminal/#{escape_path(code, name: "code")}/deactivate")
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Assign Destination to Virtual Terminal.
|
|
106
|
+
#
|
|
107
|
+
# Add a destination (WhatsApp number) to a Virtual Terminal on your integration
|
|
108
|
+
#
|
|
109
|
+
# @param code [String] Code of the Virtual Terminal
|
|
110
|
+
# @param destinations [Array] Array of objects containing recipients for payment notifications for the Virtual Terminal.
|
|
111
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
112
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
113
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#assign-destination
|
|
114
|
+
def assign_destination(code:, destinations:)
|
|
115
|
+
validate_presence!(value: code, name: "code")
|
|
116
|
+
validate_presence!(value: destinations, name: "destinations")
|
|
117
|
+
|
|
118
|
+
wire_body = to_wire({destinations:}, WIRE_NAMES)
|
|
119
|
+
|
|
120
|
+
handle_response(
|
|
121
|
+
@connection.post("/virtual_terminal/#{escape_path(code, name: "code")}/destination/assign", wire_body)
|
|
122
|
+
)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Unassign Destination from Virtual Terminal.
|
|
126
|
+
#
|
|
127
|
+
# Unassign a destination (WhatsApp Number) from a Virtual Terminal on your integration
|
|
128
|
+
#
|
|
129
|
+
# @param code [String] Code of the Virtual Terminal
|
|
130
|
+
# @param targets [Array] Array of destination targets to unassign
|
|
131
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
132
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
133
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#unassign-destination
|
|
134
|
+
def unassign_destination(code:, targets:)
|
|
135
|
+
validate_presence!(value: code, name: "code")
|
|
136
|
+
validate_presence!(value: targets, name: "targets")
|
|
137
|
+
|
|
138
|
+
wire_body = to_wire({targets:}, WIRE_NAMES)
|
|
139
|
+
|
|
140
|
+
handle_response(
|
|
141
|
+
@connection.post("/virtual_terminal/#{escape_path(code, name: "code")}/destination/unassign", wire_body)
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Add Split Code to Virtual Terminal.
|
|
146
|
+
#
|
|
147
|
+
# Add Split Code to Virtual Terminal
|
|
148
|
+
#
|
|
149
|
+
# @param code [String] Code of the Virtual Terminal
|
|
150
|
+
# @param split_code [String] The split code to assign to the virtual terminal
|
|
151
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
152
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
153
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#add-split-code
|
|
154
|
+
def add_split_code(code:, split_code:)
|
|
155
|
+
validate_presence!(value: code, name: "code")
|
|
156
|
+
validate_presence!(value: split_code, name: "split_code")
|
|
157
|
+
|
|
158
|
+
wire_body = to_wire({split_code:}, WIRE_NAMES)
|
|
159
|
+
|
|
160
|
+
handle_response(
|
|
161
|
+
@connection.put("/virtual_terminal/#{escape_path(code, name: "code")}/split_code", wire_body)
|
|
162
|
+
)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Remove Split Code from Virtual Terminal.
|
|
166
|
+
#
|
|
167
|
+
# Remove Split Code from Virtual Terminal
|
|
168
|
+
#
|
|
169
|
+
# @param code [String] Code of the Virtual Terminal
|
|
170
|
+
# @param split_code [String] The split code to assign to the virtual terminal
|
|
171
|
+
# @return [PaystackSdk::Response] The response from the Paystack API.
|
|
172
|
+
# @raise [PaystackSdk::Error] If a parameter is invalid or the API request fails.
|
|
173
|
+
# @see https://paystack.com/docs/api/virtual-terminal/#remove-split-code
|
|
174
|
+
def remove_split_code(code:, split_code:)
|
|
175
|
+
validate_presence!(value: code, name: "code")
|
|
176
|
+
validate_presence!(value: split_code, name: "split_code")
|
|
177
|
+
|
|
178
|
+
wire_body = to_wire({split_code:}, WIRE_NAMES)
|
|
179
|
+
|
|
180
|
+
handle_response(
|
|
181
|
+
@connection.delete("/virtual_terminal/#{escape_path(code, name: "code")}/split_code") { |request| request.body = wire_body }
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
data/lib/paystack_sdk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: paystack_sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maxwell Nana Forson (theLazyProgrammer)
|
|
@@ -165,25 +165,35 @@ files:
|
|
|
165
165
|
- lib/paystack_sdk/client.rb
|
|
166
166
|
- lib/paystack_sdk/middleware/transport_errors.rb
|
|
167
167
|
- lib/paystack_sdk/request_helpers.rb
|
|
168
|
+
- lib/paystack_sdk/resources/apple_pay.rb
|
|
168
169
|
- lib/paystack_sdk/resources/balances.rb
|
|
169
170
|
- lib/paystack_sdk/resources/banks.rb
|
|
170
171
|
- lib/paystack_sdk/resources/base.rb
|
|
172
|
+
- lib/paystack_sdk/resources/bulk_charges.rb
|
|
171
173
|
- lib/paystack_sdk/resources/charges.rb
|
|
172
174
|
- lib/paystack_sdk/resources/customers.rb
|
|
173
175
|
- lib/paystack_sdk/resources/dedicated_virtual_accounts.rb
|
|
176
|
+
- lib/paystack_sdk/resources/direct_debits.rb
|
|
174
177
|
- lib/paystack_sdk/resources/disputes.rb
|
|
175
178
|
- lib/paystack_sdk/resources/extensions/charges.rb
|
|
179
|
+
- lib/paystack_sdk/resources/integrations.rb
|
|
176
180
|
- lib/paystack_sdk/resources/miscellaneous.rb
|
|
181
|
+
- lib/paystack_sdk/resources/orders.rb
|
|
182
|
+
- lib/paystack_sdk/resources/pages.rb
|
|
177
183
|
- lib/paystack_sdk/resources/payment_requests.rb
|
|
178
184
|
- lib/paystack_sdk/resources/plans.rb
|
|
185
|
+
- lib/paystack_sdk/resources/products.rb
|
|
179
186
|
- lib/paystack_sdk/resources/refunds.rb
|
|
180
187
|
- lib/paystack_sdk/resources/settlements.rb
|
|
181
188
|
- lib/paystack_sdk/resources/splits.rb
|
|
189
|
+
- lib/paystack_sdk/resources/storefronts.rb
|
|
182
190
|
- lib/paystack_sdk/resources/subaccounts.rb
|
|
183
191
|
- lib/paystack_sdk/resources/subscriptions.rb
|
|
192
|
+
- lib/paystack_sdk/resources/terminals.rb
|
|
184
193
|
- lib/paystack_sdk/resources/transactions.rb
|
|
185
194
|
- lib/paystack_sdk/resources/transfer_recipients.rb
|
|
186
195
|
- lib/paystack_sdk/resources/transfers.rb
|
|
196
|
+
- lib/paystack_sdk/resources/virtual_terminals.rb
|
|
187
197
|
- lib/paystack_sdk/response.rb
|
|
188
198
|
- lib/paystack_sdk/utils/connection_utils.rb
|
|
189
199
|
- lib/paystack_sdk/validations.rb
|