mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
chore: v2 api changes for session token endpoint (#6032)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -145,7 +145,7 @@ where
|
||||
.validate_request(&req, &merchant_account)?;
|
||||
|
||||
tracing::Span::current().record("payment_id", format!("{}", validate_result.payment_id));
|
||||
|
||||
// get profile from headers
|
||||
let operations::GetTrackerResponse {
|
||||
operation,
|
||||
customer_details,
|
||||
@ -171,6 +171,7 @@ where
|
||||
|
||||
let (operation, customer) = operation
|
||||
.to_domain()?
|
||||
// get_customer_details
|
||||
.get_or_create_customer_details(
|
||||
state,
|
||||
&mut payment_data,
|
||||
|
||||
@ -517,10 +517,15 @@ pub struct Payments;
|
||||
impl Payments {
|
||||
pub fn server(state: AppState) -> Scope {
|
||||
let mut route = web::scope("/v2/payments").app_data(web::Data::new(state));
|
||||
route = route.service(
|
||||
web::resource("/{payment_id}/saved_payment_methods")
|
||||
.route(web::get().to(list_customer_payment_method_for_payment)),
|
||||
);
|
||||
route = route
|
||||
.service(
|
||||
web::resource("/{payment_id}/saved_payment_methods")
|
||||
.route(web::get().to(list_customer_payment_method_for_payment)),
|
||||
)
|
||||
.service(
|
||||
web::resource("/{payment_id}/create_external_sdk_tokens")
|
||||
.route(web::post().to(payments_connector_session)),
|
||||
);
|
||||
|
||||
route
|
||||
}
|
||||
|
||||
@ -529,6 +529,16 @@ pub async fn payments_dynamic_tax_calculation(
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::PaymentsSessionToken, payment_id))]
|
||||
pub async fn payments_connector_session(
|
||||
state: web::Data<app::AppState>,
|
||||
req: actix_web::HttpRequest,
|
||||
json_payload: web::Json<payment_types::PaymentsSessionRequest>,
|
||||
) -> impl Responder {
|
||||
"Session Response"
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::PaymentsSessionToken, payment_id))]
|
||||
pub async fn payments_connector_session(
|
||||
|
||||
@ -1237,6 +1237,7 @@ impl Authenticate for api_models::payment_methods::PaymentMethodListRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl Authenticate for api_models::payments::PaymentsSessionRequest {
|
||||
fn get_client_secret(&self) -> Option<&String> {
|
||||
Some(&self.client_secret)
|
||||
|
||||
Reference in New Issue
Block a user