@@ -1525,6 +1525,70 @@ where
1525
1525
)
1526
1526
}
1527
1527
1528
+ #[ cfg( feature = "v2" ) ]
1529
+ #[ allow( clippy:: too_many_arguments) ]
1530
+ pub async fn payments_get_intent_using_merchant_reference (
1531
+ state : SessionState ,
1532
+ merchant_account : domain:: MerchantAccount ,
1533
+ profile : domain:: Profile ,
1534
+ key_store : domain:: MerchantKeyStore ,
1535
+ req_state : ReqState ,
1536
+ merchant_reference_id : & id_type:: PaymentReferenceId ,
1537
+ header_payload : HeaderPayload ,
1538
+ platform_merchant_account : Option < domain:: MerchantAccount > ,
1539
+ ) -> RouterResponse < api:: PaymentsIntentResponse > {
1540
+ let db = state. store . as_ref ( ) ;
1541
+ let storage_scheme = merchant_account. storage_scheme ;
1542
+ let key_manager_state = & ( & state) . into ( ) ;
1543
+ let payment_intent = db
1544
+ . find_payment_intent_by_merchant_reference_id_profile_id (
1545
+ key_manager_state,
1546
+ merchant_reference_id,
1547
+ profile. get_id ( ) ,
1548
+ & key_store,
1549
+ & storage_scheme,
1550
+ )
1551
+ . await
1552
+ . to_not_found_response ( errors:: ApiErrorResponse :: PaymentNotFound ) ?;
1553
+
1554
+ let ( payment_data, _req, customer) = Box :: pin ( payments_intent_operation_core :: <
1555
+ api:: PaymentGetIntent ,
1556
+ _ ,
1557
+ _ ,
1558
+ PaymentIntentData < api:: PaymentGetIntent > ,
1559
+ > (
1560
+ & state,
1561
+ req_state,
1562
+ merchant_account. clone ( ) ,
1563
+ profile. clone ( ) ,
1564
+ key_store. clone ( ) ,
1565
+ operations:: PaymentGetIntent ,
1566
+ api_models:: payments:: PaymentsGetIntentRequest {
1567
+ id : payment_intent. get_id ( ) . clone ( ) ,
1568
+ } ,
1569
+ payment_intent. get_id ( ) . clone ( ) ,
1570
+ header_payload. clone ( ) ,
1571
+ platform_merchant_account,
1572
+ ) )
1573
+ . await ?;
1574
+
1575
+ transformers:: ToResponse :: <
1576
+ api:: PaymentGetIntent ,
1577
+ PaymentIntentData < api:: PaymentGetIntent > ,
1578
+ operations:: PaymentGetIntent ,
1579
+ > :: generate_response (
1580
+ payment_data,
1581
+ customer,
1582
+ & state. base_url ,
1583
+ operations:: PaymentGetIntent ,
1584
+ & state. conf . connector_request_reference_id_config ,
1585
+ None ,
1586
+ None ,
1587
+ header_payload. x_hs_latency ,
1588
+ & merchant_account,
1589
+ )
1590
+ }
1591
+
1528
1592
#[ cfg( feature = "v2" ) ]
1529
1593
#[ allow( clippy:: too_many_arguments) ]
1530
1594
pub async fn payments_core < F , Res , Req , Op , FData , D > (
0 commit comments