Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(connector): [RAZORPAY] update generate_connector_request_reference_id to consume merchant_reference_id (#9404)

Aishwariyaa Anand9c176c4980d0
diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay.rs b/crates/hyperswitch_connectors/src/connectors/razorpay.rs
index 44f1b46293..5940451208 100644
--- a/crates/hyperswitch_connectors/src/connectors/razorpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/razorpay.rs
@@ -836,10 +836,14 @@ impl ConnectorSpecifications for Razorpay {
#[cfg(feature = "v2")]
fn generate_connector_request_reference_id(
&self,
- _payment_intent: &hyperswitch_domain_models::payments::PaymentIntent,
+ payment_intent: &hyperswitch_domain_models::payments::PaymentIntent,
_payment_attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt,
) -> String {
// The length of receipt for Razorpay order request should not exceed 40 characters.
- uuid::Uuid::now_v7().to_string()
+ payment_intent
+ .merchant_reference_id
+ .as_ref()
+ .map(|id| id.get_string_repr().to_owned())
+ .unwrap_or_else(|| uuid::Uuid::now_v7().to_string())
}
}