feat(router): payment_method block (#3056)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: shashank_attarde <shashank.attarde@juspay.in>
This commit is contained in:
Prajjwal Kumar
2024-01-11 17:58:29 +05:30
committed by GitHub
parent e376f68c16
commit bb096138b5
60 changed files with 1649 additions and 38 deletions

View File

@ -10,6 +10,7 @@ use common_utils::{
ext_traits::{AsyncExt, ConfigExt, Encode, ValueExt},
pii,
};
use diesel_models::configs;
use error_stack::{report, FutureExt, IntoReport, ResultExt};
use futures::future::try_join_all;
use masking::{PeekInterface, Secret};
@ -141,6 +142,17 @@ pub async fn create_merchant_account(
.transpose()?
.map(Secret::new);
let fingerprint = Some(utils::generate_id(consts::FINGERPRINT_SECRET_LENGTH, "fs"));
if let Some(fingerprint) = fingerprint {
db.insert_config(configs::ConfigNew {
key: format!("fingerprint_secret_{}", req.merchant_id),
config: fingerprint,
})
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Mot able to generate Merchant fingerprint")?;
};
let organization_id = if let Some(organization_id) = req.organization_id.as_ref() {
db.find_organization_by_org_id(organization_id)
.await