mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(payments): add client secret in redirect response (#1693)
This commit is contained in:
committed by
GitHub
parent
f48d6c4a2b
commit
f7d369afa8
@ -1435,6 +1435,7 @@ pub fn get_handle_response_url(
|
|||||||
merchant_account,
|
merchant_account,
|
||||||
redirection_response,
|
redirection_response,
|
||||||
payments_return_url,
|
payments_return_url,
|
||||||
|
response.client_secret.as_ref(),
|
||||||
)
|
)
|
||||||
.attach_printable("Failed to make merchant url with response")?;
|
.attach_printable("Failed to make merchant url with response")?;
|
||||||
|
|
||||||
@ -1445,6 +1446,7 @@ pub fn make_merchant_url_with_response(
|
|||||||
merchant_account: &domain::MerchantAccount,
|
merchant_account: &domain::MerchantAccount,
|
||||||
redirection_response: api::PgRedirectResponse,
|
redirection_response: api::PgRedirectResponse,
|
||||||
request_return_url: Option<&String>,
|
request_return_url: Option<&String>,
|
||||||
|
client_secret: Option<&masking::Secret<String>>,
|
||||||
) -> RouterResult<String> {
|
) -> RouterResult<String> {
|
||||||
// take return url if provided in the request else use merchant return url
|
// take return url if provided in the request else use merchant return url
|
||||||
let url = request_return_url
|
let url = request_return_url
|
||||||
@ -1453,14 +1455,20 @@ pub fn make_merchant_url_with_response(
|
|||||||
|
|
||||||
let status_check = redirection_response.status;
|
let status_check = redirection_response.status;
|
||||||
|
|
||||||
let payment_intent_id = redirection_response.payment_id;
|
let payment_client_secret = client_secret
|
||||||
|
.ok_or(errors::ApiErrorResponse::InternalServerError)
|
||||||
|
.into_report()
|
||||||
|
.attach_printable("Expected client secret to be `Some`")?;
|
||||||
|
|
||||||
let merchant_url_with_response = if merchant_account.redirect_to_merchant_with_http_post {
|
let merchant_url_with_response = if merchant_account.redirect_to_merchant_with_http_post {
|
||||||
url::Url::parse_with_params(
|
url::Url::parse_with_params(
|
||||||
url,
|
url,
|
||||||
&[
|
&[
|
||||||
("status", status_check.to_string()),
|
("status", status_check.to_string()),
|
||||||
("payment_intent_client_secret", payment_intent_id),
|
(
|
||||||
|
"payment_intent_client_secret",
|
||||||
|
payment_client_secret.peek().to_string(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.into_report()
|
.into_report()
|
||||||
@ -1472,7 +1480,10 @@ pub fn make_merchant_url_with_response(
|
|||||||
url,
|
url,
|
||||||
&[
|
&[
|
||||||
("status", status_check.to_string()),
|
("status", status_check.to_string()),
|
||||||
("payment_intent_client_secret", payment_intent_id),
|
(
|
||||||
|
"payment_intent_client_secret",
|
||||||
|
payment_client_secret.peek().to_string(),
|
||||||
|
),
|
||||||
("amount", amount.to_string()),
|
("amount", amount.to_string()),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user