flutterwave_v3_models/preauthorization/
void_preauth_charge.rs

1use serde::{Deserialize, Serialize};
2use validator::Validate;
3use crate::{
4    common::{charge_res_data::ChargeResData, payload::Payload},
5    fwcall::{FwCall, ToFwCall},
6};
7use std::borrow::Cow;
8
9#[derive(Debug, Deserialize, Serialize, Validate)]
10pub struct VoidPreAuthChargeReq {
11    pub flw_ref: String
12}
13
14#[derive(Debug, Deserialize, Serialize)]
15pub struct VoidPreAuthChargeRes {
16    pub status: String,
17    pub message: String,
18    pub data: ChargeResData
19}
20
21impl<'a> ToFwCall<'a> for VoidPreAuthChargeReq {
22    type ApiRequest = Self;
23
24    type ApiResponse = VoidPreAuthChargeRes;
25
26    fn get_call(self) -> FwCall<'a, Self::ApiRequest, Self::ApiResponse> {
27        FwCall::new(
28            Cow::Owned(format!("/v3/charges/{}/void", self.flw_ref)),
29            reqwest::Method::POST,
30            Some(Payload::Plain(self)),
31        )
32    }
33}