Skip to content

Commit

Permalink
added DuitNow
Browse files Browse the repository at this point in the history
  • Loading branch information
awasthi21 committed Sep 10, 2024
1 parent 21352cf commit 60771b2
Show file tree
Hide file tree
Showing 12 changed files with 247 additions and 88 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
Expand Down
1 change: 1 addition & 0 deletions config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
Expand Down
1 change: 1 addition & 0 deletions config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com"
fiuu.base_url = "https://pay.merchant.razer.com/"
fiuu.secondary_base_url="https://api.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
Expand Down
1 change: 1 addition & 0 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
Expand Down
1 change: 1 addition & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
Expand Down
1 change: 1 addition & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ fiserv.base_url = "https://cert.api.fiservapps.com/"
fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox"
fiuu.base_url = "https://sandbox.merchant.razer.com/"
fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"
fiuu.third_base_url="https://api.merchant.razer.com/"
forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
Expand Down
2 changes: 2 additions & 0 deletions crates/hyperswitch_connectors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ bytes = "1.6.0"
error-stack = "0.4.1"
hex = "0.4.3"
http = "0.2.12"
image = { version = "0.25.1", default-features = false, features = ["png"] }
once_cell = "1.19.0"
qrcode = "0.14.0"
rand = "0.8.5"
regex = "1.10.4"
reqwest = { version = "0.11.27" }
Expand Down
50 changes: 18 additions & 32 deletions crates/hyperswitch_connectors/src/connectors/fiuu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod transformers;

use std::collections::HashMap;

use common_enums::{CaptureMethod, PaymentMethodType};
use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};
use common_utils::{
errors::{self as common_errors, CustomResult},
ext_traits::BytesExt,
Expand Down Expand Up @@ -230,13 +230,19 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData

fn get_url(
&self,
_req: &PaymentsAuthorizeRouterData,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}RMS/API/Direct/1.4.0/index.php",
self.base_url(connectors)
))
match req.payment_method {
PaymentMethod::RealTimePayment => {
let base_url = connectors.fiuu.third_base_url.clone();
Ok(format!("{}RMS/API/staticqr/index.php", base_url))
}
_ => Ok(format!(
"{}RMS/API/Direct/1.4.0/index.php",
self.base_url(connectors)
)),
}
}

fn get_request_body(
Expand Down Expand Up @@ -284,7 +290,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
let response: fiuu::FiuuPaymentsResponse = res
.response
.parse_struct("Fiuu PaymentsAuthorizeResponse")
.parse_struct("Fiuu FiuuPaymentsResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
Expand Down Expand Up @@ -317,11 +323,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Fiu
_req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors
.fiuu
.secondary_base_url
.as_ref()
.ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?;
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{}RMS/API/gate-query/index.php", base_url))
}
fn get_request_body(
Expand Down Expand Up @@ -384,11 +386,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
_req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors
.fiuu
.secondary_base_url
.as_ref()
.ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?;
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{}RMS/API/capstxn/index.php", base_url))
}

Expand Down Expand Up @@ -462,11 +460,7 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Fi
_req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors
.fiuu
.secondary_base_url
.as_ref()
.ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?;
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{}RMS/API/refundAPI/refund.php", base_url))
}

Expand Down Expand Up @@ -531,11 +525,7 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Fiuu {
_req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors
.fiuu
.secondary_base_url
.as_ref()
.ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?;
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{}RMS/API/refundAPI/index.php", base_url))
}

Expand Down Expand Up @@ -607,11 +597,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Fiuu {
_req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors
.fiuu
.secondary_base_url
.as_ref()
.ok_or(errors::ConnectorError::FailedToObtainIntegrationUrl)?;
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{}RMS/API/refundAPI/q_by_txn.php", base_url))
}

Expand Down
Loading

0 comments on commit 60771b2

Please sign in to comment.