Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): [DLOCAL] Amount Conversion Fix (#9518)

DEEPANSHU BANSALdd52717955a7
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 8faaef32e4..77ae8196dc 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -703,10 +703,6 @@ instant_bank_transfer_poland = { country = "PL", currency = "PLN" }
instant_bank_transfer_finland = { country = "FI", currency = "EUR" }
sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,GB", currency = "EUR" }
-[pm_filters.dlocal]
-credit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-debit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-
[pm_filters.mollie]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 8a8dd2c4ac..6c7371ae43 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -722,10 +722,6 @@ instant_bank_transfer_poland = { country = "PL", currency = "PLN" }
instant_bank_transfer_finland = { country = "FI", currency = "EUR" }
sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,GB", currency = "EUR" }
-[pm_filters.dlocal]
-credit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-debit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-
[pm_filters.mollie]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index b5f6afd292..285fe39b35 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -726,10 +726,6 @@ instant_bank_transfer_poland = { country = "PL", currency = "PLN" }
instant_bank_transfer_finland = { country = "FI", currency = "EUR" }
sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,GB", currency = "EUR" }
-[pm_filters.dlocal]
-credit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-debit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-
[pm_filters.mollie]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
diff --git a/config/development.toml b/config/development.toml
index 853979d824..e613009b16 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -912,10 +912,6 @@ online_banking_fpx = { country = "MY", currency = "MYR" }
credit = { country = "CN,HK,ID,MY,PH,SG,TH,TW,VN", currency = "CNY,HKD,IDR,MYR,PHP,SGD,THB,TWD,VND" }
debit = { country = "CN,HK,ID,MY,PH,SG,TH,TW,VN", currency = "CNY,HKD,IDR,MYR,PHP,SGD,THB,TWD,VND" }
-[pm_filters.dlocal]
-credit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-debit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-
[pm_filters.inespay]
sepa = { country = "ES", currency = "EUR"}
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 64f88175e8..854eefe6d2 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -837,10 +837,6 @@ instant_bank_transfer_poland = { country = "PL", currency = "PLN" }
instant_bank_transfer_finland = { country = "FI", currency = "EUR" }
sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,GB", currency = "EUR" }
-[pm_filters.dlocal]
-credit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-debit = {country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW"}
-
[pm_filters.mollie]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal.rs b/crates/hyperswitch_connectors/src/connectors/dlocal.rs
index 69873cd5ca..653fe7397b 100644
--- a/crates/hyperswitch_connectors/src/connectors/dlocal.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dlocal.rs
@@ -8,7 +8,7 @@ use common_utils::{
errors::CustomResult,
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
+ types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
use error_stack::{report, ResultExt};
use hex::encode;
@@ -55,13 +55,13 @@ use crate::{
#[derive(Clone)]
pub struct Dlocal {
- amount_convertor: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),
+ amount_convertor: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync),
}
impl Dlocal {
pub fn new() -> &'static Self {
&Self {
- amount_convertor: &MinorUnitForConnector,
+ amount_convertor: &FloatMajorUnitForConnector,
}
}
}
@@ -89,16 +89,21 @@ where
connectors: &Connectors,
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
let dlocal_req = self.get_request_body(req, connectors)?;
-
let date = date_time::date_as_yyyymmddthhmmssmmmz()
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let auth = dlocal::DlocalAuthType::try_from(&req.connector_auth_type)?;
- let sign_req: String = format!(
- "{}{}{}",
- auth.x_login.peek(),
- date,
- dlocal_req.get_inner_value().peek().to_owned()
- );
+
+ let sign_req: String = if dlocal_req.get_inner_value().peek() == r#""{}""# {
+ format!("{}{}", auth.x_login.peek(), date)
+ } else {
+ format!(
+ "{}{}{}",
+ auth.x_login.peek(),
+ date,
+ dlocal_req.get_inner_value().peek()
+ )
+ };
+
let authz = crypto::HmacSha256::sign_message(
&crypto::HmacSha256,
auth.secret.peek().as_bytes(),
@@ -134,7 +139,7 @@ impl ConnectorCommon for Dlocal {
}
fn get_currency_unit(&self) -> api::CurrencyUnit {
- api::CurrencyUnit::Minor
+ api::CurrencyUnit::Base
}
fn common_get_content_type(&self) -> &'static str {
@@ -161,8 +166,8 @@ impl ConnectorCommon for Dlocal {
Ok(ErrorResponse {
status_code: res.status_code,
code: response.code.to_string(),
- message: response.message,
- reason: response.param,
+ message: response.message.clone(),
+ reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
@@ -310,11 +315,13 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Dlo
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- let sync_data = dlocal::DlocalPaymentsSyncRequest::try_from(req)?;
Ok(format!(
"{}payments/{}/status",
self.base_url(connectors),
- sync_data.authz_id,
+ req.request
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?
))
}
@@ -389,7 +396,14 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_req = dlocal::DlocalPaymentsCaptureRequest::try_from(req)?;
+ let amount = convert_amount(
+ self.amount_convertor,
+ req.request.minor_amount_to_capture,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = DlocalRouterData::try_from((amount, req))?;
+ let connector_req = dlocal::DlocalPaymentsCaptureRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
@@ -461,11 +475,10 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Dl
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- let cancel_data = dlocal::DlocalPaymentsCancelRequest::try_from(req)?;
Ok(format!(
"{}payments/{}/cancel",
self.base_url(connectors),
- cancel_data.cancel_id
+ req.request.connector_transaction_id.clone(),
))
}
@@ -619,11 +632,14 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Dlocal {
req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- let sync_data = dlocal::DlocalRefundsSyncRequest::try_from(req)?;
+ let refund_id = req.request.connector_refund_id.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "connector_refund_id",
+ },
+ )?;
Ok(format!(
- "{}refunds/{}/status",
+ "{}refunds/{refund_id}/status",
self.base_url(connectors),
- sync_data.refund_id,
))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
index 8beb4468be..2f833354bb 100644
--- a/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
@@ -1,6 +1,5 @@
use common_enums::enums;
-use common_utils::{pii::Email, request::Method, types::MinorUnit};
-use error_stack::ResultExt;
+use common_utils::{pii::Email, request::Method, types::FloatMajorUnit};
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{ConnectorAuthType, RouterData},
@@ -10,7 +9,7 @@ use hyperswitch_domain_models::{
types,
};
use hyperswitch_interfaces::errors;
-use masking::{PeekInterface, Secret};
+use masking::Secret;
use serde::{Deserialize, Serialize};
use url::Url;
@@ -21,21 +20,19 @@ use crate::{
#[derive(Debug, Default, Eq, PartialEq, Serialize)]
pub struct Payer {
- pub name: Option<Secret<String>>,
- pub email: Option<Email>,
+ pub name: Secret<String>,
+ pub email: Email,
pub document: Secret<String>,
}
#[derive(Debug, Default, Eq, Clone, PartialEq, Serialize, Deserialize)]
pub struct Card {
- pub holder_name: Secret<String>,
+ pub holder_name: Option<Secret<String>>,
pub number: cards::CardNumber,
pub cvv: Secret<String>,
pub expiration_month: Secret<String>,
pub expiration_year: Secret<String>,
pub capture: String,
- pub installments_id: Option<String>,
- pub installments: Option<String>,
}
#[derive(Debug, Default, Eq, PartialEq, Serialize)]
@@ -60,14 +57,14 @@ pub enum PaymentMethodFlow {
#[derive(Debug, Serialize)]
pub struct DlocalRouterData<T> {
- pub amount: MinorUnit,
+ pub amount: FloatMajorUnit,
pub router_data: T,
}
-impl<T> TryFrom<(MinorUnit, T)> for DlocalRouterData<T> {
+impl<T> TryFrom<(FloatMajorUnit, T)> for DlocalRouterData<T> {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from((amount, router_data): (MinorUnit, T)) -> Result<Self, Self::Error> {
+ fn try_from((amount, router_data): (FloatMajorUnit, T)) -> Result<Self, Self::Error> {
Ok(Self {
amount,
router_data,
@@ -75,11 +72,11 @@ impl<T> TryFrom<(MinorUnit, T)> for DlocalRouterData<T> {
}
}
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+#[derive(Default, Debug, Serialize, PartialEq)]
pub struct DlocalPaymentsRequest {
- pub amount: MinorUnit,
+ pub amount: FloatMajorUnit,
pub currency: enums::Currency,
- pub country: String,
+ pub country: enums::CountryAlpha2,
pub payment_method_id: PaymentMethodId,
pub payment_method_flow: PaymentMethodFlow,
pub payer: Payer,
@@ -95,10 +92,10 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP
fn try_from(
item: &DlocalRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
- let email = item.router_data.request.email.clone();
+ let email = item.router_data.request.get_email()?;
let address = item.router_data.get_billing_address()?;
- let country = address.get_country()?;
- let name = get_payer_name(address);
+ let country = *address.get_country()?;
+ let name = address.get_full_name()?;
match item.router_data.request.payment_method_data {
PaymentMethodData::Card(ref ccard) => {
let should_capture = matches!(
@@ -111,7 +108,7 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP
currency: item.router_data.request.currency,
payment_method_id: PaymentMethodId::Card,
payment_method_flow: PaymentMethodFlow::Direct,
- country: country.to_string(),
+ country,
payer: Payer {
name,
email,
@@ -119,28 +116,12 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP
document: get_doc_from_currency(country.to_string()),
},
card: Some(Card {
- holder_name: item
- .router_data
- .get_optional_billing_full_name()
- .unwrap_or(Secret::new("".to_string())),
+ holder_name: ccard.card_holder_name.clone(),
number: ccard.card_number.clone(),
cvv: ccard.card_cvc.clone(),
expiration_month: ccard.card_exp_month.clone(),
expiration_year: ccard.card_exp_year.clone(),
capture: should_capture.to_string(),
- installments_id: item
- .router_data
- .request
- .mandate_id
- .as_ref()
- .and_then(|ids| ids.mandate_id.clone()),
- // [#595[FEATURE] Pass Mandate history information in payment flows/request]
- installments: item
- .router_data
- .request
- .mandate_id
- .clone()
- .map(|_| "1".to_string()),
}),
order_id: item.router_data.connector_request_reference_id.clone(),
three_dsecure: match item.router_data.auth_type {
@@ -180,71 +161,26 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP
}
}
-fn get_payer_name(
- address: &hyperswitch_domain_models::address::AddressDetails,
-) -> Option<Secret<String>> {
- let first_name = address
- .first_name
- .clone()
- .map_or("".to_string(), |first_name| first_name.peek().to_string());
- let last_name = address
- .last_name
- .clone()
- .map_or("".to_string(), |last_name| last_name.peek().to_string());
- let name: String = format!("{first_name} {last_name}").trim().to_string();
- if !name.is_empty() {
- Some(Secret::new(name))
- } else {
- None
- }
-}
-
-pub struct DlocalPaymentsSyncRequest {
- pub authz_id: String,
-}
-
-impl TryFrom<&types::PaymentsSyncRouterData> for DlocalPaymentsSyncRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::PaymentsSyncRouterData) -> Result<Self, Self::Error> {
- Ok(Self {
- authz_id: (item
- .request
- .connector_transaction_id
- .get_connector_transaction_id()
- .change_context(errors::ConnectorError::MissingConnectorTransactionID)?),
- })
- }
-}
-
-pub struct DlocalPaymentsCancelRequest {
- pub cancel_id: String,
-}
-
-impl TryFrom<&types::PaymentsCancelRouterData> for DlocalPaymentsCancelRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::PaymentsCancelRouterData) -> Result<Self, Self::Error> {
- Ok(Self {
- cancel_id: item.request.connector_transaction_id.clone(),
- })
- }
-}
-
-#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+#[derive(Default, Debug, Serialize, PartialEq)]
pub struct DlocalPaymentsCaptureRequest {
pub authorization_id: String,
- pub amount: i64,
+ pub amount: FloatMajorUnit,
pub currency: String,
pub order_id: String,
}
-impl TryFrom<&types::PaymentsCaptureRouterData> for DlocalPaymentsCaptureRequest {
+impl TryFrom<&DlocalRouterData<&types::PaymentsCaptureRouterData>>
+ for DlocalPaymentsCaptureRequest
+{
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> {
+ fn try_from(
+ item: &DlocalRouterData<&types::PaymentsCaptureRouterData>,
+ ) -> Result<Self, Self::Error> {
Ok(Self {
- authorization_id: item.request.connector_transaction_id.clone(),
- amount: item.request.amount_to_capture,
- currency: item.request.currency.to_string(),
- order_id: item.connector_request_reference_id.clone(),
+ authorization_id: item.router_data.request.connector_transaction_id.clone(),
+ amount: item.amount,
+ currency: item.router_data.request.currency.to_string(),
+ order_id: item.router_data.connector_request_reference_id.clone(),
})
}
}
@@ -279,7 +215,6 @@ impl TryFrom<&ConnectorAuthType> for DlocalAuthType {
pub enum DlocalPaymentStatus {
Authorized,
Paid,
- Verified,
Cancelled,
#[default]
Pending,
@@ -290,11 +225,10 @@ impl From<DlocalPaymentStatus> for enums::AttemptStatus {
fn from(item: DlocalPaymentStatus) -> Self {
match item {
DlocalPaymentStatus::Authorized => Self::Authorized,
- DlocalPaymentStatus::Verified => Self::Authorized,
DlocalPaymentStatus::Paid => Self::Charged,
- DlocalPaymentStatus::Pending => Self::AuthenticationPending,
+ DlocalPaymentStatus::Pending => Self::Pending,
DlocalPaymentStatus::Cancelled => Self::Voided,
- DlocalPaymentStatus::Rejected => Self::AuthenticationFailed,
+ DlocalPaymentStatus::Rejected => Self::Failure,
}
}
}
@@ -437,7 +371,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, DlocalPaymentsCancelResponse, T, Paymen
// REFUND :
#[derive(Default, Debug, Serialize)]
pub struct DlocalRefundRequest {
- pub amount: String,
+ pub amount: FloatMajorUnit,
pub payment_id: String,
pub currency: enums::Currency,
pub id: String,
@@ -448,9 +382,8 @@ impl<F> TryFrom<&DlocalRouterData<&types::RefundsRouterData<F>>> for DlocalRefun
fn try_from(
item: &DlocalRouterData<&types::RefundsRouterData<F>>,
) -> Result<Self, Self::Error> {
- let amount_to_refund = item.router_data.request.refund_amount.to_string();
Ok(Self {
- amount: amount_to_refund,
+ amount: item.amount,
payment_id: item.router_data.request.connector_transaction_id.clone(),
currency: item.router_data.request.currency,
id: item.router_data.request.refund_id.clone(),
@@ -474,8 +407,7 @@ impl From<RefundStatus> for enums::RefundStatus {
match item {
RefundStatus::Success => Self::Success,
RefundStatus::Pending => Self::Pending,
- RefundStatus::Rejected => Self::ManualReview,
- RefundStatus::Cancelled => Self::Failure,
+ RefundStatus::Rejected | RefundStatus::Cancelled => Self::Failure,
}
}
}
@@ -504,24 +436,6 @@ impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>>
}
}
-#[derive(Default, Debug, Clone, Serialize, Deserialize)]
-pub struct DlocalRefundsSyncRequest {
- pub refund_id: String,
-}
-
-impl TryFrom<&types::RefundSyncRouterData> for DlocalRefundsSyncRequest {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &types::RefundSyncRouterData) -> Result<Self, Self::Error> {
- let refund_id = match item.request.connector_refund_id.clone() {
- Some(val) => val,
- None => item.request.refund_id.clone(),
- };
- Ok(Self {
- refund_id: (refund_id),
- })
- }
-}
-
impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for types::RefundsRouterData<RSync> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 29368b7e5c..9322d0ea69 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -356,10 +356,6 @@ google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN
samsung_pay = { currency = "USD,GBP,EUR,SEK" }
paze = { currency = "USD,SEK" }
-[pm_filters.dlocal]
-credit = { country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW" }
-debit = { country = "AR,BD,BO,BR,CM,CL,CN,CO,CR,DO,EC,SV,EG,GH,GT,HN,IN,ID,CI,JP,KE,MY,MX,MA,NI,NG,PK,PA,PY,PE,PH,RW,SA,SN,ZA,TZ,TH,TR,UG,UY,VN,ZM", currency = "ARS,BDT,BOB,BRL,XAF,CLP,CNY,COP,CRC,DOP,USD,EGP,GHS,GTQ,HNL,INR,IDR,XOF,JPY,KES,MYR,MXN,MAD,NIO,NGN,PKR,PYG,PEN,PHP,RWF,SAR,XOF,ZAR,TZS,THB,TRY,UGX,UYU,VND,ZMW" }
-
[pm_filters.mollie]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }