mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(core): added payment method type in uas for modular auth and payments api (#9852)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -8389,6 +8389,14 @@
|
||||
"payment_method": {
|
||||
"$ref": "#/components/schemas/PaymentMethod"
|
||||
},
|
||||
"payment_method_type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/PaymentMethodType"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"client_secret": {
|
||||
"type": "string",
|
||||
"description": "Optional secret value used to identify and authorize the client making the request.\nThis can help ensure that the payment session is secure and valid.",
|
||||
|
||||
@ -171,6 +171,10 @@ pub struct AuthenticationEligibilityRequest {
|
||||
#[schema(value_type = PaymentMethod)]
|
||||
pub payment_method: common_enums::PaymentMethod,
|
||||
|
||||
/// Can be used to specify the Payment Method Type
|
||||
#[schema(value_type = Option<PaymentMethodType>, example = "debit")]
|
||||
pub payment_method_type: Option<enums::PaymentMethodType>,
|
||||
|
||||
/// Optional secret value used to identify and authorize the client making the request.
|
||||
/// This can help ensure that the payment session is secure and valid.
|
||||
#[schema(value_type = Option<String>)]
|
||||
|
||||
@ -108,7 +108,7 @@ impl<F, T>
|
||||
pub struct PaymentDetails {
|
||||
pub pan: cards::CardNumber,
|
||||
pub digital_card_id: Option<String>,
|
||||
pub payment_data_type: Option<String>,
|
||||
pub payment_data_type: Option<common_enums::PaymentMethodType>,
|
||||
pub encrypted_src_card_details: Option<String>,
|
||||
pub card_expiry_month: Secret<String>,
|
||||
pub card_expiry_year: Secret<String>,
|
||||
|
||||
@ -63,7 +63,7 @@ pub struct CtpServiceDetails {
|
||||
pub struct PaymentDetails {
|
||||
pub pan: cards::CardNumber,
|
||||
pub digital_card_id: Option<String>,
|
||||
pub payment_data_type: Option<String>,
|
||||
pub payment_data_type: Option<common_enums::PaymentMethodType>,
|
||||
pub encrypted_src_card_details: Option<String>,
|
||||
pub card_expiry_month: Secret<String>,
|
||||
pub card_expiry_year: Secret<String>,
|
||||
|
||||
@ -1293,6 +1293,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
|
||||
&payment_data.payment_attempt.merchant_id,
|
||||
Some(&payment_data.payment_intent.payment_id),
|
||||
payment_data.payment_method_data.as_ref(),
|
||||
payment_data.payment_attempt.payment_method_type,
|
||||
&helpers::MerchantConnectorAccountType::DbVal(Box::new(connector_mca.clone())),
|
||||
&connector_mca.connector_name,
|
||||
&authentication_id,
|
||||
@ -1479,6 +1480,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
|
||||
&payment_data.payment_attempt.merchant_id,
|
||||
Some(&payment_data.payment_intent.payment_id),
|
||||
payment_data.payment_method_data.as_ref(),
|
||||
payment_data.payment_attempt.payment_method_type,
|
||||
&three_ds_connector_account,
|
||||
&authentication_connector_name,
|
||||
&authentication.authentication_id,
|
||||
|
||||
@ -70,6 +70,7 @@ impl UnifiedAuthenticationService for ClickToPay {
|
||||
billing_address: Option<&hyperswitch_domain_models::address::Address>,
|
||||
acquirer_bin: Option<String>,
|
||||
acquirer_merchant_id: Option<String>,
|
||||
_payment_method_type: Option<common_enums::PaymentMethodType>,
|
||||
) -> RouterResult<UasPreAuthenticationRequestData> {
|
||||
let domain_service_details = hyperswitch_domain_models::router_request_types::unified_authentication_service::CtpServiceDetails {
|
||||
service_session_ids: Some(ServiceSessionIds {
|
||||
@ -121,6 +122,7 @@ impl UnifiedAuthenticationService for ClickToPay {
|
||||
merchant_id: &common_utils::id_type::MerchantId,
|
||||
payment_id: Option<&common_utils::id_type::PaymentId>,
|
||||
payment_method_data: Option<&domain::PaymentMethodData>,
|
||||
payment_method_type: Option<common_enums::PaymentMethodType>,
|
||||
merchant_connector_account: &MerchantConnectorAccountType,
|
||||
connector_name: &str,
|
||||
authentication_id: &common_utils::id_type::AuthenticationId,
|
||||
@ -142,6 +144,7 @@ impl UnifiedAuthenticationService for ClickToPay {
|
||||
billing_address,
|
||||
acquirer_bin,
|
||||
acquirer_merchant_id,
|
||||
payment_method_type,
|
||||
)?;
|
||||
|
||||
let pre_auth_router_data: UasPreAuthenticationRouterData =
|
||||
@ -289,6 +292,7 @@ impl UnifiedAuthenticationService for ExternalAuthentication {
|
||||
billing_address: Option<&hyperswitch_domain_models::address::Address>,
|
||||
acquirer_bin: Option<String>,
|
||||
acquirer_merchant_id: Option<String>,
|
||||
payment_method_type: Option<common_enums::PaymentMethodType>,
|
||||
) -> RouterResult<UasPreAuthenticationRequestData> {
|
||||
let payment_method_data = payment_method_data
|
||||
.ok_or(ApiErrorResponse::InternalServerError)
|
||||
@ -298,13 +302,13 @@ impl UnifiedAuthenticationService for ExternalAuthentication {
|
||||
Some(PaymentDetails {
|
||||
pan: card.card_number.clone(),
|
||||
digital_card_id: None,
|
||||
payment_data_type: None,
|
||||
payment_data_type: payment_method_type,
|
||||
encrypted_src_card_details: None,
|
||||
card_expiry_month: card.card_exp_month.clone(),
|
||||
card_expiry_year: card.card_exp_year.clone(),
|
||||
cardholder_name: card.card_holder_name.clone(),
|
||||
card_token_number: None,
|
||||
account_type: None,
|
||||
account_type: payment_method_type,
|
||||
card_cvc: Some(card.card_cvc.clone()),
|
||||
})
|
||||
} else {
|
||||
@ -334,6 +338,7 @@ impl UnifiedAuthenticationService for ExternalAuthentication {
|
||||
merchant_id: &common_utils::id_type::MerchantId,
|
||||
payment_id: Option<&common_utils::id_type::PaymentId>,
|
||||
payment_method_data: Option<&domain::PaymentMethodData>,
|
||||
payment_method_type: Option<common_enums::PaymentMethodType>,
|
||||
merchant_connector_account: &MerchantConnectorAccountType,
|
||||
connector_name: &str,
|
||||
authentication_id: &common_utils::id_type::AuthenticationId,
|
||||
@ -355,6 +360,7 @@ impl UnifiedAuthenticationService for ExternalAuthentication {
|
||||
billing_address,
|
||||
acquirer_bin,
|
||||
acquirer_merchant_id,
|
||||
payment_method_type,
|
||||
)?;
|
||||
|
||||
let pre_auth_router_data: UasPreAuthenticationRouterData =
|
||||
@ -1014,6 +1020,7 @@ pub async fn authentication_eligibility_core(
|
||||
merchant_id,
|
||||
None,
|
||||
Some(&payment_method_data),
|
||||
req.payment_method_type,
|
||||
&three_ds_connector_account,
|
||||
&authentication_connector_name,
|
||||
&authentication_id,
|
||||
|
||||
@ -43,6 +43,7 @@ pub trait UnifiedAuthenticationService {
|
||||
_billing_address: Option<&hyperswitch_domain_models::address::Address>,
|
||||
_acquirer_bin: Option<String>,
|
||||
_acquirer_merchant_id: Option<String>,
|
||||
_payment_method_type: Option<common_enums::PaymentMethodType>,
|
||||
) -> RouterResult<UasPreAuthenticationRequestData> {
|
||||
Err(errors::ApiErrorResponse::NotImplemented {
|
||||
message: NotImplementedMessage::Reason(
|
||||
@ -58,6 +59,7 @@ pub trait UnifiedAuthenticationService {
|
||||
_merchant_id: &common_utils::id_type::MerchantId,
|
||||
_payment_id: Option<&common_utils::id_type::PaymentId>,
|
||||
_payment_method_data: Option<&domain::PaymentMethodData>,
|
||||
_payment_method_type: Option<common_enums::PaymentMethodType>,
|
||||
_merchant_connector_account: &MerchantConnectorAccountType,
|
||||
_connector_name: &str,
|
||||
_authentication_id: &common_utils::id_type::AuthenticationId,
|
||||
|
||||
Reference in New Issue
Block a user