@@ -12,7 +12,6 @@ use crate::{
12
12
errors:: { self , RouterResult , StorageErrorExt } ,
13
13
payments:: { self , helpers, operations, PaymentData } ,
14
14
} ,
15
- events:: audit_events:: { AuditEvent , AuditEventType } ,
16
15
routes:: { app:: ReqState , SessionState } ,
17
16
services,
18
17
types:: {
@@ -281,66 +280,19 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelPostCa
281
280
#[ instrument( skip_all) ]
282
281
async fn update_trackers < ' b > (
283
282
& ' b self ,
284
- state : & ' b SessionState ,
285
- req_state : ReqState ,
286
- mut payment_data : PaymentData < F > ,
283
+ _state : & ' b SessionState ,
284
+ _req_state : ReqState ,
285
+ payment_data : PaymentData < F > ,
287
286
_customer : Option < domain:: Customer > ,
288
- storage_scheme : enums:: MerchantStorageScheme ,
287
+ _storage_scheme : enums:: MerchantStorageScheme ,
289
288
_updated_customer : Option < storage:: CustomerUpdate > ,
290
- key_store : & domain:: MerchantKeyStore ,
289
+ _key_store : & domain:: MerchantKeyStore ,
291
290
_frm_suggestion : Option < FrmSuggestion > ,
292
291
_header_payload : hyperswitch_domain_models:: payments:: HeaderPayload ,
293
292
) -> RouterResult < ( PaymentCancelPostCaptureOperation < ' b , F > , PaymentData < F > ) >
294
293
where
295
294
F : ' b + Send ,
296
295
{
297
- let cancellation_reason = payment_data. payment_attempt . cancellation_reason . clone ( ) ;
298
- let ( intent_status_update, attempt_status_update) =
299
- if payment_data. payment_intent . status != enums:: IntentStatus :: RequiresCapture {
300
- let payment_intent_update = storage:: PaymentIntentUpdate :: PGStatusUpdate {
301
- status : enums:: IntentStatus :: Cancelled ,
302
- updated_by : storage_scheme. to_string ( ) ,
303
- incremental_authorization_allowed : None ,
304
- } ;
305
- ( Some ( payment_intent_update) , enums:: AttemptStatus :: Voided )
306
- } else {
307
- ( None , enums:: AttemptStatus :: VoidInitiated )
308
- } ;
309
-
310
- if let Some ( payment_intent_update) = intent_status_update {
311
- payment_data. payment_intent = state
312
- . store
313
- . update_payment_intent (
314
- & state. into ( ) ,
315
- payment_data. payment_intent ,
316
- payment_intent_update,
317
- key_store,
318
- storage_scheme,
319
- )
320
- . await
321
- . to_not_found_response ( errors:: ApiErrorResponse :: PaymentNotFound ) ?;
322
- }
323
-
324
- state
325
- . store
326
- . update_payment_attempt_with_attempt_id (
327
- payment_data. payment_attempt . clone ( ) ,
328
- storage:: PaymentAttemptUpdate :: VoidUpdate {
329
- status : attempt_status_update,
330
- cancellation_reason : cancellation_reason. clone ( ) ,
331
- updated_by : storage_scheme. to_string ( ) ,
332
- } ,
333
- storage_scheme,
334
- )
335
- . await
336
- . to_not_found_response ( errors:: ApiErrorResponse :: PaymentNotFound ) ?;
337
- req_state
338
- . event_context
339
- . event ( AuditEvent :: new ( AuditEventType :: PaymentCancelled {
340
- cancellation_reason,
341
- } ) )
342
- . with ( payment_data. to_event ( ) )
343
- . emit ( ) ;
344
296
Ok ( ( Box :: new ( self ) , payment_data) )
345
297
}
346
298
}
0 commit comments