mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 20:23:43 +08:00
fix(merchant_account): change primary_business_details to vec in update (#877)
This commit is contained in:
@ -134,7 +134,7 @@ pub struct MerchantAccountUpdate {
|
|||||||
pub locker_id: Option<String>,
|
pub locker_id: Option<String>,
|
||||||
|
|
||||||
///Default business details for connector routing
|
///Default business details for connector routing
|
||||||
pub primary_business_details: Option<PrimaryBusinessDetails>,
|
pub primary_business_details: Option<Vec<PrimaryBusinessDetails>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, ToSchema, Serialize)]
|
#[derive(Clone, Debug, ToSchema, Serialize)]
|
||||||
|
|||||||
@ -89,11 +89,12 @@ pub async fn create_merchant_account(
|
|||||||
.attach_printable("Unexpected create API key response"),
|
.attach_printable("Unexpected create API key response"),
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
let primary_business_details =
|
let primary_business_details = utils::Encode::<Vec<PrimaryBusinessDetails>>::encode_to_value(
|
||||||
utils::Encode::<api::WebhookDetails>::encode_to_value(&get_primary_business_details(&req))
|
&get_primary_business_details(&req),
|
||||||
.change_context(errors::ApiErrorResponse::InvalidDataValue {
|
)
|
||||||
field_name: "primary_business_details",
|
.change_context(errors::ApiErrorResponse::InvalidDataValue {
|
||||||
})?;
|
field_name: "primary_business_details",
|
||||||
|
})?;
|
||||||
|
|
||||||
let merchant_details =
|
let merchant_details =
|
||||||
req.merchant_details
|
req.merchant_details
|
||||||
@ -214,6 +215,17 @@ pub async fn merchant_account_update(
|
|||||||
.attach_printable("Invalid routing algorithm given")?;
|
.attach_printable("Invalid routing algorithm given")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let primary_business_details = req
|
||||||
|
.primary_business_details
|
||||||
|
.as_ref()
|
||||||
|
.map(|primary_business_details| {
|
||||||
|
utils::Encode::<Vec<PrimaryBusinessDetails>>::encode_to_value(primary_business_details)
|
||||||
|
.change_context(errors::ApiErrorResponse::InvalidDataValue {
|
||||||
|
field_name: "primary_business_details",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.transpose()?;
|
||||||
|
|
||||||
let updated_merchant_account = storage::MerchantAccountUpdate::Update {
|
let updated_merchant_account = storage::MerchantAccountUpdate::Update {
|
||||||
merchant_name: req.merchant_name,
|
merchant_name: req.merchant_name,
|
||||||
|
|
||||||
@ -248,12 +260,7 @@ pub async fn merchant_account_update(
|
|||||||
locker_id: req.locker_id,
|
locker_id: req.locker_id,
|
||||||
metadata: req.metadata,
|
metadata: req.metadata,
|
||||||
publishable_key: None,
|
publishable_key: None,
|
||||||
primary_business_details: req
|
primary_business_details,
|
||||||
.primary_business_details
|
|
||||||
.as_ref()
|
|
||||||
.map(utils::Encode::<PrimaryBusinessDetails>::encode_to_value)
|
|
||||||
.transpose()
|
|
||||||
.change_context(errors::ApiErrorResponse::InternalServerError)?,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let response = db
|
let response = db
|
||||||
|
|||||||
Reference in New Issue
Block a user