Skip to main content

efi_bank/
pix.rs

1use reqwest::Method;
2
3use crate::client::Client;
4use crate::error::Error;
5use crate::types::{PixTransactionDetailResponse, PixTransactionPayload, PixTransactionResponse};
6
7impl Client {
8    pub async fn pix_send(
9        &self,
10        payload: &PixTransactionPayload,
11    ) -> Result<PixTransactionResponse, Error> {
12        self.send_authenticated(Method::POST, "/v2/pix/send", Some(payload))
13            .await
14    }
15
16    pub async fn pix_get_transaction(
17        &self,
18        end_to_end_id: &str,
19    ) -> Result<PixTransactionDetailResponse, Error> {
20        let path = format!("/v2/pix/transaction/{end_to_end_id}");
21        self.send_authenticated::<serde_json::Value, PixTransactionDetailResponse>(
22            Method::GET,
23            &path,
24            None,
25        )
26        .await
27    }
28}