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:
Hrithikesh
2024-10-07 20:20:26 +05:30
committed by GitHub
parent f4830ebaae
commit 6e355f34a8
10 changed files with 109 additions and 38 deletions

View File

@ -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,

View File

@ -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
}

View File

@ -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(

View File

@ -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)