Skip to content

Commit

Permalink
Added currency filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ImSagnik007 committed Jan 20, 2025
1 parent a795500 commit 606831b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ debit = { currency = "USD" }
[pm_filters.fiuu]
duit_now = { country = "MY", currency = "MYR" }

[pm_filters.inespay]
sepa = { currency = "EUR" }

[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
Expand Down
14 changes: 11 additions & 3 deletions crates/hyperswitch_connectors/src/connectors/inespay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,17 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req.request.currency,
)?;

let connector_router_data = inespay::InespayRouterData::from((amount, req));
let connector_req = inespay::InespayPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
match req.request.currency {
common_enums::Currency::EUR => {
let connector_router_data = inespay::InespayRouterData::from((amount, req));
let connector_req = inespay::InespayPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
_ => Err(errors::ConnectorError::CurrencyNotSupported {
message: req.request.currency.to_string(),
connector: "Inespay",
}.into())
}
}

fn build_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub struct InespayPaymentsRequest {
description: String,
amount: StringMinorUnit,
reference: String,
debtor_account: Option<Secret<String>>,
success_link_redirect: Option<String>,
notif_url: Option<String>,
}
Expand All @@ -51,14 +52,15 @@ impl TryFrom<&InespayRouterData<&PaymentsAuthorizeRouterData>> for InespayPaymen
item: &InespayRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
PaymentMethodData::BankDebit(BankDebitData::SepaBankDebit { iban: _, .. }) => {
PaymentMethodData::BankDebit(BankDebitData::SepaBankDebit { iban, .. }) => {
let order_id = item.router_data.connector_request_reference_id.clone();
let webhook_url = item.router_data.request.get_webhook_url()?;
let return_url = item.router_data.request.get_router_return_url()?;
Ok(Self {
description: item.router_data.get_description()?,
amount: item.amount.clone(),
reference: order_id,
debtor_account: Some(iban),
success_link_redirect: Some(return_url),
notif_url: Some(webhook_url),
})
Expand Down

0 comments on commit 606831b

Please sign in to comment.