mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 09:38:33 +08:00
feat(router): updated last_used_at field for apple pay and google pay for CITs (#5087)
This commit is contained in:
@ -70,9 +70,11 @@ pub fn get_mandate_type(
|
|||||||
Ok(Some(api::MandateTransactionType::NewMandateTransaction))
|
Ok(Some(api::MandateTransactionType::NewMandateTransaction))
|
||||||
}
|
}
|
||||||
|
|
||||||
(_, _, Some(enums::FutureUsage::OffSession), _, Some(_)) | (_, Some(_), _, _, _) => Ok(
|
(_, _, Some(enums::FutureUsage::OffSession), _, Some(_))
|
||||||
Some(api::MandateTransactionType::RecurringMandateTransaction),
|
| (_, Some(_), _, _, _)
|
||||||
),
|
| (_, _, Some(enums::FutureUsage::OffSession), _, _) => Ok(Some(
|
||||||
|
api::MandateTransactionType::RecurringMandateTransaction,
|
||||||
|
)),
|
||||||
|
|
||||||
_ => Ok(None),
|
_ => Ok(None),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -533,6 +533,63 @@ pub async fn get_token_pm_type_mandate_details(
|
|||||||
mandate_generic_data.mandate_connector,
|
mandate_generic_data.mandate_connector,
|
||||||
mandate_generic_data.payment_method_info,
|
mandate_generic_data.payment_method_info,
|
||||||
)
|
)
|
||||||
|
} else if request.payment_method_type
|
||||||
|
== Some(api_models::enums::PaymentMethodType::ApplePay)
|
||||||
|
|| request.payment_method_type
|
||||||
|
== Some(api_models::enums::PaymentMethodType::GooglePay)
|
||||||
|
{
|
||||||
|
if let Some(customer_id) = &request.customer_id {
|
||||||
|
let customer_saved_pm_option = match state
|
||||||
|
.store
|
||||||
|
.find_payment_method_by_customer_id_merchant_id_list(
|
||||||
|
customer_id,
|
||||||
|
merchant_account.merchant_id.as_str(),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(customer_payment_methods) => Ok(customer_payment_methods
|
||||||
|
.iter()
|
||||||
|
.find(|payment_method| {
|
||||||
|
payment_method.payment_method_type
|
||||||
|
== request.payment_method_type
|
||||||
|
})
|
||||||
|
.cloned()),
|
||||||
|
Err(error) => {
|
||||||
|
if error.current_context().is_db_not_found() {
|
||||||
|
Ok(None)
|
||||||
|
} else {
|
||||||
|
Err(error)
|
||||||
|
.change_context(
|
||||||
|
errors::ApiErrorResponse::InternalServerError,
|
||||||
|
)
|
||||||
|
.attach_printable(
|
||||||
|
"failed to find payment methods for a customer",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}?;
|
||||||
|
|
||||||
|
(
|
||||||
|
None,
|
||||||
|
request.payment_method,
|
||||||
|
request.payment_method_type,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
customer_saved_pm_option,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(
|
||||||
|
None,
|
||||||
|
request.payment_method,
|
||||||
|
request.payment_method_type,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
(
|
(
|
||||||
request.payment_token.to_owned(),
|
request.payment_token.to_owned(),
|
||||||
|
|||||||
Reference in New Issue
Block a user