Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction Split Tests #29

Merged
merged 4 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;