mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 20:23:43 +08:00
feat: multiple connector account support for the same country (#816)
Co-authored-by: Manoj Ghorela <118727120+manoj-juspay@users.noreply.github.com> Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
@ -66,6 +66,10 @@ pub struct MerchantAccountCreate {
|
||||
/// An identifier for the vault used to store payment method information.
|
||||
#[schema(example = "locker_abc123")]
|
||||
pub locker_id: Option<String>,
|
||||
|
||||
///Default business details for connector routing
|
||||
#[schema(value_type = PrimaryBusinessDetails)]
|
||||
pub primary_business_details: pii::SecretSerdeValue,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema)]
|
||||
@ -123,6 +127,9 @@ pub struct MerchantAccountUpdate {
|
||||
/// An identifier for the vault used to store payment method information.
|
||||
#[schema(example = "locker_abc123")]
|
||||
pub locker_id: Option<String>,
|
||||
|
||||
///Default business details for connector routing
|
||||
pub primary_business_details: Option<PrimaryBusinessDetails>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, ToSchema, Serialize)]
|
||||
@ -186,6 +193,9 @@ pub struct MerchantAccountResponse {
|
||||
/// An identifier for the vault used to store payment method information.
|
||||
#[schema(example = "locker_abc123")]
|
||||
pub locker_id: Option<String>,
|
||||
///Default business details for connector routing
|
||||
#[schema(value_type = Option<PrimaryBusinessDetails>)]
|
||||
pub primary_business_details: pii::SecretSerdeValue,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
||||
@ -236,6 +246,13 @@ pub enum RoutingAlgorithm {
|
||||
Single(api_enums::RoutableConnectors),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct PrimaryBusinessDetails {
|
||||
pub country: Vec<api_enums::CountryCode>,
|
||||
pub business: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct WebhookDetails {
|
||||
@ -299,6 +316,19 @@ pub struct MerchantConnector {
|
||||
/// Name of the Connector
|
||||
#[schema(example = "stripe")]
|
||||
pub connector_name: String,
|
||||
// /// Connector label for specific country and Business
|
||||
#[serde(skip_deserializing)]
|
||||
#[schema(example = "stripe_US_travel")]
|
||||
pub connector_label: String,
|
||||
/// Country through which payment should be processed
|
||||
#[schema(example = "US")]
|
||||
pub business_country: api_enums::CountryCode,
|
||||
///Business Type of the merchant
|
||||
#[schema(example = "travel")]
|
||||
pub business_label: String,
|
||||
/// Business Sub label of the merchant
|
||||
#[schema(example = "chase")]
|
||||
pub business_sub_label: Option<String>,
|
||||
/// Unique ID of the connector
|
||||
#[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
|
||||
pub merchant_connector_id: Option<String>,
|
||||
@ -347,6 +377,63 @@ pub struct MerchantConnector {
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct MerchantConnectorUpdate {
|
||||
/// Type of the Connector for the financial use case. Could range from Payments to Accounting to Banking.
|
||||
#[schema(value_type = ConnectorType, example = "payment_processor")]
|
||||
pub connector_type: api_enums::ConnectorType,
|
||||
|
||||
/// Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.
|
||||
#[schema(value_type = Option<Object>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
|
||||
pub connector_account_details: Option<pii::SecretSerdeValue>,
|
||||
|
||||
/// A boolean value to indicate if the connector is in Test mode. By default, its value is false.
|
||||
#[schema(default = false, example = false)]
|
||||
pub test_mode: Option<bool>,
|
||||
|
||||
/// A boolean value to indicate if the connector is disabled. By default, its value is false.
|
||||
#[schema(default = false, example = false)]
|
||||
pub disabled: Option<bool>,
|
||||
|
||||
/// Refers to the Parent Merchant ID if the merchant being created is a sub-merchant
|
||||
#[schema(example = json!([
|
||||
{
|
||||
"payment_method": "wallet",
|
||||
"payment_method_types": [
|
||||
"upi_collect",
|
||||
"upi_intent"
|
||||
],
|
||||
"payment_method_issuers": [
|
||||
"labore magna ipsum",
|
||||
"aute"
|
||||
],
|
||||
"payment_schemes": [
|
||||
"Discover",
|
||||
"Discover"
|
||||
],
|
||||
"accepted_currencies": {
|
||||
"type": "enable_only",
|
||||
"list": ["USD", "EUR"]
|
||||
},
|
||||
"accepted_countries": {
|
||||
"type": "disable_only",
|
||||
"list": ["FR", "DE","IN"]
|
||||
},
|
||||
"minimum_amount": 1,
|
||||
"maximum_amount": 68607706,
|
||||
"recurring_enabled": true,
|
||||
"installment_payment_enabled": true
|
||||
}
|
||||
]))]
|
||||
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<pii::SecretSerdeValue>,
|
||||
}
|
||||
|
||||
/// 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)]
|
||||
|
||||
@ -201,8 +201,19 @@ pub struct PaymentsRequest {
|
||||
#[schema(value_type = Option<PaymentMethodType>, example = "google_pay")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
||||
|
||||
/// Business country of the merchant for this payment
|
||||
#[schema(example = "US")]
|
||||
pub business_country: Option<api_enums::CountryCode>,
|
||||
|
||||
/// Business label of the merchant for this payment
|
||||
#[schema(example = "food")]
|
||||
pub business_label: Option<String>,
|
||||
|
||||
/// Merchant connector details used to make payments.
|
||||
pub merchant_connector_details: Option<admin::MerchantConnectorDetailsWrap>,
|
||||
|
||||
/// Business sub label for the payment
|
||||
pub business_sub_label: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, Copy, PartialEq, Eq)]
|
||||
@ -940,6 +951,19 @@ pub struct PaymentsResponse {
|
||||
/// Payment Method Type
|
||||
#[schema(value_type = Option<PaymentMethodType>, example = "gpay")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
||||
|
||||
/// The connector used for this payment along with the country and business details
|
||||
#[schema(example = "stripe_US_food")]
|
||||
pub connector_label: Option<String>,
|
||||
|
||||
/// The business country of merchant for this payment
|
||||
pub business_country: api_enums::CountryCode,
|
||||
|
||||
/// The business label of merchant for this payment
|
||||
pub business_label: String,
|
||||
|
||||
/// The business_sub_label for this payment
|
||||
pub business_sub_label: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, ToSchema)]
|
||||
|
||||
Reference in New Issue
Block a user