From 7509c9878f9c85b91949e7dfeb1e1890a63f9fc2 Mon Sep 17 00:00:00 2001 From: Victor Semenov Date: Tue, 14 Feb 2023 17:20:36 +0200 Subject: [PATCH] feat: Implement Balance retrieve --- src/resources.rs | 3 ++- src/resources/balance_ext.rs | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/resources/balance_ext.rs diff --git a/src/resources.rs b/src/resources.rs index 0c8bd3975..d552dc9b9 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -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; @@ -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"))] diff --git a/src/resources/balance_ext.rs b/src/resources/balance_ext.rs new file mode 100644 index 000000000..28345fc4e --- /dev/null +++ b/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 . + pub fn retrieve(client: &Client, account_id: Option) -> Response { + match account_id { + Some(account_id) => client.clone().with_stripe_account(account_id).get("/balance"), + None => client.get("/balance"), + } + } +}