Skip to content

Commit

Permalink
feat: Implement Balance retrieve
Browse files Browse the repository at this point in the history
  • Loading branch information
victorcrimea committed Feb 14, 2023
1 parent 61c5cbc commit 7509c98
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/resources.rs
Expand Up @@ -14,6 +14,7 @@ mod types;
#[path = "resources"]
mod core {
pub mod account_ext;
pub mod balance_ext;
pub mod balance_transaction_ext;
pub mod charge_ext;
pub mod customer_ext;
Expand Down Expand Up @@ -293,7 +294,7 @@ pub use {
#[cfg(feature = "webhook-endpoints")]
pub use {
webhook_endpoints::webhook_endpoint_ext::*,
generated::webhook_endpoints::webhook_endpoint::*,
generated::webhook_endpoints::webhook_endpoint::*,
};

#[cfg(not(feature = "full"))]
Expand Down
15 changes: 15 additions & 0 deletions src/resources/balance_ext.rs
@@ -0,0 +1,15 @@
use crate::client::{Client, Response};
use crate::ids::AccountId;
use crate::resources::Balance;

impl Balance {
/// Retrieves balance object by AccountId. Does not change stripe_account of the client.
///
/// For more details see <https://stripe.com/docs/api/balance/balance_retrieve>.
pub fn retrieve(client: &Client, account_id: Option<AccountId>) -> Response<Balance> {
match account_id {
Some(account_id) => client.clone().with_stripe_account(account_id).get("/balance"),
None => client.get("/balance"),
}
}
}

0 comments on commit 7509c98

Please sign in to comment.