feat(core): add sessions api endpoint (#104)

This commit is contained in:
Narayan Bhat
2022-12-10 21:32:03 +05:30
committed by GitHub
parent 031c073e79
commit dff8b22489
30 changed files with 353 additions and 112 deletions

View File

@ -92,7 +92,6 @@ pub trait GetTracker<F, D, R>: Send {
state: &'a AppState,
payment_id: &api::PaymentIdType,
merchant_id: &str,
connector: types::Connector,
request: &R,
mandate_type: Option<api::MandateTxnType>,
storage_scheme: enums::MerchantStorageScheme,
@ -129,6 +128,12 @@ pub trait Domain<F: Clone, R>: Send + Sync {
) -> CustomResult<(), errors::ApiErrorResponse> {
Ok(())
}
async fn get_connector<'a>(
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse>;
}
#[async_trait]
@ -224,9 +229,14 @@ where
if helpers::check_if_operation_confirm(self) {
metrics::TASKS_ADDED_COUNT.add(&metrics::CONTEXT, 1, &[]); // Metrics
let connector_name = payment_attempt
.connector
.clone()
.ok_or(errors::ApiErrorResponse::InternalServerError)?;
let schedule_time = payment_sync::get_sync_process_schedule_time(
&*state.store,
&payment_attempt.connector,
&connector_name,
&payment_attempt.merchant_id,
0,
)
@ -245,6 +255,14 @@ where
Ok(())
}
}
async fn get_connector<'a>(
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
helpers::get_connector_default(merchant_account, state).await
}
}
#[async_trait]
@ -278,6 +296,14 @@ where
))
}
async fn get_connector<'a>(
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
helpers::get_connector_default(merchant_account, state).await
}
#[instrument(skip_all)]
async fn make_pm_data<'a>(
&'a self,
@ -351,6 +377,14 @@ where
)> {
Ok((Box::new(self), None))
}
async fn get_connector<'a>(
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
helpers::get_connector_default(merchant_account, state).await
}
}
#[async_trait]
@ -400,4 +434,12 @@ where
)> {
Ok((Box::new(self), None))
}
async fn get_connector<'a>(
&'a self,
merchant_account: &storage::MerchantAccount,
state: &AppState,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
helpers::get_connector_default(merchant_account, state).await
}
}