Skip to content

Commit

Permalink
feat(connectors): fiuu,novalnet,worldpay - extend NTI flows (#6946)
Browse files Browse the repository at this point in the history
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
kashif-m and hyperswitch-bot[bot] authored Jan 21, 2025
1 parent 90c932a commit d6b0660
Show file tree
Hide file tree
Showing 19 changed files with 605 additions and 172 deletions.
2 changes: 1 addition & 1 deletion config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ check_token_status_url= "" # base url to check token status from token servic
connector_list = "cybersource" # Supported connectors for network tokenization

[network_transaction_id_supported_connectors]
connector_list = "stripe,adyen,cybersource" # Supported connectors for network transaction id
connector_list = "adyen,cybersource,novalnet,stripe,worldpay" # Supported connectors for network transaction id

[grpc_client.dynamic_routing_client] # Dynamic Routing Client Configuration
host = "localhost" # Client Host
Expand Down
2 changes: 1 addition & 1 deletion config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup
card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card

[network_transaction_id_supported_connectors]
connector_list = "stripe,adyen,cybersource"
connector_list = "adyen,cybersource,novalnet,stripe,worldpay"


[payouts]
Expand Down
2 changes: 1 addition & 1 deletion config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ card.credit = { connector_list = "cybersource" } # Update Mandate sup
card.debit = { connector_list = "cybersource" } # Update Mandate supported payment method type and connector for card

[network_transaction_id_supported_connectors]
connector_list = "stripe,adyen,cybersource"
connector_list = "adyen,cybersource,novalnet,stripe,worldpay"


[payouts]
Expand Down
2 changes: 1 addition & 1 deletion config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ card.credit = { connector_list = "cybersource" }
card.debit = { connector_list = "cybersource" }

[network_transaction_id_supported_connectors]
connector_list = "stripe,adyen,cybersource"
connector_list = "adyen,cybersource,novalnet,stripe,worldpay"

[connector_request_reference_id_config]
merchant_ids_send_payment_id_as_connector_request_id = []
Expand Down
2 changes: 1 addition & 1 deletion config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ card.credit = { connector_list = "cybersource" }
card.debit = { connector_list = "cybersource" }

[network_transaction_id_supported_connectors]
connector_list = "stripe,adyen,cybersource"
connector_list = "adyen,cybersource,novalnet,stripe,worldpay"

[connector_customer]
connector_list = "gocardless,stax,stripe"
Expand Down
49 changes: 33 additions & 16 deletions crates/hyperswitch_connectors/src/connectors/fiuu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,23 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let url = if req.request.off_session == Some(true) {
format!(
let optional_is_mit_flow = req.request.off_session;
let optional_is_nti_flow = req
.request
.mandate_id
.as_ref()
.map(|mandate_id| mandate_id.is_network_transaction_id_flow());
let url = match (optional_is_mit_flow, optional_is_nti_flow) {
(Some(true), Some(false)) => format!(
"{}/RMS/API/Recurring/input_v7.php",
self.base_url(connectors)
)
} else {
format!(
"{}RMS/API/Direct/1.4.0/index.php",
self.base_url(connectors)
)
),
_ => {
format!(
"{}RMS/API/Direct/1.4.0/index.php",
self.base_url(connectors)
)
}
};
Ok(url)
}
Expand All @@ -280,14 +287,24 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
)?;

let connector_router_data = fiuu::FiuuRouterData::from((amount, req));
let connector_req = if req.request.off_session == Some(true) {
let recurring_request = fiuu::FiuuMandateRequest::try_from(&connector_router_data)?;
build_form_from_struct(recurring_request)
.change_context(errors::ConnectorError::ParsingFailed)?
} else {
let payment_request = fiuu::FiuuPaymentRequest::try_from(&connector_router_data)?;
build_form_from_struct(payment_request)
.change_context(errors::ConnectorError::ParsingFailed)?
let optional_is_mit_flow = req.request.off_session;
let optional_is_nti_flow = req
.request
.mandate_id
.as_ref()
.map(|mandate_id| mandate_id.is_network_transaction_id_flow());

let connector_req = match (optional_is_mit_flow, optional_is_nti_flow) {
(Some(true), Some(false)) => {
let recurring_request = fiuu::FiuuMandateRequest::try_from(&connector_router_data)?;
build_form_from_struct(recurring_request)
.change_context(errors::ConnectorError::ParsingFailed)?
}
_ => {
let payment_request = fiuu::FiuuPaymentRequest::try_from(&connector_router_data)?;
build_form_from_struct(payment_request)
.change_context(errors::ConnectorError::ParsingFailed)?
}
};
Ok(RequestContent::FormData(connector_req))
}
Expand Down
Loading

0 comments on commit d6b0660

Please sign in to comment.