Skip to content

Commit

Permalink
refactor: rename functions and add check for pix
Browse files Browse the repository at this point in the history
  • Loading branch information
swangi-kumari committed Jan 17, 2024
1 parent c8e3460 commit 3d15bbb
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions crates/router/src/core/payments/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ where
let next_action_voucher = voucher_next_steps_check(payment_attempt.clone())?;

let next_action_other_than_redirection =
other_next_action_check(payment_attempt.to_owned())?;
qr_code_next_action_check(payment_attempt.to_owned())?;

let next_action_containing_qr_code_url =
qr_code_next_steps_check(payment_attempt.clone())?;
Expand Down Expand Up @@ -845,15 +845,25 @@ pub fn qr_code_next_steps_check(
Ok(qr_code_instructions)
}

pub fn other_next_action_check(
pub fn qr_code_next_action_check(
payment_attempt: storage::PaymentAttempt,
) -> RouterResult<Option<api_models::payments::QrCodeInformation>> {
let next_action: Option<Result<api_models::payments::QrCodeInformation, _>> = payment_attempt
.connector_metadata
.map(|metadata| metadata.parse_value("QrCodeInformation"));
if let Some(diesel_models::enums::PaymentMethod::BankTransfer) = payment_attempt.payment_method
{
if payment_attempt.payment_method_type == Some(diesel_models::enums::PaymentMethodType::Pix)
{
let next_action: Option<Result<api_models::payments::QrCodeInformation, _>> =
payment_attempt
.connector_metadata
.map(|metadata| metadata.parse_value("QrCodeInformation"));

let next_action_steps = next_action.transpose().ok().flatten();
Ok(next_action_steps)
Ok(next_action.transpose().ok().flatten())
} else {
Ok(None)
}
} else {
Ok(None)
}
}

pub fn wait_screen_next_steps_check(
Expand Down

0 comments on commit 3d15bbb

Please sign in to comment.