feat(router): add external authentication webhooks flow (#4339)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sai Harsha Vardhan
2024-04-16 15:54:46 +05:30
committed by GitHub
parent d4dbaadb06
commit 00cd96d097
22 changed files with 512 additions and 95 deletions

View File

@ -22,6 +22,12 @@ pub trait AuthenticationInterface {
authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError>;
async fn find_authentication_by_merchant_id_connector_authentication_id(
&self,
merchant_id: String,
connector_authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError>;
async fn update_authentication_by_merchant_id_authentication_id(
&self,
previous_state: storage::Authentication,
@ -59,6 +65,21 @@ impl AuthenticationInterface for Store {
.map_err(|error| report!(errors::StorageError::from(error)))
}
async fn find_authentication_by_merchant_id_connector_authentication_id(
&self,
merchant_id: String,
connector_authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::Authentication::find_authentication_by_merchant_id_connector_authentication_id(
&conn,
&merchant_id,
&connector_authentication_id,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn update_authentication_by_merchant_id_authentication_id(
&self,
@ -124,6 +145,9 @@ impl AuthenticationInterface for MockDb {
acs_trans_id: authentication.acs_trans_id,
three_ds_server_trans_id: authentication.three_dsserver_trans_id,
acs_signed_content: authentication.acs_signed_content,
profile_id: authentication.profile_id,
payment_id: authentication.payment_id,
merchant_connector_id: authentication.merchant_connector_id,
};
authentications.push(authentication.clone());
Ok(authentication)
@ -145,6 +169,14 @@ impl AuthenticationInterface for MockDb {
).cloned()
}
async fn find_authentication_by_merchant_id_connector_authentication_id(
&self,
_merchant_id: String,
_connector_authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError> {
Err(errors::StorageError::MockDbError)?
}
async fn update_authentication_by_merchant_id_authentication_id(
&self,
previous_state: storage::Authentication,