mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix(router): aggregate critical hotfixes for v0.5.10 (#1162)
Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in> Co-authored-by: Jagan Elavarasan <jaganelavarasan@gmail.com> Co-authored-by: SamraatBansal <samraatbansal7@gmail.com> Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
@ -1523,7 +1523,7 @@ pub struct GpayTransactionInfo {
|
|||||||
/// The total price status (ex: 'FINAL')
|
/// The total price status (ex: 'FINAL')
|
||||||
pub total_price_status: String,
|
pub total_price_status: String,
|
||||||
/// The total price
|
/// The total price
|
||||||
pub total_price: i64,
|
pub total_price: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||||
|
|||||||
@ -10,7 +10,9 @@ use common_utils::{
|
|||||||
use error_stack::{IntoReport, ResultExt};
|
use error_stack::{IntoReport, ResultExt};
|
||||||
use transformers as bluesnap;
|
use transformers as bluesnap;
|
||||||
|
|
||||||
use super::utils::{self as connector_utils, RefundsRequestData, RouterData};
|
use super::utils::{
|
||||||
|
self as connector_utils, PaymentsAuthorizeRequestData, RefundsRequestData, RouterData,
|
||||||
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
configs::settings,
|
configs::settings,
|
||||||
consts,
|
consts,
|
||||||
@ -517,7 +519,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
|
|||||||
req: &types::PaymentsAuthorizeRouterData,
|
req: &types::PaymentsAuthorizeRouterData,
|
||||||
connectors: &settings::Connectors,
|
connectors: &settings::Connectors,
|
||||||
) -> CustomResult<String, errors::ConnectorError> {
|
) -> CustomResult<String, errors::ConnectorError> {
|
||||||
match req.is_three_ds() {
|
match req.is_three_ds() && !req.request.is_wallet() {
|
||||||
true => Ok(format!(
|
true => Ok(format!(
|
||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
self.base_url(connectors),
|
self.base_url(connectors),
|
||||||
@ -570,7 +572,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
|
|||||||
data: &types::PaymentsAuthorizeRouterData,
|
data: &types::PaymentsAuthorizeRouterData,
|
||||||
res: Response,
|
res: Response,
|
||||||
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
|
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
|
||||||
match (data.is_three_ds(), res.headers) {
|
match (data.is_three_ds() && !data.request.is_wallet(), res.headers) {
|
||||||
(true, Some(headers)) => {
|
(true, Some(headers)) => {
|
||||||
let location = connector_utils::get_http_header("Location", &headers)?;
|
let location = connector_utils::get_http_header("Location", &headers)?;
|
||||||
let payment_fields_token = location
|
let payment_fields_token = location
|
||||||
|
|||||||
@ -170,6 +170,7 @@ pub trait PaymentsAuthorizeRequestData {
|
|||||||
fn is_mandate_payment(&self) -> bool;
|
fn is_mandate_payment(&self) -> bool;
|
||||||
fn get_webhook_url(&self) -> Result<String, Error>;
|
fn get_webhook_url(&self) -> Result<String, Error>;
|
||||||
fn get_router_return_url(&self) -> Result<String, Error>;
|
fn get_router_return_url(&self) -> Result<String, Error>;
|
||||||
|
fn is_wallet(&self) -> bool;
|
||||||
fn get_payment_method_type(&self) -> Result<storage_models::enums::PaymentMethodType, Error>;
|
fn get_payment_method_type(&self) -> Result<storage_models::enums::PaymentMethodType, Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +235,10 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
|
|||||||
.clone()
|
.clone()
|
||||||
.ok_or_else(missing_field_err("webhook_url"))
|
.ok_or_else(missing_field_err("webhook_url"))
|
||||||
}
|
}
|
||||||
|
fn is_wallet(&self) -> bool {
|
||||||
|
matches!(self.payment_method_data, api::PaymentMethodData::Wallet(_))
|
||||||
|
}
|
||||||
|
|
||||||
fn get_payment_method_type(&self) -> Result<storage_models::enums::PaymentMethodType, Error> {
|
fn get_payment_method_type(&self) -> Result<storage_models::enums::PaymentMethodType, Error> {
|
||||||
self.payment_method_type
|
self.payment_method_type
|
||||||
.to_owned()
|
.to_owned()
|
||||||
|
|||||||
@ -1098,7 +1098,7 @@ pub async fn list_payment_methods(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
async fn filter_payment_methods(
|
pub async fn filter_payment_methods(
|
||||||
payment_methods: Vec<serde_json::Value>,
|
payment_methods: Vec<serde_json::Value>,
|
||||||
req: &mut api::PaymentMethodListRequest,
|
req: &mut api::PaymentMethodListRequest,
|
||||||
resp: &mut Vec<ResponsePaymentMethodIntermediate>,
|
resp: &mut Vec<ResponsePaymentMethodIntermediate>,
|
||||||
|
|||||||
@ -251,7 +251,14 @@ fn create_gpay_session_token(
|
|||||||
country_code: session_data.country.unwrap_or_default(),
|
country_code: session_data.country.unwrap_or_default(),
|
||||||
currency_code: router_data.request.currency.to_string(),
|
currency_code: router_data.request.currency.to_string(),
|
||||||
total_price_status: "Final".to_string(),
|
total_price_status: "Final".to_string(),
|
||||||
total_price: router_data.request.amount,
|
total_price: utils::to_currency_base_unit(
|
||||||
|
router_data.request.amount,
|
||||||
|
router_data.request.currency,
|
||||||
|
)
|
||||||
|
.attach_printable("Cannot convert given amount to base currency denomination".to_string())
|
||||||
|
.change_context(errors::ApiErrorResponse::InvalidDataValue {
|
||||||
|
field_name: "amount",
|
||||||
|
})?,
|
||||||
};
|
};
|
||||||
|
|
||||||
let response_router_data = types::PaymentsSessionRouterData {
|
let response_router_data = types::PaymentsSessionRouterData {
|
||||||
|
|||||||
@ -1282,7 +1282,7 @@ pub(crate) fn validate_pm_or_token_given(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A function to perform database lookup and then verify the client secret
|
// A function to perform database lookup and then verify the client secret
|
||||||
pub(crate) async fn verify_payment_intent_time_and_client_secret(
|
pub async fn verify_payment_intent_time_and_client_secret(
|
||||||
db: &dyn StorageInterface,
|
db: &dyn StorageInterface,
|
||||||
merchant_account: &merchant_account::MerchantAccount,
|
merchant_account: &merchant_account::MerchantAccount,
|
||||||
client_secret: Option<String>,
|
client_secret: Option<String>,
|
||||||
|
|||||||
Reference in New Issue
Block a user