mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(router): dynamically toggle KV for merchant and refactoring around it (#79)
This commit is contained in:
@ -274,7 +274,7 @@ pub async fn create_payment_connector(
|
||||
req: api::PaymentConnectorCreate,
|
||||
merchant_id: &String,
|
||||
) -> RouterResponse<api::PaymentConnectorCreate> {
|
||||
store
|
||||
let _merchant_account = store
|
||||
.find_merchant_account_by_merchant_id(merchant_id)
|
||||
.await
|
||||
.map_err(|error| {
|
||||
@ -332,6 +332,13 @@ pub async fn retrieve_payment_connector(
|
||||
merchant_id: String,
|
||||
merchant_connector_id: i32,
|
||||
) -> RouterResponse<api::PaymentConnectorCreate> {
|
||||
let _merchant_account = store
|
||||
.find_merchant_account_by_merchant_id(&merchant_id)
|
||||
.await
|
||||
.map_err(|error| {
|
||||
error.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
|
||||
})?;
|
||||
|
||||
let mca = store
|
||||
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
|
||||
&merchant_id,
|
||||
@ -366,11 +373,13 @@ pub async fn update_payment_connector(
|
||||
merchant_connector_id: i32,
|
||||
req: api::PaymentConnectorCreate,
|
||||
) -> RouterResponse<api::PaymentConnectorCreate> {
|
||||
db.find_merchant_account_by_merchant_id(merchant_id)
|
||||
let _merchant_account = db
|
||||
.find_merchant_account_by_merchant_id(merchant_id)
|
||||
.await
|
||||
.map_err(|error| {
|
||||
error.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
|
||||
})?;
|
||||
|
||||
let mca = db
|
||||
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
|
||||
merchant_id,
|
||||
@ -430,6 +439,13 @@ pub async fn delete_payment_connector(
|
||||
merchant_id: String,
|
||||
merchant_connector_id: i32,
|
||||
) -> RouterResponse<api::DeleteMcaResponse> {
|
||||
let _merchant_account = db
|
||||
.find_merchant_account_by_merchant_id(&merchant_id)
|
||||
.await
|
||||
.map_err(|error| {
|
||||
error.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
|
||||
})?;
|
||||
|
||||
let is_deleted = db
|
||||
.delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
|
||||
&merchant_id,
|
||||
|
||||
Reference in New Issue
Block a user