File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,4 +201,31 @@ impl<T: HttpClient + Default> CustomersEndpoints<T> {
201201 Err ( e) => Err ( PaystackAPIError :: Customer ( e. to_string ( ) ) ) ,
202202 }
203203 }
204+
205+ /// Deactivate an authorization when the card needs to be forgotten
206+ ///
207+ /// It takes the following parameters:
208+ /// - `authorization_code`: Authorization code to be deactivated.
209+ pub async fn deactivate_authorization (
210+ & self ,
211+ authorization_code : String ,
212+ ) -> PaystackResult < PhantomData < String > > {
213+ let url = format ! ( "{}/authorization/deactivate" , self . base_url) ;
214+ let body = json ! ( {
215+ "authorization_code" : authorization_code
216+ } ) ;
217+
218+ let response = self . http . post ( & url, & self . key , & body) . await ;
219+
220+ match response {
221+ Ok ( response) => {
222+ let parsed_response: Response < PhantomData < String > > =
223+ serde_json:: from_str ( & response)
224+ . map_err ( |e| PaystackAPIError :: Customer ( e. to_string ( ) ) ) ?;
225+
226+ Ok ( parsed_response)
227+ }
228+ Err ( e) => Err ( PaystackAPIError :: Customer ( e. to_string ( ) ) ) ,
229+ }
230+ }
204231}
Original file line number Diff line number Diff line change @@ -282,3 +282,5 @@ async fn can_blacklist_and_whitelist_a_customer() {
282282 assert ! ( res. message. contains( "Customer updated" ) ) ;
283283 assert_eq ! ( res. data. unwrap( ) . risk_action, Some ( RiskAction :: Default ) ) ;
284284}
285+
286+ // TODO: make test for dea
You can’t perform that action at this time.
0 commit comments