async_mpesa/
expressquery.rs

1use crate::{
2    client::Client,
3    config::Config,
4    error::MpesaError,
5    types::{ExpressQueryRequest, ExpressQueryResponse}
6};
7
8/// Client to call the stkpush transaction status query API
9pub struct ExpressQuery<'m, C: Config> {
10    client: &'m Client<C>,
11}
12
13impl <'m, C: Config> ExpressQuery<'m, C> {
14    pub fn new(client: &'m Client<C>) -> Self {
15        Self { client }
16    }
17
18    /// Creates a request for the provided parameters
19    pub async fn create(
20        &self,
21        request: ExpressQueryRequest,
22    ) -> Result<ExpressQueryResponse, MpesaError> {
23        self.client.post("/mpesa/stkpushquery/v1/query", request).await
24    }
25}