mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 13:30:39 +08:00
feat(connector): [Iatapay] add upi qr support (#4728)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: SamraatBansal <55536657+SamraatBansal@users.noreply.github.com>
This commit is contained in:
@ -1009,6 +1009,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
|
||||
api_models::payments::NextActionData::DisplayBankTransferInformation { .. } => None,
|
||||
api_models::payments::NextActionData::ThirdPartySdkSessionToken { .. } => None,
|
||||
api_models::payments::NextActionData::QrCodeInformation{..} => None,
|
||||
api_models::payments::NextActionData::FetchQrCodeInformation{..} => None,
|
||||
api_models::payments::NextActionData::DisplayVoucherInformation{ .. } => None,
|
||||
api_models::payments::NextActionData::WaitScreenInformation{..} => None,
|
||||
api_models::payments::NextActionData::ThreeDsInvoke{..} => None,
|
||||
|
||||
@ -2338,7 +2338,7 @@ pub fn validate_payment_method_type_against_payment_method(
|
||||
),
|
||||
api_enums::PaymentMethod::Upi => matches!(
|
||||
payment_method_type,
|
||||
api_enums::PaymentMethodType::UpiCollect
|
||||
api_enums::PaymentMethodType::UpiCollect | api_enums::PaymentMethodType::UpiIntent
|
||||
),
|
||||
api_enums::PaymentMethod::Voucher => matches!(
|
||||
payment_method_type,
|
||||
@ -4252,9 +4252,9 @@ pub fn get_key_params_for_surcharge_details(
|
||||
)),
|
||||
api_models::payments::PaymentMethodData::MandatePayment => None,
|
||||
api_models::payments::PaymentMethodData::Reward => None,
|
||||
api_models::payments::PaymentMethodData::Upi(_) => Some((
|
||||
api_models::payments::PaymentMethodData::Upi(upi_data) => Some((
|
||||
common_enums::PaymentMethod::Upi,
|
||||
common_enums::PaymentMethodType::UpiCollect,
|
||||
upi_data.get_payment_method_type(),
|
||||
None,
|
||||
)),
|
||||
api_models::payments::PaymentMethodData::Voucher(voucher) => Some((
|
||||
|
||||
@ -541,6 +541,9 @@ where
|
||||
|
||||
let papal_sdk_next_action = paypal_sdk_next_steps_check(payment_attempt.clone())?;
|
||||
|
||||
let next_action_containing_fetch_qr_code_url =
|
||||
fetch_qr_code_url_next_steps_check(payment_attempt.clone())?;
|
||||
|
||||
let next_action_containing_wait_screen =
|
||||
wait_screen_next_steps_check(payment_attempt.clone())?;
|
||||
|
||||
@ -550,6 +553,7 @@ where
|
||||
|| next_action_containing_qr_code_url.is_some()
|
||||
|| next_action_containing_wait_screen.is_some()
|
||||
|| papal_sdk_next_action.is_some()
|
||||
|| next_action_containing_fetch_qr_code_url.is_some()
|
||||
|| payment_data.authentication.is_some()
|
||||
{
|
||||
next_action_response = bank_transfer_next_steps
|
||||
@ -566,6 +570,11 @@ where
|
||||
.or(next_action_containing_qr_code_url.map(|qr_code_data| {
|
||||
api_models::payments::NextActionData::foreign_from(qr_code_data)
|
||||
}))
|
||||
.or(next_action_containing_fetch_qr_code_url.map(|fetch_qr_code_data| {
|
||||
api_models::payments::NextActionData::FetchQrCodeInformation {
|
||||
qr_code_fetch_url: fetch_qr_code_data.qr_code_fetch_url
|
||||
}
|
||||
}))
|
||||
.or(papal_sdk_next_action.map(|paypal_next_action_data| {
|
||||
api_models::payments::NextActionData::InvokeSdkClient{
|
||||
next_action_data: paypal_next_action_data
|
||||
@ -899,6 +908,18 @@ pub fn paypal_sdk_next_steps_check(
|
||||
Ok(paypal_next_steps)
|
||||
}
|
||||
|
||||
pub fn fetch_qr_code_url_next_steps_check(
|
||||
payment_attempt: storage::PaymentAttempt,
|
||||
) -> RouterResult<Option<api_models::payments::FetchQrCodeInformation>> {
|
||||
let qr_code_steps: Option<Result<api_models::payments::FetchQrCodeInformation, _>> =
|
||||
payment_attempt
|
||||
.connector_metadata
|
||||
.map(|metadata| metadata.parse_value("FetchQrCodeInformation"));
|
||||
|
||||
let qr_code_fetch_url = qr_code_steps.transpose().ok().flatten();
|
||||
Ok(qr_code_fetch_url)
|
||||
}
|
||||
|
||||
pub fn wait_screen_next_steps_check(
|
||||
payment_attempt: storage::PaymentAttempt,
|
||||
) -> RouterResult<Option<api_models::payments::WaitScreenInstructions>> {
|
||||
@ -1108,8 +1129,8 @@ impl ForeignFrom<api_models::payments::QrCodeInformation> for api_models::paymen
|
||||
display_to_timestamp,
|
||||
} => Self::QrCodeInformation {
|
||||
qr_code_url: Some(qr_code_url),
|
||||
display_to_timestamp,
|
||||
image_data_url: None,
|
||||
display_to_timestamp,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user