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

refactor(core): made provider field in ctp_service_details backward compatible (#7705)

Sahkal Poddarab3dcea82faf
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index fa4dd68ede..ecaf867c97 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -8710,9 +8710,6 @@
},
"CtpServiceDetails": {
"type": "object",
- "required": [
- "provider"
- ],
"properties": {
"merchant_transaction_id": {
"type": "string",
@@ -8730,7 +8727,12 @@
"nullable": true
},
"provider": {
- "$ref": "#/components/schemas/CtpServiceProvider"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CtpServiceProvider"
+ }
+ ],
+ "nullable": true
},
"encypted_payload": {
"type": "string",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 7d364fa972..233f44930e 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -10821,9 +10821,6 @@
},
"CtpServiceDetails": {
"type": "object",
- "required": [
- "provider"
- ],
"properties": {
"merchant_transaction_id": {
"type": "string",
@@ -10841,7 +10838,12 @@
"nullable": true
},
"provider": {
- "$ref": "#/components/schemas/CtpServiceProvider"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CtpServiceProvider"
+ }
+ ],
+ "nullable": true
},
"encypted_payload": {
"type": "string",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 817c5404da..779490205d 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1162,8 +1162,8 @@ pub struct CtpServiceDetails {
/// session transaction flow id
pub x_src_flow_id: Option<String>,
/// provider Eg: Visa, Mastercard
- #[schema(value_type = CtpServiceProvider)]
- pub provider: api_enums::CtpServiceProvider,
+ #[schema(value_type = Option<CtpServiceProvider>)]
+ pub provider: Option<api_enums::CtpServiceProvider>,
/// Encrypted payload
#[schema(value_type = Option<String>)]
pub encypted_payload: Option<Secret<String>>,
@@ -1171,7 +1171,7 @@ pub struct CtpServiceDetails {
impl CtpServiceDetails {
pub fn is_network_confirmation_call_required(&self) -> bool {
- self.provider == api_enums::CtpServiceProvider::Mastercard
+ self.provider == Some(api_enums::CtpServiceProvider::Mastercard)
}
}
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 5583dcba1e..5e63f78956 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -6817,7 +6817,13 @@ pub async fn decide_action_for_unified_authentication_service<F: Clone>(
&& business_profile.is_click_to_pay_enabled
&& payment_data.service_details.is_some()
{
- if *do_authorisation_confirmation {
+ let should_do_uas_confirmation_call = payment_data
+ .service_details
+ .as_ref()
+ .map(|details| details.is_network_confirmation_call_required())
+ .unwrap_or(true);
+
+ if *do_authorisation_confirmation && should_do_uas_confirmation_call {
Some(UnifiedAuthenticationServiceFlow::ClickToPayConfirmation)
} else {
Some(UnifiedAuthenticationServiceFlow::ClickToPayInitiate)
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs
index 2116c98d12..45d0ed9251 100644
--- a/crates/router/src/core/unified_authentication_service.rs
+++ b/crates/router/src/core/unified_authentication_service.rs
@@ -233,7 +233,8 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ClickToPay {
UNIFIED_AUTHENTICATION_SERVICE.to_string(),
authentication_confirmation_router_data,
)
- .await?;
+ .await
+ .ok(); // marking this as .ok() since this is not a required step at our end for completing the transaction
Ok(())
}