mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
feat(core): Add support for v2 payments get intent using merchant reference id (#7123)
Co-authored-by: Chikke Srujan <chikke.srujan@Chikke-Srujan-N7WRTY72X7.local> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -185,4 +185,26 @@ impl PaymentIntentInterface for MockDb {
|
||||
|
||||
Ok(payment_intent.clone())
|
||||
}
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_intent_by_merchant_reference_id_profile_id(
|
||||
&self,
|
||||
_state: &KeyManagerState,
|
||||
merchant_reference_id: &common_utils::id_type::PaymentReferenceId,
|
||||
profile_id: &common_utils::id_type::ProfileId,
|
||||
_merchant_key_store: &MerchantKeyStore,
|
||||
_storage_scheme: &common_enums::MerchantStorageScheme,
|
||||
) -> error_stack::Result<PaymentIntent, StorageError> {
|
||||
let payment_intents = self.payment_intents.lock().await;
|
||||
let payment_intent = payment_intents
|
||||
.iter()
|
||||
.find(|payment_intent| {
|
||||
payment_intent.merchant_reference_id.as_ref() == Some(merchant_reference_id)
|
||||
&& payment_intent.profile_id.eq(profile_id)
|
||||
})
|
||||
.ok_or(StorageError::ValueNotFound(
|
||||
"PaymentIntent not found".to_string(),
|
||||
))?;
|
||||
|
||||
Ok(payment_intent.clone())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user