-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-custom-headers
- Loading branch information
Showing
43 changed files
with
722 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
pub mod customer; | ||
pub mod payment; | ||
#[cfg(feature = "payouts")] | ||
pub mod payouts; | ||
pub mod refund; | ||
pub mod routing; | ||
|
||
use common_utils::{ | ||
events::{ApiEventMetric, ApiEventsType}, | ||
impl_misc_api_event_type, | ||
}; | ||
|
||
use crate::{ | ||
admin::*, api_keys::*, cards_info::*, disputes::*, files::*, mandates::*, payment_methods::*, | ||
payments::*, verifications::*, | ||
}; | ||
|
||
impl ApiEventMetric for TimeRange {} | ||
|
||
impl_misc_api_event_type!( | ||
PaymentMethodId, | ||
PaymentsSessionResponse, | ||
PaymentMethodListResponse, | ||
PaymentMethodCreate, | ||
PaymentLinkInitiateRequest, | ||
RetrievePaymentLinkResponse, | ||
MandateListConstraints, | ||
CreateFileResponse, | ||
DisputeResponse, | ||
SubmitEvidenceRequest, | ||
MerchantConnectorResponse, | ||
MerchantConnectorId, | ||
MandateResponse, | ||
MandateRevokedResponse, | ||
RetrievePaymentLinkRequest, | ||
MandateId, | ||
DisputeListConstraints, | ||
RetrieveApiKeyResponse, | ||
BusinessProfileResponse, | ||
BusinessProfileUpdate, | ||
BusinessProfileCreate, | ||
RevokeApiKeyResponse, | ||
ToggleKVResponse, | ||
ToggleKVRequest, | ||
MerchantAccountDeleteResponse, | ||
MerchantAccountUpdate, | ||
CardInfoResponse, | ||
CreateApiKeyResponse, | ||
CreateApiKeyRequest, | ||
MerchantConnectorDeleteResponse, | ||
MerchantConnectorUpdate, | ||
MerchantConnectorCreate, | ||
MerchantId, | ||
CardsInfoRequest, | ||
MerchantAccountResponse, | ||
MerchantAccountListRequest, | ||
MerchantAccountCreate, | ||
PaymentsSessionRequest, | ||
ApplepayMerchantVerificationRequest, | ||
ApplepayMerchantResponse, | ||
ApplepayVerifiedDomainsResponse, | ||
UpdateApiKeyRequest | ||
); | ||
|
||
#[cfg(feature = "stripe")] | ||
impl_misc_api_event_type!( | ||
StripeSetupIntentResponse, | ||
StripeRefundResponse, | ||
StripePaymentIntentListResponse, | ||
StripePaymentIntentResponse, | ||
CustomerDeleteResponse, | ||
CustomerPaymentMethodListResponse, | ||
CreateCustomerResponse | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use common_utils::events::{ApiEventMetric, ApiEventsType}; | ||
|
||
use crate::customers::{CustomerDeleteResponse, CustomerId, CustomerRequest, CustomerResponse}; | ||
|
||
impl ApiEventMetric for CustomerDeleteResponse { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Customer { | ||
customer_id: self.customer_id.clone(), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for CustomerRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Customer { | ||
customer_id: self.customer_id.clone(), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for CustomerResponse { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Customer { | ||
customer_id: self.customer_id.clone(), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for CustomerId { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Customer { | ||
customer_id: self.customer_id.clone(), | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
use common_utils::events::{ApiEventMetric, ApiEventsType}; | ||
|
||
use crate::{ | ||
payment_methods::{ | ||
CustomerPaymentMethodsListResponse, PaymentMethodDeleteResponse, PaymentMethodListRequest, | ||
PaymentMethodResponse, PaymentMethodUpdate, | ||
}, | ||
payments::{ | ||
PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints, PaymentListFilters, | ||
PaymentListResponse, PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelRequest, | ||
PaymentsCaptureRequest, PaymentsRejectRequest, PaymentsRequest, PaymentsResponse, | ||
PaymentsRetrieveRequest, PaymentsStartRequest, RedirectionResponse, | ||
}, | ||
}; | ||
impl ApiEventMetric for PaymentsRetrieveRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
match self.resource_id { | ||
PaymentIdType::PaymentIntentId(ref id) => Some(ApiEventsType::Payment { | ||
payment_id: id.clone(), | ||
}), | ||
_ => None, | ||
} | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentsStartRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payment { | ||
payment_id: self.payment_id.clone(), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentsCaptureRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payment { | ||
payment_id: self.payment_id.to_owned(), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentsCancelRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payment { | ||
payment_id: self.payment_id.clone(), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentsApproveRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payment { | ||
payment_id: self.payment_id.clone(), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentsRejectRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payment { | ||
payment_id: self.payment_id.clone(), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentsRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
match self.payment_id { | ||
Some(PaymentIdType::PaymentIntentId(ref id)) => Some(ApiEventsType::Payment { | ||
payment_id: id.clone(), | ||
}), | ||
_ => None, | ||
} | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentsResponse { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
self.payment_id | ||
.clone() | ||
.map(|payment_id| ApiEventsType::Payment { payment_id }) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentMethodResponse { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::PaymentMethod { | ||
payment_method_id: self.payment_method_id.clone(), | ||
payment_method: Some(self.payment_method), | ||
payment_method_type: self.payment_method_type, | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentMethodUpdate {} | ||
|
||
impl ApiEventMetric for PaymentMethodDeleteResponse { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::PaymentMethod { | ||
payment_method_id: self.payment_method_id.clone(), | ||
payment_method: None, | ||
payment_method_type: None, | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for CustomerPaymentMethodsListResponse {} | ||
|
||
impl ApiEventMetric for PaymentMethodListRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::PaymentMethodList { | ||
payment_id: self | ||
.client_secret | ||
.as_ref() | ||
.and_then(|cs| cs.rsplit_once("_secret_")) | ||
.map(|(pid, _)| pid.to_string()), | ||
}) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentListFilterConstraints { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::ResourceListAPI) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentListFilters { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::ResourceListAPI) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentListConstraints { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::ResourceListAPI) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentListResponse { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::ResourceListAPI) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PaymentListResponseV2 { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::ResourceListAPI) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for RedirectionResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use common_utils::events::{ApiEventMetric, ApiEventsType}; | ||
|
||
use crate::payouts::{ | ||
PayoutActionRequest, PayoutCreateRequest, PayoutCreateResponse, PayoutRetrieveRequest, | ||
}; | ||
|
||
impl ApiEventMetric for PayoutRetrieveRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payout) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PayoutCreateRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payout) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PayoutCreateResponse { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payout) | ||
} | ||
} | ||
|
||
impl ApiEventMetric for PayoutActionRequest { | ||
fn get_api_event_type(&self) -> Option<ApiEventsType> { | ||
Some(ApiEventsType::Payout) | ||
} | ||
} |
Oops, something went wrong.