mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	feat(verify): add new types for validate API (#45)
This commit is contained in:
		| @ -209,16 +209,16 @@ where | ||||
|     } | ||||
|  | ||||
|     #[instrument(skip_all)] | ||||
|     async fn make_pm_data<'a>( | ||||
|         &'a self, | ||||
|         _state: &'a AppState, | ||||
|     async fn make_pm_data<'b>( | ||||
|         &'b self, | ||||
|         _state: &'b AppState, | ||||
|         _payment_method: Option<enums::PaymentMethodType>, | ||||
|         _txn_id: &str, | ||||
|         _payment_attempt: &storage::PaymentAttempt, | ||||
|         _request: &Option<api::PaymentMethod>, | ||||
|         _token: &Option<String>, | ||||
|     ) -> RouterResult<( | ||||
|         BoxedOperation<'a, F, api::PaymentsSessionRequest>, | ||||
|         BoxedOperation<'b, F, api::PaymentsSessionRequest>, | ||||
|         Option<api::PaymentMethod>, | ||||
|     )> { | ||||
|         //No payment method data for this operation | ||||
|  | ||||
| @ -110,6 +110,17 @@ pub struct PaymentsCancelData { | ||||
|     pub connector_transaction_id: String, | ||||
|     pub cancellation_reason: Option<String>, | ||||
| } | ||||
|  | ||||
| #[derive(Debug, Clone)] | ||||
| pub struct VerifyRequestData { | ||||
|     pub payment_method_data: payments::PaymentMethod, | ||||
|     pub confirm: bool, | ||||
|     pub statement_descriptor_suffix: Option<String>, | ||||
|     pub mandate_id: Option<String>, | ||||
|     pub setup_future_usage: Option<enums::FutureUsage>, | ||||
|     pub off_session: Option<bool>, | ||||
|     pub setup_mandate_details: Option<payments::MandateData>, | ||||
| } | ||||
| #[derive(Debug, Clone)] | ||||
| pub struct PaymentsResponseData { | ||||
|     pub resource_id: ResponseId, | ||||
|  | ||||
| @ -78,6 +78,24 @@ pub struct PaymentsRedirectRequest { | ||||
|     pub param: String, | ||||
| } | ||||
|  | ||||
| #[derive(Default, Debug, serde::Deserialize, Clone)] | ||||
| #[serde(deny_unknown_fields)] | ||||
| pub struct VerifyRequest { | ||||
|     pub merchant_id: Option<String>, | ||||
|     pub customer_id: Option<String>, | ||||
|     pub email: Option<Secret<String, pii::Email>>, | ||||
|     pub name: Option<Secret<String>>, | ||||
|     pub phone: Option<Secret<String>>, | ||||
|     pub phone_country_code: Option<String>, | ||||
|     pub payment_method: Option<enums::PaymentMethodType>, | ||||
|     pub payment_method_data: Option<PaymentMethod>, | ||||
|     pub payment_token: Option<i32>, | ||||
|     pub mandate_data: Option<MandateData>, | ||||
|     pub setup_future_usage: Option<super::FutureUsage>, | ||||
|     pub off_session: Option<bool>, | ||||
|     pub client_secret: Option<String>, | ||||
| } | ||||
|  | ||||
| pub enum MandateTxnType { | ||||
|     NewMandateTxn, | ||||
|     RecurringMandateTxn, | ||||
| @ -376,6 +394,26 @@ pub struct PaymentListResponse { | ||||
|     pub data: Vec<PaymentsResponse>, | ||||
| } | ||||
|  | ||||
| #[derive(Setter, Clone, Default, Debug, Eq, PartialEq, serde::Serialize)] | ||||
| pub struct VerifyResponse { | ||||
|     pub verify_id: Option<String>, | ||||
|     pub merchant_id: Option<String>, | ||||
|     // pub status: enums::VerifyStatus, | ||||
|     pub client_secret: Option<Secret<String>>, | ||||
|     pub customer_id: Option<String>, | ||||
|     pub email: Option<Secret<String, pii::Email>>, | ||||
|     pub name: Option<Secret<String>>, | ||||
|     pub phone: Option<Secret<String>>, | ||||
|     pub mandate_id: Option<String>, | ||||
|     #[auth_based] | ||||
|     pub payment_method: Option<enums::PaymentMethodType>, | ||||
|     #[auth_based] | ||||
|     pub payment_method_data: Option<PaymentMethodDataResponse>, | ||||
|     pub payment_token: Option<i32>, | ||||
|     pub error_code: Option<String>, | ||||
|     pub error_message: Option<String>, | ||||
| } | ||||
|  | ||||
| fn default_limit() -> i64 { | ||||
|     10 | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Nishant Joshi
					Nishant Joshi