Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add offset and limit to key transfer API #5358

Merged
merged 14 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/analytics/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{fmt::Display, str::FromStr};
use common_utils::{
errors::{CustomResult, ErrorSwitch, ParsingError},
events::{ApiEventMetric, ApiEventsType},
impl_misc_api_event_type,
impl_api_event_type,
};
use error_stack::{report, Report, ResultExt};

Expand Down Expand Up @@ -150,4 +150,4 @@ impl ErrorSwitch<AnalyticsError> for FiltersError {
}
}

impl_misc_api_event_type!(AnalyticsDomain);
impl_api_event_type!(Miscellaneous, (AnalyticsDomain));
10 changes: 10 additions & 0 deletions crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,16 @@ pub struct ToggleKVResponse {
pub kv_enabled: bool,
}

#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
pub struct MerchantKeyTransferRequest {
/// Offset for merchant account
#[schema(example = 32)]
pub from: u32,
/// Limit for merchant account
#[schema(example = 32)]
pub limit: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct TransferKeyResponse {
/// The identifier for the Merchant Account
Expand Down
174 changes: 95 additions & 79 deletions crates/api_models/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod user_role;

use common_utils::{
events::{ApiEventMetric, ApiEventsType},
impl_misc_api_event_type,
impl_api_event_type,
};

#[allow(unused_imports)]
Expand All @@ -33,6 +33,7 @@ use crate::{
mandates::*,
payment_methods::*,
payments::*,
user::{UserKeyTransferRequest, UserTransferKeyResponse},
verifications::*,
};

Expand All @@ -56,87 +57,102 @@ impl ApiEventMetric for PaymentIntentFiltersResponse {
}
}

impl_misc_api_event_type!(
PaymentMethodId,
PaymentMethodCreate,
PaymentLinkInitiateRequest,
RetrievePaymentLinkResponse,
MandateListConstraints,
CreateFileResponse,
MerchantConnectorResponse,
MerchantConnectorId,
MandateResponse,
MandateRevokedResponse,
RetrievePaymentLinkRequest,
PaymentLinkListConstraints,
MandateId,
DisputeListConstraints,
RetrieveApiKeyResponse,
BusinessProfileResponse,
BusinessProfileUpdate,
BusinessProfileCreate,
RevokeApiKeyResponse,
ToggleKVResponse,
ToggleKVRequest,
ToggleAllKVRequest,
ToggleAllKVResponse,
TransferKeyResponse,
MerchantAccountDeleteResponse,
MerchantAccountUpdate,
CardInfoResponse,
CreateApiKeyResponse,
CreateApiKeyRequest,
MerchantConnectorDeleteResponse,
MerchantConnectorUpdate,
MerchantConnectorCreate,
MerchantId,
CardsInfoRequest,
MerchantAccountResponse,
MerchantAccountListRequest,
MerchantAccountCreate,
PaymentsSessionRequest,
ApplepayMerchantVerificationRequest,
ApplepayMerchantResponse,
ApplepayVerifiedDomainsResponse,
UpdateApiKeyRequest,
GetApiEventFiltersRequest,
ApiEventFiltersResponse,
GetInfoResponse,
GetPaymentMetricRequest,
GetRefundMetricRequest,
GetActivePaymentsMetricRequest,
GetSdkEventMetricRequest,
GetAuthEventMetricRequest,
GetPaymentFiltersRequest,
PaymentFiltersResponse,
GetRefundFilterRequest,
RefundFiltersResponse,
GetSdkEventFiltersRequest,
SdkEventFiltersResponse,
ApiLogsRequest,
GetApiEventMetricRequest,
SdkEventsRequest,
ReportRequest,
ConnectorEventsRequest,
OutgoingWebhookLogsRequest,
GetGlobalSearchRequest,
GetSearchRequest,
GetSearchResponse,
GetSearchRequestWithIndex,
GetDisputeFilterRequest,
DisputeFiltersResponse,
GetDisputeMetricRequest
impl_api_event_type!(
Miscellaneous,
(
PaymentMethodId,
PaymentMethodCreate,
PaymentLinkInitiateRequest,
RetrievePaymentLinkResponse,
MandateListConstraints,
CreateFileResponse,
MerchantConnectorResponse,
MerchantConnectorId,
MandateResponse,
MandateRevokedResponse,
RetrievePaymentLinkRequest,
PaymentLinkListConstraints,
MandateId,
DisputeListConstraints,
RetrieveApiKeyResponse,
BusinessProfileResponse,
BusinessProfileUpdate,
BusinessProfileCreate,
RevokeApiKeyResponse,
ToggleKVResponse,
ToggleKVRequest,
ToggleAllKVRequest,
ToggleAllKVResponse,
MerchantAccountDeleteResponse,
MerchantAccountUpdate,
CardInfoResponse,
CreateApiKeyResponse,
CreateApiKeyRequest,
MerchantConnectorDeleteResponse,
MerchantConnectorUpdate,
MerchantConnectorCreate,
MerchantId,
CardsInfoRequest,
MerchantAccountResponse,
MerchantAccountListRequest,
MerchantAccountCreate,
PaymentsSessionRequest,
ApplepayMerchantVerificationRequest,
ApplepayMerchantResponse,
ApplepayVerifiedDomainsResponse,
UpdateApiKeyRequest,
GetApiEventFiltersRequest,
ApiEventFiltersResponse,
GetInfoResponse,
GetPaymentMetricRequest,
GetRefundMetricRequest,
GetActivePaymentsMetricRequest,
GetSdkEventMetricRequest,
GetAuthEventMetricRequest,
GetPaymentFiltersRequest,
PaymentFiltersResponse,
GetRefundFilterRequest,
RefundFiltersResponse,
GetSdkEventFiltersRequest,
SdkEventFiltersResponse,
ApiLogsRequest,
GetApiEventMetricRequest,
SdkEventsRequest,
ReportRequest,
ConnectorEventsRequest,
OutgoingWebhookLogsRequest,
GetGlobalSearchRequest,
GetSearchRequest,
GetSearchResponse,
GetSearchRequestWithIndex,
GetDisputeFilterRequest,
DisputeFiltersResponse,
GetDisputeMetricRequest
)
);

impl_api_event_type!(
Keymanager,
(
TransferKeyResponse,
MerchantKeyTransferRequest,
UserKeyTransferRequest,
UserTransferKeyResponse
)
);

#[cfg(feature = "stripe")]
impl_misc_api_event_type!(
StripeSetupIntentResponse,
StripeRefundResponse,
StripePaymentIntentListResponse,
StripePaymentIntentResponse,
CustomerDeleteResponse,
CustomerPaymentMethodListResponse,
CreateCustomerResponse
impl_api_event_type!(
Miscellaneous,
(
StripeSetupIntentResponse,
StripeRefundResponse,
StripePaymentIntentListResponse,
StripePaymentIntentResponse,
CustomerDeleteResponse,
CustomerPaymentMethodListResponse,
CreateCustomerResponse
)
);

impl<T> ApiEventMetric for MetricsResponse<T> {
Expand Down
15 changes: 9 additions & 6 deletions crates/api_models/src/events/connector_onboarding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ use crate::connector_onboarding::{
ResetTrackingIdRequest,
};

common_utils::impl_misc_api_event_type!(
ActionUrlRequest,
ActionUrlResponse,
OnboardingSyncRequest,
OnboardingStatus,
ResetTrackingIdRequest
common_utils::impl_api_event_type!(
Miscellaneous,
(
ActionUrlRequest,
ActionUrlResponse,
OnboardingSyncRequest,
OnboardingStatus,
ResetTrackingIdRequest
)
);
88 changes: 45 additions & 43 deletions crates/api_models/src/events/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::user::{
SsoSignInRequest, SwitchMerchantIdRequest, TokenOrPayloadResponse, TokenResponse,
TwoFactorAuthStatusResponse, UpdateUserAccountDetailsRequest,
UpdateUserAuthenticationMethodRequest, UserFromEmailRequest, UserMerchantCreate,
UserTransferKeyResponse, VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
VerifyEmailRequest, VerifyRecoveryCodeRequest, VerifyTotpRequest,
};

impl ApiEventMetric for DashboardEntryResponse {
Expand All @@ -46,48 +46,50 @@ impl<T> ApiEventMetric for TokenOrPayloadResponse<T> {
}
}

common_utils::impl_misc_api_event_type!(
SignUpRequest,
SignUpWithMerchantIdRequest,
ChangePasswordRequest,
GetMultipleMetaDataPayload,
GetMetaDataResponse,
GetMetaDataRequest,
SetMetaDataRequest,
SwitchMerchantIdRequest,
CreateInternalUserRequest,
UserMerchantCreate,
ListUsersResponse,
AuthorizeResponse,
ConnectAccountRequest,
ForgotPasswordRequest,
ResetPasswordRequest,
RotatePasswordRequest,
InviteUserRequest,
ReInviteUserRequest,
VerifyEmailRequest,
SendVerifyEmailRequest,
AcceptInviteFromEmailRequest,
SignInResponse,
UpdateUserAccountDetailsRequest,
GetUserDetailsResponse,
GetUserRoleDetailsRequest,
GetUserRoleDetailsResponse,
TokenResponse,
TwoFactorAuthStatusResponse,
UserFromEmailRequest,
BeginTotpResponse,
VerifyRecoveryCodeRequest,
VerifyTotpRequest,
RecoveryCodes,
GetUserAuthenticationMethodsRequest,
CreateUserAuthenticationMethodRequest,
UpdateUserAuthenticationMethodRequest,
GetSsoAuthUrlRequest,
SsoSignInRequest,
UserTransferKeyResponse,
AuthSelectRequest
common_utils::impl_api_event_type!(
Miscellaneous,
(
SignUpRequest,
SignUpWithMerchantIdRequest,
ChangePasswordRequest,
GetMultipleMetaDataPayload,
GetMetaDataResponse,
GetMetaDataRequest,
SetMetaDataRequest,
SwitchMerchantIdRequest,
CreateInternalUserRequest,
UserMerchantCreate,
ListUsersResponse,
AuthorizeResponse,
ConnectAccountRequest,
ForgotPasswordRequest,
ResetPasswordRequest,
RotatePasswordRequest,
InviteUserRequest,
ReInviteUserRequest,
VerifyEmailRequest,
SendVerifyEmailRequest,
AcceptInviteFromEmailRequest,
SignInResponse,
UpdateUserAccountDetailsRequest,
GetUserDetailsResponse,
GetUserRoleDetailsRequest,
GetUserRoleDetailsResponse,
TokenResponse,
TwoFactorAuthStatusResponse,
UserFromEmailRequest,
BeginTotpResponse,
VerifyRecoveryCodeRequest,
VerifyTotpRequest,
RecoveryCodes,
GetUserAuthenticationMethodsRequest,
CreateUserAuthenticationMethodRequest,
UpdateUserAuthenticationMethodRequest,
GetSsoAuthUrlRequest,
SsoSignInRequest,
AuthSelectRequest
)
);

#[cfg(feature = "dummy_connector")]
common_utils::impl_misc_api_event_type!(SampleDataRequest);
common_utils::impl_api_event_type!(Miscellaneous, (SampleDataRequest));
33 changes: 18 additions & 15 deletions crates/api_models/src/events/user_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ use crate::user_role::{
MerchantSelectRequest, TransferOrgOwnershipRequest, UpdateUserRoleRequest,
};

common_utils::impl_misc_api_event_type!(
RoleInfoWithPermissionsResponse,
GetRoleRequest,
AuthorizationInfoResponse,
UpdateUserRoleRequest,
MerchantSelectRequest,
AcceptInvitationRequest,
DeleteUserRoleRequest,
TransferOrgOwnershipRequest,
CreateRoleRequest,
UpdateRoleRequest,
ListRolesResponse,
RoleInfoResponse,
GetRoleFromTokenResponse,
RoleInfoWithGroupsResponse
common_utils::impl_api_event_type!(
Miscellaneous,
(
RoleInfoWithPermissionsResponse,
GetRoleRequest,
AuthorizationInfoResponse,
UpdateUserRoleRequest,
MerchantSelectRequest,
AcceptInvitationRequest,
DeleteUserRoleRequest,
TransferOrgOwnershipRequest,
CreateRoleRequest,
UpdateRoleRequest,
ListRolesResponse,
RoleInfoResponse,
GetRoleFromTokenResponse,
RoleInfoWithGroupsResponse
)
);
Loading
Loading