mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
feat(merchant_account): add merchant account list endpoint (#2560)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -252,6 +252,31 @@ pub async fn create_merchant_account(
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(feature = "olap")]
|
||||
pub async fn list_merchant_account(
|
||||
state: AppState,
|
||||
req: api_models::admin::MerchantAccountListRequest,
|
||||
) -> RouterResponse<Vec<api::MerchantAccountResponse>> {
|
||||
let merchant_accounts = state
|
||||
.store
|
||||
.list_merchant_accounts_by_organization_id(&req.organization_id)
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
|
||||
|
||||
let merchant_accounts = merchant_accounts
|
||||
.into_iter()
|
||||
.map(|merchant_account| {
|
||||
merchant_account
|
||||
.try_into()
|
||||
.change_context(errors::ApiErrorResponse::InvalidDataValue {
|
||||
field_name: "merchant_account",
|
||||
})
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
Ok(services::ApplicationResponse::Json(merchant_accounts))
|
||||
}
|
||||
|
||||
pub async fn get_merchant_account(
|
||||
state: AppState,
|
||||
req: api::MerchantId,
|
||||
|
||||
Reference in New Issue
Block a user