mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-30 17:47:54 +08:00 
			
		
		
		
	fix(core): Add column mandate_data for storing the details of a mandate in PaymentAttempt (#3606)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
		| @ -13,7 +13,6 @@ use time::PrimitiveDateTime; | ||||
| #[serde(rename_all = "snake_case")] | ||||
| pub struct MandateDetails { | ||||
|     pub update_mandate_id: Option<String>, | ||||
|     pub mandate_type: Option<MandateDataType>, | ||||
| } | ||||
|  | ||||
| #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] | ||||
| @ -23,13 +22,6 @@ pub enum MandateDataType { | ||||
|     MultiUse(Option<MandateAmountData>), | ||||
| } | ||||
|  | ||||
| #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] | ||||
| #[serde(rename_all = "snake_case")] | ||||
| #[serde(untagged)] | ||||
| pub enum MandateTypeDetails { | ||||
|     MandateType(MandateDataType), | ||||
|     MandateDetails(MandateDetails), | ||||
| } | ||||
| #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)] | ||||
| pub struct MandateAmountData { | ||||
|     pub amount: i64, | ||||
|  | ||||
| @ -4,7 +4,11 @@ use serde::{Deserialize, Serialize}; | ||||
| use time::PrimitiveDateTime; | ||||
|  | ||||
| use super::PaymentIntent; | ||||
| use crate::{errors, mandates::MandateTypeDetails, ForeignIDRef}; | ||||
| use crate::{ | ||||
|     errors, | ||||
|     mandates::{MandateDataType, MandateDetails}, | ||||
|     ForeignIDRef, | ||||
| }; | ||||
|  | ||||
| #[async_trait::async_trait] | ||||
| pub trait PaymentAttemptInterface { | ||||
| @ -143,7 +147,7 @@ pub struct PaymentAttempt { | ||||
|     pub straight_through_algorithm: Option<serde_json::Value>, | ||||
|     pub preprocessing_step_id: Option<String>, | ||||
|     // providing a location to store mandate details intermediately for transaction | ||||
|     pub mandate_details: Option<MandateTypeDetails>, | ||||
|     pub mandate_details: Option<MandateDataType>, | ||||
|     pub error_reason: Option<String>, | ||||
|     pub multiple_capture_count: Option<i16>, | ||||
|     // reference to the payment at connector side | ||||
| @ -155,6 +159,7 @@ pub struct PaymentAttempt { | ||||
|     pub merchant_connector_id: Option<String>, | ||||
|     pub unified_code: Option<String>, | ||||
|     pub unified_message: Option<String>, | ||||
|     pub mandate_data: Option<MandateDetails>, | ||||
| } | ||||
|  | ||||
| impl PaymentAttempt { | ||||
| @ -221,7 +226,7 @@ pub struct PaymentAttemptNew { | ||||
|     pub business_sub_label: Option<String>, | ||||
|     pub straight_through_algorithm: Option<serde_json::Value>, | ||||
|     pub preprocessing_step_id: Option<String>, | ||||
|     pub mandate_details: Option<MandateTypeDetails>, | ||||
|     pub mandate_details: Option<MandateDataType>, | ||||
|     pub error_reason: Option<String>, | ||||
|     pub connector_response_reference_id: Option<String>, | ||||
|     pub multiple_capture_count: Option<i16>, | ||||
| @ -232,6 +237,7 @@ pub struct PaymentAttemptNew { | ||||
|     pub merchant_connector_id: Option<String>, | ||||
|     pub unified_code: Option<String>, | ||||
|     pub unified_message: Option<String>, | ||||
|     pub mandate_data: Option<MandateDetails>, | ||||
| } | ||||
|  | ||||
| impl PaymentAttemptNew { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Amisha Prabhat
					Amisha Prabhat