mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 01:57:45 +08:00 
			
		
		
		
	refactor(pm_list): modify pm list to support new api contract (#657)
Co-authored-by: Sangamesh <sangamesh.kulkarni@juspay.in>
This commit is contained in:
		| @ -5,7 +5,7 @@ use url; | ||||
| use utoipa::ToSchema; | ||||
|  | ||||
| use super::payments::AddressDetails; | ||||
| use crate::enums as api_enums; | ||||
| use crate::{enums as api_enums, payment_methods}; | ||||
|  | ||||
| #[derive(Clone, Debug, Deserialize, ToSchema)] | ||||
| #[serde(deny_unknown_fields)] | ||||
| @ -284,59 +284,23 @@ pub struct PaymentConnectorCreate { | ||||
|             "installment_payment_enabled": true | ||||
|         } | ||||
|     ]))] | ||||
|     pub payment_methods_enabled: Option<Vec<PaymentMethods>>, | ||||
|     pub payment_methods_enabled: Option<Vec<PaymentMethodsEnabled>>, | ||||
|     /// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object. | ||||
|     #[schema(value_type = Option<Object>,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))] | ||||
|     pub metadata: Option<serde_json::Value>, | ||||
| } | ||||
|  | ||||
| /// Details of all the payment methods enabled for the connector for the given merchant account | ||||
| #[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] | ||||
| #[serde(deny_unknown_fields)] | ||||
| pub struct PaymentMethods { | ||||
| pub struct PaymentMethodsEnabled { | ||||
|     /// Type of payment method. | ||||
|     #[schema(value_type = PaymentMethodType,example = "card")] | ||||
|     #[schema(value_type = PaymentMethod,example = "card")] | ||||
|     pub payment_method: api_enums::PaymentMethod, | ||||
|  | ||||
|     /// Subtype of payment method | ||||
|     #[schema(value_type = Option<Vec<PaymentMethodSubType>>,example = json!(["credit"]))] | ||||
|     pub payment_method_types: Option<Vec<api_enums::PaymentMethodType>>, | ||||
|     /// List of payment method issuers to be enabled for this payment method | ||||
|     #[schema(example = json!(["HDFC"]))] | ||||
|     pub payment_method_issuers: Option<Vec<String>>, | ||||
|     /// List of payment schemes accepted or has the processing capabilities of the processor | ||||
|     #[schema(example = json!(["MASTER","VISA","DINERS"]))] | ||||
|     pub payment_schemes: Option<Vec<String>>, | ||||
|     /// List of currencies accepted or has the processing capabilities of the processor | ||||
|     #[schema(example = json!( | ||||
|         { | ||||
|             "type": "enable_only", | ||||
|             "list": ["USD", "EUR"] | ||||
|         } | ||||
|     ))] | ||||
|     pub accepted_currencies: Option<AcceptedCurrencies>, | ||||
|     ///  List of Countries accepted or has the processing capabilities of the processor | ||||
|     #[schema(example = json!( | ||||
|         { | ||||
|             "type": "disable_only", | ||||
|             "list": ["FR", "DE","IN"] | ||||
|         } | ||||
|     ))] | ||||
|     pub accepted_countries: Option<AcceptedCountries>, | ||||
|     /// Minimum amount supported by the processor. To be represented in the lowest denomination of the target currency (For example, for USD it should be in cents) | ||||
|     #[schema(example = 1)] | ||||
|     pub minimum_amount: Option<i32>, | ||||
|     /// Maximum amount supported by the processor. To be represented in the lowest denomination of | ||||
|     /// the target currency (For example, for USD it should be in cents) | ||||
|     #[schema(example = 1313)] | ||||
|     pub maximum_amount: Option<i32>, | ||||
|     /// Boolean to enable recurring payments / mandates. Default is true. | ||||
|     #[schema(default = true, example = false)] | ||||
|     pub recurring_enabled: bool, | ||||
|     /// Boolean to enable installment / EMI / BNPL payments. Default is true. | ||||
|     #[schema(default = true, example = false)] | ||||
|     pub installment_payment_enabled: bool, | ||||
|     /// Type of payment experience enabled with the connector | ||||
|     #[schema(value_type = Option<Vec<PaymentExperience>>,example = json!(["redirect_to_url"]))] | ||||
|     pub payment_experience: Option<Vec<api_enums::PaymentExperience>>, | ||||
|     #[schema(value_type = Option<Vec<PaymentMethodType>>,example = json!(["credit"]))] | ||||
|     pub payment_method_types: Option<Vec<payment_methods::RequestPaymentMethodTypes>>, | ||||
| } | ||||
|  | ||||
| /// List of enabled and disabled currencies, empty in case all currencies are enabled | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Narayan Bhat
					Narayan Bhat