diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index 7ce98d3d5a34..af94afd88e82 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -95,23 +95,31 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest { let connector_merchant_config = CybersourceConnectorMetadataObject::try_from(&item.connector_meta_data)?; - let (action_list, action_token_types, authorization_options) = ( - Some(vec![CybersourceActionsList::TokenCreate]), - Some(vec![ - CybersourceActionsTokenType::PaymentInstrument, - CybersourceActionsTokenType::Customer, - ]), - Some(CybersourceAuthorizationOptions { - initiator: Some(CybersourcePaymentInitiator { - initiator_type: Some(CybersourcePaymentInitiatorTypes::Customer), - credential_stored_on_file: Some(true), - stored_credential_used: None, - }), - merchant_intitiated_transaction: None, - ignore_avs_result: connector_merchant_config.disable_avs, - ignore_cv_result: connector_merchant_config.disable_cvn, - }), - ); + let (action_list, action_token_types, authorization_options) = + match item.request.setup_future_usage { + Some(FutureUsage::OffSession) => { + let off_session_authorization_options = CybersourceAuthorizationOptions { + initiator: Some(CybersourcePaymentInitiator { + initiator_type: Some(CybersourcePaymentInitiatorTypes::Customer), + credential_stored_on_file: Some(true), + stored_credential_used: None, + }), + merchant_intitiated_transaction: None, + ignore_avs_result: connector_merchant_config.disable_avs, + ignore_cv_result: connector_merchant_config.disable_cvn, + }; + + ( + Some(vec![CybersourceActionsList::TokenCreate]), + Some(vec![ + CybersourceActionsTokenType::PaymentInstrument, + CybersourceActionsTokenType::Customer, + ]), + Some(off_session_authorization_options), + ) + } + Some(FutureUsage::OnSession) | None => (None, None, None), + }; let client_reference_information = ClientReferenceInformation { code: Some(item.connector_request_reference_id.clone()), @@ -2334,11 +2342,11 @@ impl ForeignFrom<(CybersourcePaymentStatus, bool)> for enums::AttemptStatus { | CybersourcePaymentStatus::ServerError => Self::Failure, CybersourcePaymentStatus::PendingAuthentication => Self::AuthenticationPending, CybersourcePaymentStatus::PendingReview - | CybersourcePaymentStatus::StatusNotReceived | CybersourcePaymentStatus::Challenge | CybersourcePaymentStatus::Accepted | CybersourcePaymentStatus::Pending | CybersourcePaymentStatus::AuthorizedPendingReview => Self::Pending, + CybersourcePaymentStatus::StatusNotReceived => Self::Unresolved, } } }