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

feat: Implement Balance retrieve #341

Merged
merged 2 commits into from
Mar 9, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/resources.rs
Original file line number Diff line number Diff line change
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 @@ -301,7 +302,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
Original file line number Diff line number Diff line change
@@ -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"),
}
}
}