highlevel_api/apis/payments/
client.rs1use std::sync::Arc;
2use crate::{error::Result, http::HttpClient};
3use super::types::*;
4
5pub struct PaymentsApi {
6 http: Arc<HttpClient>,
7}
8
9impl PaymentsApi {
10 pub fn new(http: Arc<HttpClient>) -> Self {
11 Self { http }
12 }
13
14 pub async fn list_orders(&self, params: &GetOrdersParams) -> Result<GetOrdersResponse> {
15 self.http.get_with_query("/payments/orders", params).await
16 }
17
18 pub async fn get_order(&self, order_id: &str) -> Result<GetOrderResponse> {
19 self.http.get(&format!("/payments/orders/{order_id}")).await
20 }
21
22 pub async fn list_transactions(
23 &self,
24 params: &GetTransactionsParams,
25 ) -> Result<GetTransactionsResponse> {
26 self.http.get_with_query("/payments/transactions", params).await
27 }
28
29 pub async fn get_transaction(&self, transaction_id: &str) -> Result<GetTransactionResponse> {
30 self.http
31 .get(&format!("/payments/transactions/{transaction_id}"))
32 .await
33 }
34
35 pub async fn list_subscriptions(
36 &self,
37 params: &GetSubscriptionsParams,
38 ) -> Result<GetSubscriptionsResponse> {
39 self.http
40 .get_with_query("/payments/subscriptions", params)
41 .await
42 }
43
44 pub async fn get_subscription(&self, subscription_id: &str) -> Result<serde_json::Value> {
45 self.http
46 .get(&format!("/payments/subscriptions/{subscription_id}"))
47 .await
48 }
49}