Skip to content

Commit 8c810f9

Browse files
authored
Merge pull request #70 from morukele/revert-69-feature/plans
Revert "feat(plan): Added support for the plan API endpoint."
2 parents ff67d95 + 8009827 commit 8c810f9

33 files changed

Lines changed: 66 additions & 830 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The client currently covers the following section of the API, and the sections t
2121
- [x] Dedicated Virtual Account
2222
- [x] Apple Pay
2323
- [x] Subaccounts
24-
- [x] Plans
24+
- [ ] Plans
2525
- [ ] Subscriptions
2626
- [ ] Transfer Recipients
2727
- [ ] Transfers

src/client.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
//! This file contains the Paystack API client, and it associated endpoints.
44
use crate::{
55
ApplePayEndpoints, CustomersEndpoints, DedicatedVirtualAccountEndpoints, HttpClient,
6-
PlansEndpoints, SubaccountEndpoints, TerminalEndpoints, TransactionEndpoints,
7-
TransactionSplitEndpoints, VirtualTerminalEndpoints,
6+
SubaccountEndpoints, TerminalEndpoints, TransactionEndpoints, TransactionSplitEndpoints,
7+
VirtualTerminalEndpoints,
88
};
99
use std::sync::Arc;
1010

@@ -27,8 +27,6 @@ pub struct PaystackClient<T: HttpClient + Default> {
2727
pub dedicated_virtual_account: DedicatedVirtualAccountEndpoints<T>,
2828
/// Apple Pay API route
2929
pub apple_pay: ApplePayEndpoints<T>,
30-
/// Plans API route
31-
pub plans: PlansEndpoints<T>,
3230
}
3331

3432
impl<T: HttpClient + Default> PaystackClient<T> {
@@ -47,7 +45,6 @@ impl<T: HttpClient + Default> PaystackClient<T> {
4745
Arc::clone(&http),
4846
),
4947
apple_pay: ApplePayEndpoints::new(Arc::clone(&key), Arc::clone(&http)),
50-
plans: PlansEndpoints::new(Arc::clone(&key), Arc::clone(&http)),
5148
}
5249
}
5350
}

src/endpoints/apple_pay.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl<T: HttpClient + Default> ApplePayEndpoints<T> {
2727
/// # Returns
2828
/// A new ApplePayEndpoints instance
2929
pub fn new(key: Arc<String>, http: Arc<T>) -> ApplePayEndpoints<T> {
30-
let base_url = format!("{PAYSTACK_BASE_URL}/apple-pay/domain");
30+
let base_url = format!("{}/apple-pay/domain", PAYSTACK_BASE_URL);
3131
ApplePayEndpoints {
3232
key: key.to_string(),
3333
base_url,
@@ -53,7 +53,7 @@ impl<T: HttpClient + Default> ApplePayEndpoints<T> {
5353

5454
let response = self
5555
.http
56-
.post(url, &self.key, &body)
56+
.post(&url, &self.key, &body)
5757
.await
5858
.map_err(|e| PaystackAPIError::ApplePay(e.to_string()))?;
5959

@@ -72,7 +72,7 @@ impl<T: HttpClient + Default> ApplePayEndpoints<T> {
7272

7373
let response = self
7474
.http
75-
.get(url, &self.key, None)
75+
.get(&url, &self.key, None)
7676
.await
7777
.map_err(|e| PaystackAPIError::ApplePay(e.to_string()))?;
7878

@@ -100,7 +100,7 @@ impl<T: HttpClient + Default> ApplePayEndpoints<T> {
100100

101101
let response = self
102102
.http
103-
.delete(url, &self.key, &body)
103+
.delete(&url, &self.key, &body)
104104
.await
105105
.map_err(|e| PaystackAPIError::ApplePay(e.to_string()))?;
106106

src/endpoints/customers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<T: HttpClient + Default> CustomersEndpoints<T> {
3131
/// # Returns
3232
/// A new CustomersEndpoints instance
3333
pub fn new(key: Arc<String>, http: Arc<T>) -> CustomersEndpoints<T> {
34-
let base_url = format!("{PAYSTACK_BASE_URL}/customer");
34+
let base_url = format!("{}/customer", PAYSTACK_BASE_URL);
3535
CustomersEndpoints {
3636
key: key.to_string(),
3737
base_url,
@@ -57,7 +57,7 @@ impl<T: HttpClient + Default> CustomersEndpoints<T> {
5757

5858
let response = self
5959
.http
60-
.post(url, &self.key, &body)
60+
.post(&url, &self.key, &body)
6161
.await
6262
.map_err(|e| PaystackAPIError::Customer(e.to_string()))?;
6363

@@ -88,7 +88,7 @@ impl<T: HttpClient + Default> CustomersEndpoints<T> {
8888

8989
let response = self
9090
.http
91-
.get(url, &self.key, Some(&query))
91+
.get(&url, &self.key, Some(&query))
9292
.await
9393
.map_err(|e| PaystackAPIError::Customer(e.to_string()))?;
9494

src/endpoints/dedicated_virtual_account.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl<T: HttpClient + Default> DedicatedVirtualAccountEndpoints<T> {
2929
/// # Returns
3030
/// A new DedicatedVirtualAccountEndpoints instance
3131
pub fn new(key: Arc<String>, http: Arc<T>) -> DedicatedVirtualAccountEndpoints<T> {
32-
let base_url = format!("{PAYSTACK_BASE_URL}/dedicated_account");
32+
let base_url = format!("{}/dedicated_account", PAYSTACK_BASE_URL);
3333
DedicatedVirtualAccountEndpoints {
3434
key: key.to_string(),
3535
base_url,
@@ -55,7 +55,7 @@ impl<T: HttpClient + Default> DedicatedVirtualAccountEndpoints<T> {
5555

5656
let response = self
5757
.http
58-
.post(url, &self.key, &body)
58+
.post(&url, &self.key, &body)
5959
.await
6060
.map_err(|e| PaystackAPIError::DedicatedVirtualAccount(e.to_string()))?;
6161

@@ -84,7 +84,7 @@ impl<T: HttpClient + Default> DedicatedVirtualAccountEndpoints<T> {
8484

8585
let response = self
8686
.http
87-
.post(url, &self.key, &body)
87+
.post(&url, &self.key, &body)
8888
.await
8989
.map_err(|e| PaystackAPIError::DedicatedVirtualAccount(e.to_string()))?;
9090

@@ -131,7 +131,7 @@ impl<T: HttpClient + Default> DedicatedVirtualAccountEndpoints<T> {
131131
let query: Vec<(&str, &str)> = query.iter().map(|(k, v)| (*k, v.as_str())).collect();
132132
let response = self
133133
.http
134-
.get(url, &self.key, Some(&query))
134+
.get(&url, &self.key, Some(&query))
135135
.await
136136
.map_err(|e| PaystackAPIError::DedicatedVirtualAccount(e.to_string()))?;
137137

@@ -188,8 +188,8 @@ impl<T: HttpClient + Default> DedicatedVirtualAccountEndpoints<T> {
188188
("account_number", account_number),
189189
("provider_slug", provider_slug),
190190
];
191-
if let Some(value) = date {
192-
query.push(("date", value));
191+
if date.is_some() {
192+
query.push(("date", date.unwrap()));
193193
}
194194

195195
// convert Vec<(&str, String)> to Vec<(&str, &str)>
@@ -242,6 +242,7 @@ impl<T: HttpClient + Default> DedicatedVirtualAccountEndpoints<T> {
242242
///
243243
/// # Returns
244244
/// A Result containing the dedicated virtual account response data or an error
245+
245246
pub async fn split_dedicated_account_transaction(
246247
&self,
247248
split_dedocated_account_transaction_request: SplitDedicatedAccountTransactionRequest,
@@ -252,7 +253,7 @@ impl<T: HttpClient + Default> DedicatedVirtualAccountEndpoints<T> {
252253

253254
let response = self
254255
.http
255-
.post(url, &self.key, &body)
256+
.post(&url, &self.key, &body)
256257
.await
257258
.map_err(|e| PaystackAPIError::DedicatedVirtualAccount(e.to_string()))?;
258259

@@ -281,7 +282,7 @@ impl<T: HttpClient + Default> DedicatedVirtualAccountEndpoints<T> {
281282

282283
let response = self
283284
.http
284-
.delete(url, &self.key, &body)
285+
.delete(&url, &self.key, &body)
285286
.await
286287
.map_err(|e| PaystackAPIError::DedicatedVirtualAccount(e.to_string()))?;
287288

src/endpoints/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
pub mod apple_pay;
22
pub mod customers;
33
pub mod dedicated_virtual_account;
4-
pub mod plans;
54
pub mod subaccount;
65
pub mod terminal;
76
pub mod transaction;
@@ -12,7 +11,6 @@ pub mod virtual_terminal;
1211
pub use apple_pay::*;
1312
pub use customers::*;
1413
pub use dedicated_virtual_account::*;
15-
pub use plans::*;
1614
pub use subaccount::*;
1715
pub use terminal::*;
1816
pub use transaction::*;

src/endpoints/plans.rs

Lines changed: 0 additions & 167 deletions
This file was deleted.

src/endpoints/subaccount.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::sync::Arc;
1515
pub struct SubaccountEndpoints<T: HttpClient + Default> {
1616
/// Paystack API Key
1717
key: String,
18-
/// Base URL for the subaccount route
18+
/// Base URL for the transaction route
1919
base_url: String,
2020
/// Http client for the route
2121
http: Arc<T>,
@@ -31,7 +31,7 @@ impl<T: HttpClient + Default> SubaccountEndpoints<T> {
3131
/// # Returns
3232
/// A new SubaccountEndpoints instance
3333
pub fn new(key: Arc<String>, http: Arc<T>) -> SubaccountEndpoints<T> {
34-
let base_url = format!("{PAYSTACK_BASE_URL}/subaccount");
34+
let base_url = format!("{}/subaccount", PAYSTACK_BASE_URL);
3535
SubaccountEndpoints {
3636
key: key.to_string(),
3737
base_url,
@@ -57,7 +57,7 @@ impl<T: HttpClient + Default> SubaccountEndpoints<T> {
5757

5858
let response = self
5959
.http
60-
.post(url, &self.key, &body)
60+
.post(&url, &self.key, &body)
6161
.await
6262
.map_err(|e| PaystackAPIError::Subaccount(e.to_string()))?;
6363

0 commit comments

Comments
 (0)