mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
refactor(fix): [DLocal] Fix bug in DLocal (#1423)
Co-authored-by: Prasunna Soppa <70575890+prasunna09@users.noreply.github.com>
This commit is contained in:
@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
connector::utils::{AddressDetailsData, RouterData},
|
connector::utils::{AddressDetailsData, PaymentsAuthorizeRequestData, RouterData},
|
||||||
core::errors,
|
core::errors,
|
||||||
services,
|
services,
|
||||||
types::{self, api, storage::enums},
|
types::{self, api, storage::enums},
|
||||||
@ -63,6 +63,7 @@ pub struct DlocalPaymentsRequest {
|
|||||||
pub order_id: String,
|
pub order_id: String,
|
||||||
pub three_dsecure: Option<ThreeDSecureReqData>,
|
pub three_dsecure: Option<ThreeDSecureReqData>,
|
||||||
pub callback_url: Option<String>,
|
pub callback_url: Option<String>,
|
||||||
|
pub description: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<&types::PaymentsAuthorizeRouterData> for DlocalPaymentsRequest {
|
impl TryFrom<&types::PaymentsAuthorizeRouterData> for DlocalPaymentsRequest {
|
||||||
@ -112,7 +113,8 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for DlocalPaymentsRequest {
|
|||||||
}
|
}
|
||||||
storage_models::enums::AuthenticationType::NoThreeDs => None,
|
storage_models::enums::AuthenticationType::NoThreeDs => None,
|
||||||
},
|
},
|
||||||
callback_url: item.return_url.clone(),
|
callback_url: Some(item.request.get_router_return_url()?),
|
||||||
|
description: item.description.clone(),
|
||||||
};
|
};
|
||||||
Ok(payment_request)
|
Ok(payment_request)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -249,7 +249,7 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
|
|||||||
fn get_router_return_url(&self) -> Result<String, Error> {
|
fn get_router_return_url(&self) -> Result<String, Error> {
|
||||||
self.router_return_url
|
self.router_return_url
|
||||||
.clone()
|
.clone()
|
||||||
.ok_or_else(missing_field_err("webhook_url"))
|
.ok_or_else(missing_field_err("return_url"))
|
||||||
}
|
}
|
||||||
fn is_wallet(&self) -> bool {
|
fn is_wallet(&self) -> bool {
|
||||||
matches!(self.payment_method_data, api::PaymentMethodData::Wallet(_))
|
matches!(self.payment_method_data, api::PaymentMethodData::Wallet(_))
|
||||||
|
|||||||
@ -187,7 +187,8 @@ impl Payments {
|
|||||||
)
|
)
|
||||||
.service(
|
.service(
|
||||||
web::resource("/{payment_id}/{merchant_id}/redirect/response/{connector}")
|
web::resource("/{payment_id}/{merchant_id}/redirect/response/{connector}")
|
||||||
.route(web::get().to(payments_redirect_response)),
|
.route(web::get().to(payments_redirect_response))
|
||||||
|
.route(web::post().to(payments_redirect_response))
|
||||||
)
|
)
|
||||||
.service(
|
.service(
|
||||||
web::resource("/{payment_id}/{merchant_id}/redirect/complete/{connector}")
|
web::resource("/{payment_id}/{merchant_id}/redirect/complete/{connector}")
|
||||||
|
|||||||
@ -479,6 +479,7 @@ pub async fn payments_connector_session(
|
|||||||
pub async fn payments_redirect_response(
|
pub async fn payments_redirect_response(
|
||||||
state: web::Data<app::AppState>,
|
state: web::Data<app::AppState>,
|
||||||
req: actix_web::HttpRequest,
|
req: actix_web::HttpRequest,
|
||||||
|
json_payload: Option<web::Form<serde_json::Value>>,
|
||||||
path: web::Path<(String, String, String)>,
|
path: web::Path<(String, String, String)>,
|
||||||
) -> impl Responder {
|
) -> impl Responder {
|
||||||
let flow = Flow::PaymentsRedirect;
|
let flow = Flow::PaymentsRedirect;
|
||||||
@ -489,7 +490,7 @@ pub async fn payments_redirect_response(
|
|||||||
resource_id: payment_types::PaymentIdType::PaymentIntentId(payment_id),
|
resource_id: payment_types::PaymentIdType::PaymentIntentId(payment_id),
|
||||||
merchant_id: Some(merchant_id.clone()),
|
merchant_id: Some(merchant_id.clone()),
|
||||||
force_sync: true,
|
force_sync: true,
|
||||||
json_payload: None,
|
json_payload: json_payload.map(|payload| payload.0),
|
||||||
param: Some(param_string.to_string()),
|
param: Some(param_string.to_string()),
|
||||||
connector: Some(connector),
|
connector: Some(connector),
|
||||||
creds_identifier: None,
|
creds_identifier: None,
|
||||||
|
|||||||
Reference in New Issue
Block a user