Skip to content

Commit

Permalink
Merge branch 'main' into fix-custom-headers
Browse files Browse the repository at this point in the history
  • Loading branch information
pixincreate authored Nov 8, 2023
2 parents 3072ec1 + 8985794 commit 7e8e99a
Show file tree
Hide file tree
Showing 43 changed files with 722 additions and 105 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ All notable changes to HyperSwitch will be documented here.

- - -

## 1.74.0 (2023-11-08)

### Features

- **core:** Use redis as temp locker instead of basilisk ([#2789](https://github.com/juspay/hyperswitch/pull/2789)) ([`6678689`](https://github.com/juspay/hyperswitch/commit/6678689265ae9a4fbb7a43c1938237d349c5a68e))
- **events:** Add request details to api events ([#2769](https://github.com/juspay/hyperswitch/pull/2769)) ([`164d1c6`](https://github.com/juspay/hyperswitch/commit/164d1c66fbcb84104db07412496114db2f8c5c0c))
- **router:** Add `gateway_status_map` interface ([#2804](https://github.com/juspay/hyperswitch/pull/2804)) ([`a429b23`](https://github.com/juspay/hyperswitch/commit/a429b23c7f21c9d08a79895c0b770b35aab725f7))
- **test_utils:** Add custom-headers and custom delay support to rustman ([#2636](https://github.com/juspay/hyperswitch/pull/2636)) ([`1effddd`](https://github.com/juspay/hyperswitch/commit/1effddd0a0d3985d6df03c4ae9be28712befc05e))

### Bug Fixes

- **connector:** Add attempt_status in field in error_response ([#2794](https://github.com/juspay/hyperswitch/pull/2794)) ([`5642fef`](https://github.com/juspay/hyperswitch/commit/5642fef52a6d591d12c5745ed381f41a1593f183))

### Refactors

- **config:** Update payment method filter of Klarna in Stripe ([#2807](https://github.com/juspay/hyperswitch/pull/2807)) ([`21ce807`](https://github.com/juspay/hyperswitch/commit/21ce8079f4cb11d70c5eaae78f83773141c67d0c))
- **router:** Add parameter connectors to get_request_body function ([#2708](https://github.com/juspay/hyperswitch/pull/2708)) ([`7623ea9`](https://github.com/juspay/hyperswitch/commit/7623ea93bee61b0bb22b68e86f44de17f04f876b))

### Documentation

- **README:** Update README ([#2800](https://github.com/juspay/hyperswitch/pull/2800)) ([`bef0a04`](https://github.com/juspay/hyperswitch/commit/bef0a04edc6323b3b7a2e0dd7eeb7954915ba7cf))

**Full Changelog:** [`v1.73.0...v1.74.0`](https://github.com/juspay/hyperswitch/compare/v1.73.0...v1.74.0)

- - -


## 1.73.0 (2023-11-07)

### Features
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,8 @@ pub struct ToggleKVResponse {

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ToggleKVRequest {
#[serde(skip_deserializing)]
pub merchant_id: String,
/// Status of KV for the specific merchant
#[schema(example = true)]
pub kv_enabled: bool,
Expand Down
6 changes: 6 additions & 0 deletions crates/api_models/src/api_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ pub struct UpdateApiKeyRequest {
/// rotating your keys once every 6 months.
#[schema(example = "2022-09-10T10:11:12Z")]
pub expiration: Option<ApiKeyExpiration>,

#[serde(skip_deserializing)]
pub key_id: String,

#[serde(skip_deserializing)]
pub merchant_id: String,
}

/// The response body for revoking an API Key.
Expand Down
74 changes: 74 additions & 0 deletions crates/api_models/src/events.rs
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
);
35 changes: 35 additions & 0 deletions crates/api_models/src/events/customer.rs
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(),
})
}
}
151 changes: 151 additions & 0 deletions crates/api_models/src/events/payment.rs
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 {}
29 changes: 29 additions & 0 deletions crates/api_models/src/events/payouts.rs
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)
}
}
Loading

0 comments on commit 7e8e99a

Please sign in to comment.