Skip to content

Commit

Permalink
Merge pull request #29 from Lilit0x/test/transaction_split
Browse files Browse the repository at this point in the history
Transaction Split Tests
  • Loading branch information
morukele authored Nov 2, 2023
2 parents 23ccf7c + 9aec21b commit b9206ba
Show file tree
Hide file tree
Showing 4 changed files with 351 additions and 63 deletions.
10 changes: 5 additions & 5 deletions src/endpoints/transaction_splits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
//! across their payout account, and one or more subaccounts.

use crate::{
get_request, post_request, put_request, CreateTransactionSplitBody, Error, PaystackResult,
ResponseWithoutData, SubaccountBody, TransactionSplitListResponse, TransactionSplitResponse,
UpdateTransactionSplitBody,
get_request, post_request, put_request, CreateTransactionSplitBody, DeleteSubAccountBody,
Error, PaystackResult, ResponseWithoutData, SubaccountBody, TransactionSplitListResponse,
TransactionSplitResponse, UpdateTransactionSplitBody,
};
use reqwest::StatusCode;

Expand Down Expand Up @@ -95,7 +95,7 @@ impl<'a> TransactionSplitEndpoints<'a> {
&self,
split_id: &str,
) -> PaystackResult<TransactionSplitResponse> {
let url = format!("{}/split{}", BASE_URL, split_id);
let url = format!("{}/split/{}", BASE_URL, split_id);

match get_request(self.api_key, &url, None).await {
Ok(response) => match response.status() {
Expand Down Expand Up @@ -177,7 +177,7 @@ impl<'a> TransactionSplitEndpoints<'a> {
pub async fn remove_subaccount_from_transaction_split(
&self,
split_id: &str,
subaccount: &str,
subaccount: DeleteSubAccountBody,
) -> PaystackResult<ResponseWithoutData> {
let url = format!("{}/split/{}/subaccount/remove", BASE_URL, split_id);

Expand Down
7 changes: 7 additions & 0 deletions src/models/subaccounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,10 @@ pub struct FetchSubaccountResponse {
/// Fetch Subaccount response data.
pub data: SubaccountsResponseData,
}

/// This struct is used to create the body for deleting a subaccount on your integration.
#[derive(Debug, Deserialize, Serialize)]
pub struct DeleteSubAccountBody {
/// This is the sub account code
pub subaccount: String,
}
2 changes: 1 addition & 1 deletion tests/api/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod charge;
pub mod helpers;
mod subaccount;
pub mod transaction;
pub mod transaction_split;
mod subaccount;
Loading

0 comments on commit b9206ba

Please sign in to comment.