Skip to content

Commit

Permalink
fix failing recurring mandates payment in the core
Browse files Browse the repository at this point in the history
  • Loading branch information
Aprabhat19 committed Jan 2, 2024
1 parent e06ba14 commit 71e490e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
6 changes: 3 additions & 3 deletions crates/router/src/connector/cybersource/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest {
};
let (action_list, action_token_types, authorization_options) = (
Some(vec![CybersourceActionsList::TokenCreate]),
Some(vec![CybersourceActionsTokenType::InstrumentIdentifier]),
Some(vec![CybersourceActionsTokenType::PaymentInstrument]),
Some(CybersourceAuthorizationOptions {
initiator: CybersourcePaymentInitiator {
initiator_type: Some(CybersourcePaymentInitiatorTypes::Customer),
Expand Down Expand Up @@ -169,7 +169,7 @@ pub enum CybersourceActionsList {
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum CybersourceActionsTokenType {
InstrumentIdentifier,
PaymentInstrument,
}

#[derive(Debug, Serialize)]
Expand Down Expand Up @@ -394,7 +394,7 @@ impl
if item.router_data.request.setup_future_usage.is_some() {
(
Some(vec![CybersourceActionsList::TokenCreate]),
Some(vec![CybersourceActionsTokenType::InstrumentIdentifier]),
Some(vec![CybersourceActionsTokenType::PaymentInstrument]),
Some(CybersourceAuthorizationOptions {
initiator: CybersourcePaymentInitiator {
initiator_type: Some(CybersourcePaymentInitiatorTypes::Customer),
Expand Down
20 changes: 1 addition & 19 deletions crates/router/src/core/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1770,25 +1770,7 @@ where
.unwrap_or(false);

let payment_data_and_tokenization_action = match connector {
Some(connector_name) if is_mandate => {
if connector_name == *"cybersource" {
let (_operation, payment_method_data) = operation
.to_domain()?
.make_pm_data(
state,
payment_data,
validate_result.storage_scheme,
merchant_key_store,
)
.await?;
payment_data.payment_method_data = payment_method_data;
}
(
payment_data.to_owned(),
TokenizationAction::SkipConnectorTokenization,
)
}
Some(connector) if is_operation_confirm(&operation) => {
Some(connector) if !is_mandate && is_operation_confirm(&operation) => {
let payment_method = &payment_data
.payment_attempt
.payment_method
Expand Down

0 comments on commit 71e490e

Please sign in to comment.