refactor(router): Make Gift Card Balance Check API Generic (v2) (#9856)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Anurag Thakur
2025-10-21 15:09:48 +05:30
committed by GitHub
parent 6f96064e07
commit 2e38b2ce5c
15 changed files with 307 additions and 112 deletions

View File

@ -557,8 +557,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::RequestSurchargeDetails,
api_models::payments::PaymentRevenueRecoveryMetadata,
api_models::payments::BillingConnectorPaymentDetails,
api_models::payments::GiftCardBalanceCheckResponse,
api_models::payments::PaymentsGiftCardBalanceCheckRequest,
api_models::payments::PaymentMethodBalanceCheckResponse,
api_models::payments::PaymentMethodBalanceCheckRequest,
api_models::enums::PaymentConnectorTransmission,
api_models::enums::TriggeredBy,
api_models::payments::PaymentAttemptResponse,
@ -633,6 +633,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::ephemeral_key::ClientSecretResponse,
api_models::payments::CustomerDetails,
api_models::payments::GiftCardData,
api_models::payments::BalanceCheckPaymentMethodData,
api_models::payments::GiftCardDetails,
api_models::payments::BHNGiftCardDetails,
api_models::payments::MobilePaymentData,

View File

@ -1307,13 +1307,13 @@ pub fn list_payment_methods() {}
)]
pub fn payments_list() {}
/// Payments - Gift Card Balance Check
/// Payments - Payment Method Balance Check
///
/// Check the balance of the provided gift card. This endpoint also returns whether the gift card balance is enough to cover the entire amount or another payment method is needed
/// Check the balance of the provided payment method. Also validates whether the PM currency matches the payment currency
#[cfg(feature = "v2")]
#[utoipa::path(
get,
path = "/v2/payments/{id}/check-gift-card-balance",
post,
path = "/v2/payments/{id}/payment-methods/check-balance",
params(
("id" = String, Path, description = "The global payment id"),
(
@ -1323,13 +1323,13 @@ pub fn payments_list() {}
),
),
request_body(
content = PaymentsGiftCardBalanceCheckRequest,
content = PaymentMethodBalanceCheckRequest,
),
responses(
(status = 200, description = "Get the Gift Card Balance", body = GiftCardBalanceCheckResponse),
(status = 200, description = "Get the Payment Method Balance", body = PaymentMethodBalanceCheckResponse),
),
tag = "Payments",
operation_id = "Retrieve Gift Card Balance",
operation_id = "Retrieve Payment Method Balance",
security(("publishable_key" = []))
)]
pub fn payment_check_gift_card_balance() {}