text stringlengths 70 351k | source stringclasses 4
values |
|---|---|
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/transformers.rs | crate: router
header_payload,
connector_mandate_request_reference_id,
authentication_id: None,
psd2_sca_exemption_type: None,
};
Ok(router_data)
}
#[cfg(all(any(feature = "v1", feature = "v2")... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/transformers.rs | crate: router
header_payload,
connector_mandate_request_reference_id: None,
psd2_sca_exemption_type: None,
authentication_id: None,
};
Ok(router_data)
}
#[cfg(feature = "v2")]
#[instrument(ski... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/transformers.rs | crate: router
additional_merchant_data: None,
header_payload: None,
connector_mandate_request_reference_id,
authentication_id: None,
psd2_sca_exemption_type: None,
};
Ok(router_data)
}
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
});
}
}
};
}
common_types::payments::XenditSplitRequest::SingleSplit(_) => (),
},
None => (),
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
if skip_saving_wallet_at_connector.contains(&payment_method_type) {
logger::debug!("Override setup_future_usage from off_session to on_session based on the merchant's skip_saving_wallet_at_... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
serde_json::from_str::<Vec<storage_enums::PaymentMethodType>>(&conf.config)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("skip_save_wallet_at_con... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
pub fn get_redis_key_for_extended_card_info(
merchant_id: &id_type::MerchantId,
payment_id: &id_type::PaymentId,
) -> String {
format!(
"{}_{}_extended_card_info",
merchant_id.get_string_repr(),
payment_... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
ExternalAuthenticationInitiate {
acquirer_details: Option<authentication::types::AcquirerDetails>,
card: Box<hyperswitch_domain_models::payment_method_data::Card>,
token: String,
},
Externa... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
api_models::payments::AdditionalPaymentData::PayLater { .. },
AdditionalPaymentMethodConnectorResponse::PayLater {
klarna_sdk: Some(KlarnaSdkResponse { payment_type }),
},
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
if !(consts::MIN_INTENT_FULFILLMENT_EXPIRY..=consts::MAX_INTENT_FULFILLMENT_EXPIRY)
.contains(&intent_fulfillment_time)
{
Err(errors::ApiErrorResponse::InvalidRequestData {
message: "intent... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64_ENGINE},
core::{
authentication,
... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use redis_interface::errors::RedisError;
use router_env::{instrument, logger, tracing};
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64_ENGINE},
c... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use redis_interface::errors::RedisError;
use router_env::{instrument, logger, tracing};
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
symmetric_key,
Some(&iv),
&[],
encrypted_message,
tag,
)
.change_context(errors::GooglePayDecryptionError::DecryptionFailed)?;
Ok(decrypted_... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
fn verify_hmac(
&self,
mac_key: &[u8],
tag: &[u8],
encrypted_message: &[u8],
) -> CustomResult<(), errors::GooglePayDecryptionError> {
let hmac_key = ring::hmac::Key::new(ring::... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
deriver
.set_peer(&ephemeral_pkey)
.change_context(errors::GooglePayDecryptionError::DerivingSharedSecretKeyFailed)?;
let shared_key = deriver
.derive_to_vec()
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
signed_data.append(&mut sender_id.as_bytes().to_vec());
signed_data.append(&mut get_little_endian_format(length_of_recipient_id));
signed_data.append(&mut recipient_id.as_bytes().to_vec());
sig... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
// parse the DER-encoded data as an EC public key
let ec_key = openssl::ec::EcKey::public_key_from_der(&der_data)
.change_context(errors::GooglePayDecryptionError::DerivingEcKeyFailed)?;
// wrap the EC k... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.parse_struct("GooglePaySignedKey")
.change_context(errors::GooglePayDecryptionError::SignedKeyParsingFailure)?;
if !matches!(
check_expiration_date_is_valid(&signed_key.key_expirat... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
return Err(errors::GooglePayDecryptionError::InvalidProtocolVersion.into());
}
// verify the intermediate signing key
self.verify_intermediate_signing_key(encrypted_data)?;
// vali... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
// parse and filter the root signing keys by protocol version
let filtered_root_signing_keys = filter_root_signing_keys(root_keys_vector)?;
Ok(Self {
root_signing_keys: filtered_root_sign... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.collect::<Vec<GooglePayRootSigningKey>>();
logger::info!(
"Filtered {} out of {} root signing keys",
filtered_root_signing_keys.len(),
root_signing_keys.len()
);
Ok(filtered_root... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use redis_interface::errors::RedisError;
use router_env::{instrument, logger, tracing};
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.trim()
.trim_start_matches('@')
.to_string();
merchant_id
})
.ok_or(errors::ApplePayDecryptionError::MissingMerchantId)
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
payment_processing_certificate: &masking::Secret<String>,
payment_processing_certificate_key: &masking::Secret<String>,
) -> CustomResult<serde_json::Value, errors::ApplePayDecryptionError> {
let m... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.and_then(|d| d.google_pay.clone()),
}
}
};
return Ok(Some(updated_wallet_details));
}
// Return connector_wallets_details if no Apple Pay metadata... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
// Otherwise, merge Apple Pay metadata
return get_and_merge_apple_pay_metadata(
connector_metadata.clone(),
Some(connector_wallets_details.clone()),
)
.await;
}
// If connecto... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
api_models::payments::AdditionalPaymentData::MobilePayment {
details: Some(mobile_payment.to_owned().into()),
},
)),
domain::PaymentMethodData::NetworkToken(_) => Ok(Non... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
"manual_retry payment for {:?} with attempt_id {:?}",
updated_payment_intent.get_id(),
new_payment_attempt.get_id()
);
Ok((updated_p... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
// #[inline(always)]
// fn make_new_payment_attempt(
// _payment_method_data: Option<&api_models::payments::PaymentMethodData>,
// _old_payment_attempt: PaymentAttempt,
// _new_attempt_count: i... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
mca.map(Box::new).map(MerchantConnectorAccountType::DbVal)
}
}
}
/// This function replaces the request and response type of routerdata with the
/// request and response type passed
/// # Arguments
//... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
psd2_sca_exemption_type: None,
platform_merchant_id: None,
force_3ds_challenge: None,
force_3ds_challenge_trigger: None,
};
let req_cs = Some("1".to_string());
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
skip_external_tax_calculation: None,
request_extended_authorization: None,
psd2_sca_exemption_type: None,
platform_merchant_id: None,
force_3ds_challenge: None,
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
request_extended_authorization: None,
psd2_sca_exemption_type: None,
platform_merchant_id: None,
force_3ds_challenge: None,
force_3ds_challenge_trigger: None,
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.ok_or(errors::ApiErrorResponse::ClientSecretInvalid)?;
Ok(payment_id.to_string())
}
#[cfg(feature = "v1")]
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
use super::*;
#[test]
fn test_... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
authenticate_client_secret(Some(&cs), &payment_intent)?;
Ok(payment_intent)
})
.awai... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
// A function to perform database lookup and then verify the client secret
pub async fn verify_payment_intent_time_and_client_secret(
state: &SessionState,
merchant_account: &domain::MerchantAccount,
key_store: &d... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
action: &'static str,
) -> Result<(), errors::ApiErrorResponse> {
fp_utils::when(not_allowed_statuses.contains(&intent_status), || {
Err(errors::ApiErrorResponse::PreconditionFailed {
message: form... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.set_mandate_type(storage_enums::MandateType::MultiUse)
.to_owned()
}
},
))
}
(_, _) => Ok(None),
}
}
#[cfg(... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to sign the message")?;
Ok(hex::encode(signature))
}
pub fn check_if_operation_confirm<Op: std::fmt::Debug>(operatio... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use std::{borrow::Cow, collections::HashSet, net::IpAddr, str::FromStr};
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
merchant_id: merchant_id.to_owned(),
secret,
};
let ek = store
.create_ephemeral_key(ek, state.conf.eph_key.validity)
.await
.change_context(errors::ApiErrorResponse::InternalSe... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
business_profile,
redirection_response,
payments_return_url,
response.client_secret.as_ref(),
response.manual_retry_allowed,
)
.attach_printable("Failed to make merchant url wit... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
|| {
Err(report!(errors::ApiErrorResponse::PaymentUnexpectedState {
field_name: "capture_method".to_string(),
current_flow: "captured".to_string(),
current_v... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
state: &SessionState,
payment_attempt: &PaymentAttempt,
payment_intent: &PaymentIntent,
payment_method: enums::PaymentMethod,
payment_method_data: &domain::PaymentMethodData,
merchant_key_store: &domai... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
payment_data.token = payment_token;
Ok((payment_method_data, None))
}
_ => Ok((None, None)),
}?;
Ok((operation, payment_method, pm_id))
}
#[cfg(feature = "v1")]
pub async fn... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use error_stack::{report, ResultExt};
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64_ENGINE},... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use diesel_models::enums;
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64_ENGINE},
core::{... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
card_type: None,
card_issuing_country: None,
bank_code: None,
eci: None,
};
Ok(network_token_data)
}
#[cfg(all(
any(feature = "v2", feature = "v1"),
not(feature = "payment_meth... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.flatten(),
card_type: None,
card_issuing_country: None,
bank_code: None,
};
Ok(api_card.into())
}
#[cfg(all(
any(feature = "v2", feature = "v1"),
not(feature = "payment_methods_v2")
))]
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
card_token_data,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to fetch card information from the permanent locker")?,
))
}
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
}
}
VaultFetchAction::NoFetchAction => Err(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Payment method data is not present"),
}
}
#[cfg(all(
any(feature = ... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
mandate_id,
connector,
network_tokenization_supported_connectors,
network_token_requestor_ref_id,
)
};
should_retry_with_pan
.then_some(VaultFetchAction... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
Ok(cache_key)
}
}
Ok(None) => Ok(cache_key),
Err(error) => Err(errors::ApiErrorResponse::InternalServerError).attach_printable(error)?,
}
}
#[cfg(feature = "v1")]
/// G... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
confirm: Option<bool>,
) -> storage_enums::IntentStatus {
match payment_method_data {
Some(_) => match confirm {
Some(true) => storage_enums::IntentStatus::RequiresPaymentMethod,
_ => s... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
let off_session = req.off_session.get_required_value("off_session")?;
if !off_session {
Err(report!(errors::ApiErrorResponse::PreconditionFailed {
message: "`off_se... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
format!("/{}", creds_identifier)
});
format!(
"{}/payments/{}/{}/redirect/complete/{}{}",
router_base_url,
payment_attempt.payment_id.get_string_repr(),
payment_attempt.merchant... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
},
)?;
utils::when(recurring_details.is_some() && mandate_id.is_some(), || {
Err(report!(errors::ApiErrorResponse::PreconditionFailed {
message: "Expected one out of recurring_details and ... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
::cards::CardSecurityCode::try_from(card_cvc).change_context(
errors::ApiErrorResponse::PreconditionFailed {
message: "Invalid Card CVC".to_string(),
},
)?;
val... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
message: "amount_to_capture should not exist for when amount = 0"
.to_string()
}))
}
}
}
}
}
#[cfg(feature = "v1... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
utils::when(merchant_id.ne(request_merchant_id), || {
Err(report!(errors::ApiErrorResponse::PreconditionFailed {
message: format!(
"Invalid `merchant_id`: {} not found in merchant account",
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
let encryptable: Encryptable<masking::Secret<String, pii::EmailStrategy>> =
Encryptable::new(
email.clone().into_inner().switch_strategy(),
e... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
)
.await
.map(|payment_address| payment_address.address)
.change_context(errors::ApiErrorResponse::InternalServerError)
.atta... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while inserting new address")?,
)
}
None => None,
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
});
}
}
};
}
common_types::payments::XenditSplitRequest::SingleSplit(_) => (),
},
None => (),
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
if !(consts::MIN_INTENT_FULFILLMENT_EXPIRY..=consts::MAX_INTENT_FULFILLMENT_EXPIRY)
.contains(&intent_fulfillment_time)
{
Err(errors::ApiErrorResponse::InvalidRequestData {
message: "intent... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
} => connector_response_reference_id,
PaymentsResponseData::PreProcessingResponse {
connector_response_reference_id,
..
} => connector_response_reference_id,... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use common_utils::id_type::GenerateId;
use common_utils::{
crypto::Encryptable,
ext_traits::{AsyncExt, ByteSliceExt, Encode, ValueExt},
fp_utils, generate_id,
id_type::{self},
new_type::{MaskedIban, Masked... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
&auth_token,
payment_intent,
&None,
)
.await
}
storage::PaymentTokenData::WalletToken(_) => Ok(None),
}
}
// This function validate... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
)
});
additional_payment_method_data
.as_ref()
.map(Encode::encode_to_value)
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64_ENGINE},
core::{
authentication,
... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64_ENGINE},
core::{
authentication,
errors::... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
err.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to fetch translation from unified_translations")
})
};
get_unified_translatio... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64_ENGINE},
core::{
authentication,
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
logger::error!(
"Failed to derive the shared ephemeral key for Google Pay decryption flow: {:?}",
err
);
report!(errors::GooglePayDecryptionError::De... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
let result = ecdsa_signature
.verify(&message_hash, &ec_key)
.change_context(errors::GooglePayDecryptionError::SignatureVerificationFailed)?;
if result {
Ok(())
} e... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
let mut signed_data: Vec<u8> = Vec::new();
signed_data.append(&mut get_little_endian_format(length_of_sender_id));
signed_data.append(&mut sender_id.as_bytes().to_vec());
signed_data.append(&mu... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
)?;
if result {
return Ok(());
}
}
}
Err(errors::GooglePayDecryptionError::InvalidIntermediateSignature.into())
}
// C... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
// check the expiration date of the decrypted data
if matches!(
check_expiration_date_is_valid(&decrypted_data.message_expiration),
Ok(true)
) {
Ok(decrypted_data)
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
fn get_little_endian_format(number: u32) -> Vec<u8> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use std::{borrow::Cow, collections::HashSet, net::IpAddr, str::FromStr};
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{s... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
let kdf_party_u = b"Apple";
let kdf_info = [&kdf_algorithm[..], kdf_party_u, &kdf_party_v[..]].concat();
let mut hash = openssl::sha::Sha256::new();
hash.update(b"\x00\x00\x00");
hash.... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
.set_peer(&public_key)
.change_context(errors::ApplePayDecryptionError::DerivingSharedSecretKeyFailed)
.attach_printable("Failed to set the peer key for the secret derivation")?;
/... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
impl ApplePayData {
pub fn token_json(
wallet_data: domain::WalletData,
) -> CustomResult<Self, errors::ConnectorError> {
let json_wallet_data: Self = connector::utils::WalletData::get_wallet_token_as... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use redis_interface::errors::RedisError;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
connector,
consts::{self, BASE64_ENGINE},
core::{
authentication,
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
let connector_wallets_details = connector_wallet_details_with_apple_pay_metadata_optional
.map(|details| {
serde_json::to_value(details)
.change_context(errors::ApiErrorResponse::Intern... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
api_models::payments::ApplePayCombinedMetadata::Simplified { .. }
)
)
))
}
// This function will return the encrypted connector wallets details with Apple Pay certificates
// Currently... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
) -> Result<(), errors::ApiErrorResponse> {
if auth_flow == services::AuthFlow::Client && request.get_customer_id().is_some() {
let is_same_customer = request.get_customer_id() == payment_intent.customer_id.as_ref();
if ... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
}
}
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
pub async fn populate_bin_details_for_payment_method_create(
_card_details: api_models::payment_methods::CardDetail,
_db: &dyn StorageInterface,
) -... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
card_type: None,
card_issuing_country: None,
card_exp_month: card_details.card_exp_month.clone(),
card_exp_year: card_details.card_exp_year.clone(),
card_holder_name... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
use super::{
operations::{BoxedOperation, Operation, PaymentResponse},
CustomerDetails, PaymentData,
};
fn test_client_secret_parse() {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
Self::DbVal(db_val) => Some(db_val.get_id()),
Self::CacheVal(_) => None,
}
}
pub fn get_connector_name(&self) -> Option<String> {
match self {
Self::DbVal(db_val) =... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
#[cfg(feature = "v2")]
pub fn is_test_mode_on(&self) -> Option<bool> {
None
}
pub fn get_mca_id(&self) -> Option<id_type::MerchantConnectorAccountId> {
match self {
Self::DbVal(db_val) => Some(db... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
pub fn is_test_mode_on(&self) -> Option<bool> {
match self {
Self::DbVal(val) => val.test_mode,
Self::CacheVal(_) => None,
}
}
#[cfg(feature = "v2")]
pub fn is_test_mod... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
}
}
#[cfg(feature = "v1")]
pub fn is_test_mode_on(&self) -> Option<bool> {
match self {
Self::DbVal(val) => val.test_mode,
Self::CacheVal(_) => None,
}
}
#... | ast_fragments |
// file: hyperswitch/crates/router/src/core/payments/helpers.rs | crate: router
Self::DbVal(val) => val.metadata.to_owned(),
Self::CacheVal(val) => val.metadata.to_owned(),
}
}
pub fn get_connector_account_details(&self) -> serde_json::Value {
match self {
Se... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/customers.rs | crate: router
use router_env::{instrument, tracing};
use crate::{
core::{
errors::{ConnectorErrorExt, RouterResult},
payments,
},
logger,
routes::{metrics, SessionState},
services,
types::{self, ap... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/customers.rs | crate: router
use common_utils::pii;
use crate::{
core::{
errors::{ConnectorErrorExt, RouterResult},
payments,
},
logger,
routes::{metrics, SessionState},
services,
types::{self, api, domain, stora... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/customers.rs | crate: router
use router_env::{instrument, tracing};
use crate::{
core::{
errors::{ConnectorErrorExt, RouterResult},
payments,
},
logger,
routes::{metrics, SessionState},
services,
types::{self, ap... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/core/payments/customers.rs | crate: router
use common_utils::pii;
use crate::{
core::{
errors::{ConnectorErrorExt, RouterResult},
payments,
},
logger,
routes::{metrics, SessionState},
services,
types::{self, api, domain, stora... | ast_fragments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.