mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
feat(router): Add /apply-payment-method-data endpoint (v2) (#9868)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -215,6 +215,13 @@ impl ApiEventMetric for payments::PaymentMethodBalanceCheckResponse {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
impl ApiEventMetric for payments::ApplyPaymentMethodDataResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
impl ApiEventMetric for PaymentsRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
|
||||
@ -71,12 +71,11 @@ use utoipa::ToSchema;
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
use crate::mandates;
|
||||
#[cfg(feature = "v2")]
|
||||
use crate::payment_methods;
|
||||
use crate::{
|
||||
admin::{self, MerchantConnectorInfo},
|
||||
enums as api_enums,
|
||||
mandates::RecurringDetails,
|
||||
payment_methods,
|
||||
};
|
||||
#[cfg(feature = "v1")]
|
||||
use crate::{disputes, ephemeral_key::EphemeralKeyCreateResponse, refunds, ValidateFieldAndGet};
|
||||
@ -3174,6 +3173,30 @@ pub enum BalanceCheckPaymentMethodData {
|
||||
GiftCard(GiftCardData),
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
|
||||
pub struct ApplyPaymentMethodDataRequest {
|
||||
pub payment_methods: Vec<BalanceCheckPaymentMethodData>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
|
||||
pub struct ApplyPaymentMethodDataResponse {
|
||||
pub remaining_amount: MinorUnit,
|
||||
#[schema(value_type = Currency)]
|
||||
pub currency: common_enums::Currency,
|
||||
pub requires_additional_pm_data: bool,
|
||||
pub surcharge_details: Option<Vec<ApplyPaymentMethodDataSurchargeResponseItem>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
|
||||
pub struct ApplyPaymentMethodDataSurchargeResponseItem {
|
||||
#[schema(value_type = PaymentMethod)]
|
||||
pub payment_method_type: api_enums::PaymentMethod,
|
||||
#[schema(value_type = PaymentMethodType)]
|
||||
pub payment_method_subtype: api_enums::PaymentMethodType,
|
||||
#[schema(value_type = Option<SurchargeDetailsResponse>)]
|
||||
pub surcharge_details: Option<payment_methods::SurchargeDetailsResponse>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, ToSchema, Eq, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct BHNGiftCardDetails {
|
||||
|
||||
Reference in New Issue
Block a user