mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	fix(router): Payment link api contract change (#2975)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Kashif <mohammed.kashif@juspay.in> Co-authored-by: Kashif <kashif.dev@protonmail.com> Co-authored-by: hrithikeshvm <hrithikeshmylatty@gmail.com> Co-authored-by: hrithikeshvm <vmhrithikesh@gmail.com>
This commit is contained in:
		| @ -296,8 +296,14 @@ pub struct PaymentsRequest { | ||||
|  | ||||
|     /// additional data that might be required by hyperswitch | ||||
|     pub feature_metadata: Option<FeatureMetadata>, | ||||
|     /// payment link object required for generating the payment_link | ||||
|     pub payment_link_object: Option<PaymentLinkObject>, | ||||
|  | ||||
|     /// Whether to get the payment link (if applicable) | ||||
|     #[schema(default = false, example = true)] | ||||
|     pub payment_link: Option<bool>, | ||||
|  | ||||
|     /// custom payment link config for the particular payment | ||||
|     #[schema(value_type = Option<PaymentCreatePaymentLinkConfig>)] | ||||
|     pub payment_link_config: Option<PaymentCreatePaymentLinkConfig>, | ||||
|  | ||||
|     /// The business profile to use for this payment, if not passed the default business profile | ||||
|     /// associated with the merchant account will be used. | ||||
| @ -314,6 +320,11 @@ pub struct PaymentsRequest { | ||||
|     ///Request for an incremental authorization | ||||
|     pub request_incremental_authorization: Option<bool>, | ||||
|  | ||||
|     ///Will be used to expire client secret after certain amount of time to be supplied in seconds | ||||
|     ///(900) for 15 mins | ||||
|     #[schema(example = 900)] | ||||
|     pub session_expiry: Option<u32>, | ||||
|  | ||||
|     /// additional data related to some frm connectors | ||||
|     pub frm_metadata: Option<serde_json::Value>, | ||||
| } | ||||
| @ -3309,17 +3320,6 @@ mod tests { | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)] | ||||
| pub struct PaymentLinkObject { | ||||
|     #[serde(default, with = "common_utils::custom_serde::iso8601::option")] | ||||
|     pub link_expiry: Option<PrimitiveDateTime>, | ||||
|     pub merchant_custom_domain_name: Option<String>, | ||||
|     #[schema(value_type = PaymentLinkConfig)] | ||||
|     pub payment_link_config: Option<admin::PaymentLinkConfig>, | ||||
|     /// Custom merchant name for payment link | ||||
|     pub custom_merchant_name: Option<String>, | ||||
| } | ||||
|  | ||||
| #[derive(Default, Debug, serde::Deserialize, Clone, ToSchema, serde::Serialize)] | ||||
| pub struct RetrievePaymentLinkRequest { | ||||
|     pub client_secret: Option<String>, | ||||
| @ -3339,10 +3339,10 @@ pub struct RetrievePaymentLinkResponse { | ||||
|     pub amount: i64, | ||||
|     #[serde(with = "common_utils::custom_serde::iso8601")] | ||||
|     pub created_at: PrimitiveDateTime, | ||||
|     #[serde(default, with = "common_utils::custom_serde::iso8601::option")] | ||||
|     pub link_expiry: Option<PrimitiveDateTime>, | ||||
|     #[serde(with = "common_utils::custom_serde::iso8601::option")] | ||||
|     pub expiry: Option<PrimitiveDateTime>, | ||||
|     pub description: Option<String>, | ||||
|     pub status: String, | ||||
|     pub status: PaymentLinkStatus, | ||||
|     #[schema(value_type = Option<Currency>)] | ||||
|     pub currency: Option<api_enums::Currency>, | ||||
| } | ||||
| @ -3360,14 +3360,15 @@ pub struct PaymentLinkDetails { | ||||
|     pub pub_key: String, | ||||
|     pub client_secret: String, | ||||
|     pub payment_id: String, | ||||
|     #[serde(with = "common_utils::custom_serde::iso8601::option")] | ||||
|     pub expiry: Option<PrimitiveDateTime>, | ||||
|     #[serde(with = "common_utils::custom_serde::iso8601")] | ||||
|     pub session_expiry: PrimitiveDateTime, | ||||
|     pub merchant_logo: String, | ||||
|     pub return_url: String, | ||||
|     pub merchant_name: String, | ||||
|     pub order_details: Option<Vec<OrderDetailsWithStringAmount>>, | ||||
|     pub max_items_visible_after_collapse: i8, | ||||
|     pub sdk_theme: Option<String>, | ||||
|     pub theme: String, | ||||
|     pub merchant_description: Option<String>, | ||||
| } | ||||
|  | ||||
| #[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)] | ||||
| @ -3424,6 +3425,13 @@ pub struct PaymentLinkListResponse { | ||||
|     pub data: Vec<PaymentLinkResponse>, | ||||
| } | ||||
|  | ||||
| #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)] | ||||
| pub struct PaymentCreatePaymentLinkConfig { | ||||
|     #[serde(flatten)] | ||||
|     #[schema(value_type = Option<PaymentLinkConfigRequest>)] | ||||
|     pub config: admin::PaymentLinkConfigRequest, | ||||
| } | ||||
|  | ||||
| #[derive(Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)] | ||||
| pub struct OrderDetailsWithStringAmount { | ||||
|     /// Name of the product that is being purchased | ||||
| @ -3437,3 +3445,9 @@ pub struct OrderDetailsWithStringAmount { | ||||
|     /// Product Image link | ||||
|     pub product_img_link: Option<String>, | ||||
| } | ||||
|  | ||||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] | ||||
| pub enum PaymentLinkStatus { | ||||
|     Active, | ||||
|     Expired, | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Sahkal Poddar
					Sahkal Poddar