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:
ItsMeShashank
2023-05-17 15:39:00 +05:30
committed by GitHub
parent 2ce5d5ffe4
commit ed22b2af76
6 changed files with 21 additions and 7 deletions

View File

@ -1523,7 +1523,7 @@ pub struct GpayTransactionInfo {
/// The total price status (ex: 'FINAL')
pub total_price_status: String,
/// The total price
pub total_price: i64,
pub total_price: String,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]

View File

@ -10,7 +10,9 @@ use common_utils::{
use error_stack::{IntoReport, ResultExt};
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::{
configs::settings,
consts,
@ -517,7 +519,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
req: &types::PaymentsAuthorizeRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
match req.is_three_ds() {
match req.is_three_ds() && !req.request.is_wallet() {
true => Ok(format!(
"{}{}{}",
self.base_url(connectors),
@ -570,7 +572,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
data: &types::PaymentsAuthorizeRouterData,
res: Response,
) -> 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)) => {
let location = connector_utils::get_http_header("Location", &headers)?;
let payment_fields_token = location

View File

@ -170,6 +170,7 @@ pub trait PaymentsAuthorizeRequestData {
fn is_mandate_payment(&self) -> bool;
fn get_webhook_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>;
}
@ -234,6 +235,10 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
.clone()
.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> {
self.payment_method_type
.to_owned()

View File

@ -1098,7 +1098,7 @@ pub async fn list_payment_methods(
}
#[allow(clippy::too_many_arguments)]
async fn filter_payment_methods(
pub async fn filter_payment_methods(
payment_methods: Vec<serde_json::Value>,
req: &mut api::PaymentMethodListRequest,
resp: &mut Vec<ResponsePaymentMethodIntermediate>,

View File

@ -251,7 +251,14 @@ fn create_gpay_session_token(
country_code: session_data.country.unwrap_or_default(),
currency_code: router_data.request.currency.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 {

View File

@ -1282,7 +1282,7 @@ pub(crate) fn validate_pm_or_token_given(
}
// 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,
merchant_account: &merchant_account::MerchantAccount,
client_secret: Option<String>,