mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	fix: Populate amount_captured in case of success (#700)
This commit is contained in:
		| @ -362,6 +362,13 @@ async fn payment_response_update_tracker<F: Clone, T>( | |||||||
|         None => payment_data.connector_response, |         None => payment_data.connector_response, | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  |     let amount_captured = router_data.amount_captured.or_else(|| { | ||||||
|  |         if router_data.status == enums::AttemptStatus::Charged { | ||||||
|  |             Some(payment_data.payment_intent.amount) | ||||||
|  |         } else { | ||||||
|  |             None | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|     let payment_intent_update = match router_data.response { |     let payment_intent_update = match router_data.response { | ||||||
|         Err(_) => storage::PaymentIntentUpdate::PGStatusUpdate { |         Err(_) => storage::PaymentIntentUpdate::PGStatusUpdate { | ||||||
|             status: enums::IntentStatus::Failed, |             status: enums::IntentStatus::Failed, | ||||||
| @ -369,7 +376,7 @@ async fn payment_response_update_tracker<F: Clone, T>( | |||||||
|         Ok(_) => storage::PaymentIntentUpdate::ResponseUpdate { |         Ok(_) => storage::PaymentIntentUpdate::ResponseUpdate { | ||||||
|             status: router_data.status.foreign_into(), |             status: router_data.status.foreign_into(), | ||||||
|             return_url: router_data.return_url.clone(), |             return_url: router_data.return_url.clone(), | ||||||
|             amount_captured: router_data.amount_captured, |             amount_captured, | ||||||
|         }, |         }, | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Kartikeya Hegde
					Kartikeya Hegde