mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
refactor(customer_v2): fixed customer_v2 create panic issue (#5699)
This commit is contained in:
@ -29,6 +29,22 @@ use crate::{
|
||||
impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudCheckResponseData>
|
||||
for FrmData
|
||||
{
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
async fn construct_router_data<'a>(
|
||||
&self,
|
||||
_state: &SessionState,
|
||||
_connector_id: &str,
|
||||
_merchant_account: &domain::MerchantAccount,
|
||||
_key_store: &domain::MerchantKeyStore,
|
||||
_customer: &Option<domain::Customer>,
|
||||
_merchant_connector_account: &helpers::MerchantConnectorAccountType,
|
||||
_merchant_recipient_data: Option<MerchantRecipientData>,
|
||||
) -> RouterResult<RouterData<frm_api::Checkout, FraudCheckCheckoutData, FraudCheckResponseData>>
|
||||
{
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
async fn construct_router_data<'a>(
|
||||
&self,
|
||||
_state: &SessionState,
|
||||
@ -50,9 +66,7 @@ impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudC
|
||||
})?;
|
||||
|
||||
let browser_info: Option<BrowserInformation> = self.payment_attempt.get_browser_info().ok();
|
||||
let customer_id = customer
|
||||
.to_owned()
|
||||
.map(|customer| customer.get_customer_id());
|
||||
let customer_id = customer.to_owned().map(|customer| customer.customer_id);
|
||||
|
||||
let router_data = RouterData {
|
||||
flow: std::marker::PhantomData,
|
||||
|
||||
@ -26,6 +26,22 @@ use crate::{
|
||||
impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudCheckResponseData>
|
||||
for FrmData
|
||||
{
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
async fn construct_router_data<'a>(
|
||||
&self,
|
||||
_state: &SessionState,
|
||||
_connector_id: &str,
|
||||
_merchant_account: &domain::MerchantAccount,
|
||||
_key_store: &domain::MerchantKeyStore,
|
||||
_customer: &Option<domain::Customer>,
|
||||
_merchant_connector_account: &helpers::MerchantConnectorAccountType,
|
||||
_merchant_recipient_data: Option<MerchantRecipientData>,
|
||||
) -> RouterResult<RouterData<RecordReturn, FraudCheckRecordReturnData, FraudCheckResponseData>>
|
||||
{
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
async fn construct_router_data<'a>(
|
||||
&self,
|
||||
_state: &SessionState,
|
||||
@ -46,9 +62,7 @@ impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudCh
|
||||
id: "ConnectorAuthType".to_string(),
|
||||
})?;
|
||||
|
||||
let customer_id = customer
|
||||
.to_owned()
|
||||
.map(|customer| customer.get_customer_id());
|
||||
let customer_id = customer.to_owned().map(|customer| customer.customer_id);
|
||||
let currency = self.payment_attempt.clone().currency;
|
||||
let router_data = RouterData {
|
||||
flow: std::marker::PhantomData,
|
||||
|
||||
@ -24,6 +24,21 @@ use crate::{
|
||||
impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckResponseData>
|
||||
for FrmData
|
||||
{
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
async fn construct_router_data<'a>(
|
||||
&self,
|
||||
_state: &SessionState,
|
||||
_connector_id: &str,
|
||||
_merchant_account: &domain::MerchantAccount,
|
||||
_key_store: &domain::MerchantKeyStore,
|
||||
_customer: &Option<domain::Customer>,
|
||||
_merchant_connector_account: &helpers::MerchantConnectorAccountType,
|
||||
_merchant_recipient_data: Option<MerchantRecipientData>,
|
||||
) -> RouterResult<RouterData<frm_api::Sale, FraudCheckSaleData, FraudCheckResponseData>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
async fn construct_router_data<'a>(
|
||||
&self,
|
||||
_state: &SessionState,
|
||||
@ -43,9 +58,7 @@ impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckResp
|
||||
id: "ConnectorAuthType".to_string(),
|
||||
})?;
|
||||
|
||||
let customer_id = customer
|
||||
.to_owned()
|
||||
.map(|customer| customer.get_customer_id());
|
||||
let customer_id = customer.to_owned().map(|customer| customer.customer_id);
|
||||
|
||||
let router_data = RouterData {
|
||||
flow: std::marker::PhantomData,
|
||||
|
||||
@ -29,6 +29,23 @@ impl
|
||||
FraudCheckResponseData,
|
||||
> for FrmData
|
||||
{
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
async fn construct_router_data<'a>(
|
||||
&self,
|
||||
_state: &SessionState,
|
||||
_connector_id: &str,
|
||||
_merchant_account: &domain::MerchantAccount,
|
||||
_key_store: &domain::MerchantKeyStore,
|
||||
_customer: &Option<domain::Customer>,
|
||||
_merchant_connector_account: &helpers::MerchantConnectorAccountType,
|
||||
_merchant_recipient_data: Option<MerchantRecipientData>,
|
||||
) -> RouterResult<
|
||||
RouterData<frm_api::Transaction, FraudCheckTransactionData, FraudCheckResponseData>,
|
||||
> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
async fn construct_router_data<'a>(
|
||||
&self,
|
||||
_state: &SessionState,
|
||||
@ -50,9 +67,7 @@ impl
|
||||
id: "ConnectorAuthType".to_string(),
|
||||
})?;
|
||||
|
||||
let customer_id = customer
|
||||
.to_owned()
|
||||
.map(|customer| customer.get_customer_id());
|
||||
let customer_id = customer.to_owned().map(|customer| customer.customer_id);
|
||||
|
||||
let payment_method = self.payment_attempt.payment_method;
|
||||
let currency = self.payment_attempt.currency;
|
||||
|
||||
@ -135,6 +135,22 @@ impl GetTracker<PaymentToFrmData> for FraudCheckPre {
|
||||
|
||||
#[async_trait]
|
||||
impl<F: Send + Clone> Domain<F> for FraudCheckPre {
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[instrument(skip_all)]
|
||||
async fn post_payment_frm<'a>(
|
||||
&'a self,
|
||||
_state: &'a SessionState,
|
||||
_req_state: ReqState,
|
||||
_payment_data: &mut payments::PaymentData<F>,
|
||||
_frm_data: &mut FrmData,
|
||||
_merchant_account: &domain::MerchantAccount,
|
||||
_customer: &Option<domain::Customer>,
|
||||
_key_store: domain::MerchantKeyStore,
|
||||
) -> RouterResult<Option<FrmRouterData>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[instrument(skip_all)]
|
||||
async fn post_payment_frm<'a>(
|
||||
&'a self,
|
||||
|
||||
Reference in New Issue
Block a user