File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -172,8 +172,33 @@ impl<'a> TerminalEndpoints<'a> {
172
172
}
173
173
}
174
174
175
+ /// Unlink your debug device from your integration
175
176
///
176
- pub async fn decommission_terminal ( ) { }
177
+ /// - serial_number: Device Serial Number.
178
+ pub async fn decommission_terminal (
179
+ & self ,
180
+ serial_number : & str ,
181
+ ) -> PaystackResult < TerminalResponseWithNoData > {
182
+ let url = format ! ( "{}/decommission_device" , BASE_URL ) ;
183
+
184
+ let decommission_body = Body {
185
+ serial_number : serial_number. to_string ( ) ,
186
+ } ;
187
+
188
+ match post_request ( self . api_key , & url, decommission_body) . await {
189
+ Ok ( response) => match response. status ( ) {
190
+ StatusCode :: Ok => match response. json :: < TerminalResponseWithNoData > ( ) . await {
191
+ Ok ( content) => Ok ( content) ,
192
+ Err ( err) => Err ( Error :: Terminal ( err. to_string ( ) ) ) ,
193
+ } ,
194
+ _ => Err ( Error :: RequestNotSuccessful (
195
+ response. status ( ) . to_string ( ) ,
196
+ response. text ( ) . await ?,
197
+ ) ) ,
198
+ } ,
199
+ Err ( err) => Err ( Error :: FailedRequest ( err. to_string ( ) ) ) ,
200
+ }
201
+ }
177
202
}
178
203
179
204
/// creating body here because it is redundant to create a dedicated type for this.
You can’t perform that action at this time.
0 commit comments