fix(router): metadata field update in merchant_account and merchant_connector_account (#359)

Co-authored-by: Abhishek Marrivagu <abhi.codes10@gmail.com>
This commit is contained in:
chikke srujan
2023-01-18 15:56:09 +05:30
committed by GitHub
parent 0391f5ef01
commit b5ffff30df
9 changed files with 181 additions and 114 deletions

View File

@ -3,11 +3,10 @@ use masking::{Secret, StrongSecret};
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
pub use self::CreateMerchantAccount as MerchantAccountResponse;
use super::payments::AddressDetails;
use crate::{enums as api_enums, payment_methods};
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[derive(Clone, Debug, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct CreateMerchantAccount {
/// The identifier for the Merchant Account
@ -68,6 +67,69 @@ pub struct CreateMerchantAccount {
pub locker_id: Option<String>,
}
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct MerchantAccountResponse {
/// 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>>,
/// The URL to redirect after the completion of the operation
#[schema(max_length = 255, example = "https://www.example.com/success")]
pub return_url: 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: bool,
/// Refers to the Parent Merchant ID if the merchant being created is a sub-merchant
#[schema(max_length = 255, example = "xkkdf909012sdjki2dkh5sdf")]
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: bool,
/// Merchant related details
#[schema(value_type = Option<MerchantDetails>)]
pub merchant_details: Option<serde_json::Value>,
/// Webhook related details
#[schema(value_type = Option<WebhookDetails>)]
pub webhook_details: Option<serde_json::Value>,
/// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
#[schema(value_type = Option<RoutingAlgorithm>, max_length = 255, example = "custom")]
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>,
/// API key that will be used for server side API access
#[schema(example = "AH3423bkjbkjdsfbkj")]
pub publishable_key: Option<String>,
/// 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>,
/// 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, Serialize)]
#[serde(deny_unknown_fields)]
pub struct MerchantDetails {