Merge branch 'main' into split-payments-pre-steps

This commit is contained in:
Anurag Thakur
2025-10-16 14:35:45 +05:30
154 changed files with 8184 additions and 4944 deletions

View File

@ -2214,6 +2214,10 @@ pub struct ProfileCreate {
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
}
#[nutype::nutype(
@ -2375,6 +2379,10 @@ pub struct ProfileCreate {
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
}
#[cfg(feature = "v1")]
@ -2579,6 +2587,10 @@ pub struct ProfileResponse {
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
}
#[cfg(feature = "v2")]
@ -2753,6 +2765,10 @@ pub struct ProfileResponse {
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
}
#[cfg(feature = "v1")]
@ -2947,6 +2963,10 @@ pub struct ProfileUpdate {
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
}
#[cfg(feature = "v2")]

View File

@ -46,6 +46,17 @@ pub struct CustomerRequest {
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
pub struct CustomerListRequest {
/// Offset
#[schema(example = 32)]
pub offset: Option<u32>,
/// Limit
#[schema(example = 32)]
pub limit: Option<u16>,
pub customer_id: Option<id_type::CustomerId>,
}
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
pub struct CustomerListRequestWithConstraints {
/// Offset
#[schema(example = 32)]
pub offset: Option<u32>,
@ -54,6 +65,9 @@ pub struct CustomerListRequest {
pub limit: Option<u16>,
/// Unique identifier for a customer
pub customer_id: Option<id_type::CustomerId>,
/// Filter with created time range
#[serde(flatten)]
pub time_range: Option<common_utils::types::TimeRange>,
}
#[cfg(feature = "v1")]
@ -388,3 +402,11 @@ pub struct CustomerUpdateRequestInternal {
pub id: id_type::GlobalCustomerId,
pub request: CustomerUpdateRequest,
}
#[derive(Debug, Serialize, ToSchema)]
pub struct CustomerListResponse {
/// List of customers
pub data: Vec<CustomerResponse>,
/// Total count of customers
pub total_count: usize,
}

View File

@ -56,6 +56,7 @@ pub enum PayoutConnectors {
Paypal,
Stripe,
Wise,
Worldpay,
}
#[cfg(feature = "v2")]
@ -85,6 +86,7 @@ impl From<PayoutConnectors> for RoutableConnectors {
PayoutConnectors::Paypal => Self::Paypal,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
PayoutConnectors::Worldpay => Self::Worldpay,
}
}
}
@ -105,6 +107,7 @@ impl From<PayoutConnectors> for Connector {
PayoutConnectors::Paypal => Self::Paypal,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
PayoutConnectors::Worldpay => Self::Worldpay,
}
}
}
@ -125,6 +128,7 @@ impl TryFrom<Connector> for PayoutConnectors {
Connector::Paypal => Ok(Self::Paypal),
Connector::Stripe => Ok(Self::Stripe),
Connector::Wise => Ok(Self::Wise),
Connector::Worldpay => Ok(Self::Worldpay),
_ => Err(format!("Invalid payout connector {value}")),
}
}

View File

@ -1,7 +1,8 @@
use common_utils::events::{ApiEventMetric, ApiEventsType};
use crate::customers::{
CustomerDeleteResponse, CustomerRequest, CustomerResponse, CustomerUpdateRequestInternal,
CustomerDeleteResponse, CustomerListRequestWithConstraints, CustomerListResponse,
CustomerRequest, CustomerResponse, CustomerUpdateRequestInternal,
};
#[cfg(feature = "v1")]
@ -73,3 +74,33 @@ impl ApiEventMetric for CustomerUpdateRequestInternal {
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for CustomerListRequestWithConstraints {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Customer {
customer_id: self.customer_id.clone()?,
})
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for CustomerListRequestWithConstraints {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Customer { customer_id: None })
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for CustomerListResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for CustomerListResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}

View File

@ -174,6 +174,24 @@ impl ApiEventMetric for payments::PaymentsRequest {
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for payments::PaymentsEligibilityRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Payment {
payment_id: self.payment_id.clone(),
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for payments::PaymentsEligibilityResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Payment {
payment_id: self.payment_id.clone(),
})
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for PaymentsCreateIntentRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {

View File

@ -13,16 +13,17 @@ use crate::user::{
},
AcceptInviteFromEmailRequest, AuthSelectRequest, AuthorizeResponse, BeginTotpResponse,
ChangePasswordRequest, CloneConnectorRequest, ConnectAccountRequest, CreateInternalUserRequest,
CreateTenantUserRequest, CreateUserAuthenticationMethodRequest, ForgotPasswordRequest,
GetSsoAuthUrlRequest, GetUserAuthenticationMethodsRequest, GetUserDetailsResponse,
GetUserRoleDetailsRequest, GetUserRoleDetailsResponseV2, InviteUserRequest,
PlatformAccountCreateRequest, PlatformAccountCreateResponse, ReInviteUserRequest,
RecoveryCodes, ResetPasswordRequest, RotatePasswordRequest, SendVerifyEmailRequest,
SignUpRequest, SignUpWithMerchantIdRequest, SsoSignInRequest, SwitchMerchantRequest,
SwitchOrganizationRequest, SwitchProfileRequest, TokenResponse, TwoFactorAuthStatusResponse,
TwoFactorStatus, UpdateUserAccountDetailsRequest, UpdateUserAuthenticationMethodRequest,
UserFromEmailRequest, UserMerchantAccountResponse, UserMerchantCreate,
UserOrgMerchantCreateRequest, VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
CreateTenantUserRequest, CreateUserAuthenticationMethodRequest,
CreateUserAuthenticationMethodResponse, ForgotPasswordRequest, GetSsoAuthUrlRequest,
GetUserAuthenticationMethodsRequest, GetUserDetailsResponse, GetUserRoleDetailsRequest,
GetUserRoleDetailsResponseV2, InviteUserRequest, PlatformAccountCreateRequest,
PlatformAccountCreateResponse, ReInviteUserRequest, RecoveryCodes, ResetPasswordRequest,
RotatePasswordRequest, SendVerifyEmailRequest, SignUpRequest, SignUpWithMerchantIdRequest,
SsoSignInRequest, SwitchMerchantRequest, SwitchOrganizationRequest, SwitchProfileRequest,
TokenResponse, TwoFactorAuthStatusResponse, TwoFactorStatus, UpdateUserAccountDetailsRequest,
UpdateUserAuthenticationMethodRequest, UserFromEmailRequest, UserMerchantAccountResponse,
UserMerchantCreate, UserOrgMerchantCreateRequest, VerifyEmailRequest,
VerifyRecoveryCodeRequest, VerifyTotpRequest,
};
common_utils::impl_api_event_type!(
@ -69,6 +70,7 @@ common_utils::impl_api_event_type!(
RecoveryCodes,
GetUserAuthenticationMethodsRequest,
CreateUserAuthenticationMethodRequest,
CreateUserAuthenticationMethodResponse,
UpdateUserAuthenticationMethodRequest,
GetSsoAuthUrlRequest,
SsoSignInRequest,

View File

@ -8067,6 +8067,8 @@ pub enum NextActionCall {
CompleteAuthorize,
/// The next action is to await for a merchant callback
AwaitMerchantCallback,
/// The next action is to deny the payment with an error message
Deny { message: String },
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
@ -9337,9 +9339,13 @@ pub struct ClickToPaySessionResponse {
#[derive(Debug, serde::Deserialize, Clone, ToSchema)]
pub struct PaymentsEligibilityRequest {
/// The identifier for the payment
/// Added in the payload for ApiEventMetrics, populated from the path param
#[serde(skip)]
pub payment_id: id_type::PaymentId,
/// Token used for client side verification
#[schema(value_type = String, example = "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo")]
pub client_secret: Secret<String>,
pub client_secret: Option<Secret<String>>,
/// The payment method to be used for the payment
#[schema(value_type = PaymentMethod, example = "wallet")]
pub payment_method_type: api_enums::PaymentMethod,
@ -9352,7 +9358,11 @@ pub struct PaymentsEligibilityRequest {
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsEligibilityResponse {
pub sdk_next_action: Option<SdkNextAction>,
/// The identifier for the payment
#[schema(value_type = String)]
pub payment_id: id_type::PaymentId,
/// Next action to be performed by the SDK
pub sdk_next_action: SdkNextAction,
}
#[cfg(feature = "v1")]

View File

@ -375,6 +375,7 @@ pub struct PixBankTransfer {
#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum Wallet {
ApplePayDecrypt(ApplePayDecrypt),
Paypal(Paypal),
Venmo(Venmo),
}
@ -414,6 +415,25 @@ pub struct Venmo {
pub telephone_number: Option<Secret<String>>,
}
#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]
pub struct ApplePayDecrypt {
/// The dpan number associated with card number
#[schema(value_type = String, example = "4242424242424242")]
pub dpan: CardNumber,
/// The card's expiry month
#[schema(value_type = String)]
pub expiry_month: Secret<String>,
/// The card's expiry year
#[schema(value_type = String)]
pub expiry_year: Secret<String>,
/// The card holder's name
#[schema(value_type = String, example = "John Doe")]
pub card_holder_name: Option<Secret<String>>,
}
#[derive(Debug, ToSchema, Clone, Serialize, router_derive::PolymorphicSchema)]
#[serde(deny_unknown_fields)]
pub struct PayoutCreateResponse {
@ -1000,6 +1020,18 @@ impl From<Wallet> for payout_method_utils::WalletAdditionalData {
telephone_number: telephone_number.map(From::from),
}))
}
Wallet::ApplePayDecrypt(ApplePayDecrypt {
expiry_month,
expiry_year,
card_holder_name,
..
}) => Self::ApplePayDecrypt(Box::new(
payout_method_utils::ApplePayDecryptAdditionalData {
card_exp_month: expiry_month,
card_exp_year: expiry_year,
card_holder_name,
},
)),
}
}
}

View File

@ -353,6 +353,17 @@ pub struct CreateUserAuthenticationMethodRequest {
pub email_domain: Option<String>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct CreateUserAuthenticationMethodResponse {
pub id: String,
pub auth_id: String,
pub owner_id: String,
pub owner_type: common_enums::Owner,
pub auth_type: common_enums::UserAuthType,
pub email_domain: Option<String>,
pub allow_signup: bool,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub enum UpdateUserAuthenticationMethodRequest {