mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	feat(payment_methods_session_v2): add payment methods session endpoints (#7107)
Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Anurag Thakur <anurag.thakur@juspay.in> Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> Co-authored-by: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com> Co-authored-by: Sai Harsha Vardhan <56996463+sai-harsha-vardhan@users.noreply.github.com> Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in> Co-authored-by: Debarati Ghatak <88573135+cookieg13@users.noreply.github.com> Co-authored-by: awasthi21 <107559116+awasthi21@users.noreply.github.com> Co-authored-by: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Arindam Sahoo <88739246+arindam-sahoo@users.noreply.github.com> Co-authored-by: Arindam Sahoo <arindam.sahoo@Arindam-Sahoo-F565040VFJ.local> Co-authored-by: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com> Co-authored-by: AkshayaFoiger <131388445+AkshayaFoiger@users.noreply.github.com> Co-authored-by: Riddhiagrawal001 <50551695+Riddhiagrawal001@users.noreply.github.com> Co-authored-by: Suman Maji <77887221+sumanmaji4@users.noreply.github.com> Co-authored-by: Sandeep Kumar <83278309+tsdk02@users.noreply.github.com> Co-authored-by: Debarshi Gupta <debarshigupta47@gmail.com> Co-authored-by: Debarshi Gupta <debarshi.gupta@Debarshi-Gupta-CM92YWDXFD.local> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com> Co-authored-by: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com> Co-authored-by: pranav-arjunan <pranav.arjunan@juspay.in> Co-authored-by: Kashif <kashif.dev@protonmail.com> Co-authored-by: Sagnik Mitra <83326850+ImSagnik007@users.noreply.github.com> Co-authored-by: sweta-kumari-sharma <77436883+Sweta-Kumari-Sharma@users.noreply.github.com>
This commit is contained in:
		| @ -19,51 +19,69 @@ pub struct EphemeralKeyCreateRequest { | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v2")] | ||||
| /// Information required to create an ephemeral key. | ||||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] | ||||
| pub struct EphemeralKeyCreateRequest { | ||||
|     /// Customer ID for which an ephemeral key must be created | ||||
|     #[schema( | ||||
|         min_length = 32, | ||||
|         max_length = 64, | ||||
|         value_type = String, | ||||
|         example = "12345_cus_01926c58bc6e77c09e809964e72af8c8" | ||||
|     )] | ||||
|     pub customer_id: id_type::GlobalCustomerId, | ||||
| #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, ToSchema)] | ||||
| #[serde(rename_all = "snake_case")] | ||||
| pub enum ResourceId { | ||||
|     #[schema(value_type = String)] | ||||
|     Customer(id_type::GlobalCustomerId), | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v2")] | ||||
| /// ephemeral_key for the customer_id mentioned | ||||
| /// Information required to create a client secret. | ||||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] | ||||
| pub struct ClientSecretCreateRequest { | ||||
|     /// Resource ID for which a client secret must be created | ||||
|     pub resource_id: ResourceId, | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v2")] | ||||
| /// client_secret for the resource_id mentioned | ||||
| #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, Eq, PartialEq, ToSchema)] | ||||
| pub struct EphemeralKeyResponse { | ||||
|     /// Ephemeral key id | ||||
| pub struct ClientSecretResponse { | ||||
|     /// Client Secret id | ||||
|     #[schema(value_type = String, max_length = 32, min_length = 1)] | ||||
|     pub id: id_type::EphemeralKeyId, | ||||
|     /// customer_id to which this ephemeral key belongs to | ||||
|     #[schema(value_type = String, max_length = 64, min_length = 32, example = "12345_cus_01926c58bc6e77c09e809964e72af8c8")] | ||||
|     pub customer_id: id_type::GlobalCustomerId, | ||||
|     /// time at which this ephemeral key was created | ||||
|     pub id: id_type::ClientSecretId, | ||||
|     /// resource_id to which this client secret belongs to | ||||
|     #[schema(value_type = ResourceId)] | ||||
|     pub resource_id: ResourceId, | ||||
|     /// time at which this client secret was created | ||||
|     pub created_at: time::PrimitiveDateTime, | ||||
|     /// time at which this ephemeral key would expire | ||||
|     /// time at which this client secret would expire | ||||
|     pub expires: time::PrimitiveDateTime, | ||||
|     #[schema(value_type=String)] | ||||
|     /// ephemeral key | ||||
|     /// client secret | ||||
|     pub secret: Secret<String>, | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v1")] | ||||
| impl common_utils::events::ApiEventMetric for EphemeralKeyCreateRequest { | ||||
|     fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> { | ||||
|         Some(common_utils::events::ApiEventsType::Miscellaneous) | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v2")] | ||||
| impl common_utils::events::ApiEventMetric for EphemeralKeyResponse { | ||||
| #[cfg(feature = "v1")] | ||||
| impl common_utils::events::ApiEventMetric for EphemeralKeyCreateResponse { | ||||
|     fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> { | ||||
|         Some(common_utils::events::ApiEventsType::Miscellaneous) | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v2")] | ||||
| impl common_utils::events::ApiEventMetric for ClientSecretCreateRequest { | ||||
|     fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> { | ||||
|         Some(common_utils::events::ApiEventsType::Miscellaneous) | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v2")] | ||||
| impl common_utils::events::ApiEventMetric for ClientSecretResponse { | ||||
|     fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> { | ||||
|         Some(common_utils::events::ApiEventsType::Miscellaneous) | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v1")] | ||||
| /// ephemeral_key for the customer_id mentioned | ||||
| #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, Eq, PartialEq, ToSchema)] | ||||
| pub struct EphemeralKeyCreateResponse { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Narayan Bhat
					Narayan Bhat