mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
docs: Update naming conventions and added examples (#709)
Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
This commit is contained in:
@ -9,7 +9,68 @@ use crate::{enums as api_enums, payment_methods};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct CreateMerchantAccount {
|
||||
pub struct MerchantAccountCreate {
|
||||
/// The identifier for the Merchant Account
|
||||
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
|
||||
pub merchant_id: String,
|
||||
|
||||
/// Name of the Merchant Account
|
||||
#[schema(example = "NewAge Retailer")]
|
||||
pub merchant_name: Option<String>,
|
||||
|
||||
/// API key that will be used for server side API access
|
||||
#[schema(value_type = Option<String>, example = "Ah2354543543523")]
|
||||
pub api_key: Option<StrongSecret<String>>,
|
||||
|
||||
/// Merchant related details
|
||||
pub merchant_details: Option<MerchantDetails>,
|
||||
|
||||
/// The URL to redirect after the completion of the operation
|
||||
#[schema(value_type = Option<String>, max_length = 255, example = "https://www.example.com/success")]
|
||||
pub return_url: Option<url::Url>,
|
||||
|
||||
/// Webhook related details
|
||||
pub webhook_details: Option<WebhookDetails>,
|
||||
|
||||
/// The routing algorithm to be used for routing payments to desired connectors
|
||||
#[schema(value_type = Option<Object>,example = json!({"type": "single", "data": "stripe"}))]
|
||||
pub routing_algorithm: Option<serde_json::Value>,
|
||||
|
||||
/// A boolean value to indicate if the merchant is a sub-merchant under a master or a parent merchant. By default, its value is false.
|
||||
#[schema(default = false, example = false)]
|
||||
pub sub_merchants_enabled: Option<bool>,
|
||||
|
||||
/// Refers to the Parent Merchant ID if the merchant being created is a sub-merchant
|
||||
#[schema(max_length = 255, example = "xkkdf909012sdjki2dkh5sdf")]
|
||||
pub parent_merchant_id: Option<String>,
|
||||
|
||||
/// A boolean value to indicate if payment response hash needs to be enabled
|
||||
#[schema(default = false, example = true)]
|
||||
pub enable_payment_response_hash: Option<bool>,
|
||||
|
||||
/// Refers to the hash key used for payment response
|
||||
pub payment_response_hash_key: Option<String>,
|
||||
|
||||
/// A boolean value to indicate if redirect to merchant with http post needs to be enabled
|
||||
#[schema(default = false, example = true)]
|
||||
pub redirect_to_merchant_with_http_post: Option<bool>,
|
||||
|
||||
/// 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>, example = r#"{ "city": "NY", "unit": "245" }"#)]
|
||||
pub metadata: Option<serde_json::Value>,
|
||||
|
||||
/// API key that will be used for server side API access
|
||||
#[schema(example = "AH3423bkjbkjdsfbkj")]
|
||||
pub publishable_key: Option<String>,
|
||||
|
||||
/// An identifier for the vault used to store payment method information.
|
||||
#[schema(example = "locker_abc123")]
|
||||
pub locker_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct MerchantAccountUpdate {
|
||||
/// The identifier for the Merchant Account
|
||||
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
|
||||
pub merchant_id: String,
|
||||
@ -212,7 +273,7 @@ pub struct WebhookDetails {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, ToSchema)]
|
||||
pub struct DeleteMerchantAccountResponse {
|
||||
pub struct MerchantAccountDeleteResponse {
|
||||
/// The identifier for the Merchant Account
|
||||
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
|
||||
pub merchant_id: String,
|
||||
@ -232,10 +293,10 @@ pub struct MerchantConnectorId {
|
||||
pub merchant_connector_id: String,
|
||||
}
|
||||
|
||||
/// Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
|
||||
/// 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 PaymentConnectorCreate {
|
||||
pub struct MerchantConnector {
|
||||
/// 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,
|
||||
@ -311,7 +372,7 @@ pub struct AcceptedCurrencies {
|
||||
#[serde(rename = "type")]
|
||||
pub accept_type: String,
|
||||
/// List of currencies of the provided type
|
||||
#[schema(value_type = Option<Vec<Currency>>)]
|
||||
#[schema(value_type = Option<Vec<Currency>>,example = json!(["USD", "EUR"]))]
|
||||
pub list: Option<Vec<api_enums::Currency>>,
|
||||
}
|
||||
|
||||
@ -323,11 +384,12 @@ pub struct AcceptedCountries {
|
||||
#[serde(rename = "type")]
|
||||
pub accept_type: String,
|
||||
/// List of countries of the provided type
|
||||
#[schema(example = json!(["FR", "DE","IN"]))]
|
||||
pub list: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||
pub struct DeleteMcaResponse {
|
||||
pub struct MerchantConnectorDeleteResponse {
|
||||
/// The identifier for the Merchant Account
|
||||
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
|
||||
pub merchant_id: String,
|
||||
|
||||
Reference in New Issue
Block a user