mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(payment_methods_v2): add payment methods list endpoint (#6938)
Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -85,8 +85,8 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
routes::payments::payments_post_session_tokens,
|
||||
|
||||
// Routes for relay
|
||||
routes::relay,
|
||||
routes::relay_retrieve,
|
||||
routes::relay::relay,
|
||||
routes::relay::relay_retrieve,
|
||||
|
||||
// Routes for refunds
|
||||
routes::refunds::refunds_create,
|
||||
|
||||
@ -128,15 +128,14 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
routes::payments::list_payment_methods,
|
||||
|
||||
//Routes for payment methods
|
||||
routes::payment_method::list_customer_payment_method_for_payment,
|
||||
routes::payment_method::list_customer_payment_method_api,
|
||||
routes::payment_method::create_payment_method_api,
|
||||
routes::payment_method::create_payment_method_intent_api,
|
||||
routes::payment_method::list_payment_methods,
|
||||
routes::payment_method::confirm_payment_method_intent_api,
|
||||
routes::payment_method::payment_method_update_api,
|
||||
routes::payment_method::payment_method_retrieve_api,
|
||||
routes::payment_method::payment_method_delete_api,
|
||||
|
||||
// routes::payment_method::list_customer_payment_method_api,
|
||||
|
||||
//Routes for refunds
|
||||
routes::refunds::refunds_create,
|
||||
@ -208,7 +207,6 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payment_methods::PaymentMethodDeleteResponse,
|
||||
api_models::payment_methods::PaymentMethodUpdate,
|
||||
api_models::payment_methods::PaymentMethodUpdateData,
|
||||
api_models::payment_methods::CustomerDefaultPaymentMethodResponse,
|
||||
api_models::payment_methods::CardDetailFromLocker,
|
||||
api_models::payment_methods::PaymentMethodCreateData,
|
||||
api_models::payment_methods::CardDetail,
|
||||
@ -477,14 +475,15 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::AmountDetailsResponse,
|
||||
api_models::payments::BankCodeResponse,
|
||||
api_models::payments::PaymentMethodListResponseForPayments,
|
||||
api_models::payments::ResponsePaymentMethodTypesForPayments,
|
||||
api_models::payment_methods::RequiredFieldInfo,
|
||||
api_models::payment_methods::DefaultPaymentMethod,
|
||||
api_models::payment_methods::MaskedBankDetails,
|
||||
api_models::payment_methods::SurchargeDetailsResponse,
|
||||
api_models::payment_methods::SurchargeResponse,
|
||||
api_models::payment_methods::SurchargePercentage,
|
||||
api_models::payment_methods::PaymentMethodCollectLinkRequest,
|
||||
api_models::payment_methods::PaymentMethodCollectLinkResponse,
|
||||
api_models::payment_methods::PaymentMethodSubtypeSpecificData,
|
||||
api_models::payments::PaymentsRetrieveResponse,
|
||||
api_models::refunds::RefundListRequest,
|
||||
api_models::refunds::RefundListResponse,
|
||||
|
||||
@ -19,8 +19,3 @@ pub mod refunds;
|
||||
pub mod relay;
|
||||
pub mod routing;
|
||||
pub mod webhook_events;
|
||||
|
||||
pub use self::{
|
||||
customers::*, mandates::*, merchant_account::*, merchant_connector_account::*, organization::*,
|
||||
payment_method::*, payments::*, poll::*, refunds::*, relay::*, routing::*, webhook_events::*,
|
||||
};
|
||||
|
||||
@ -322,46 +322,27 @@ pub async fn payment_method_update_api() {}
|
||||
#[cfg(feature = "v2")]
|
||||
pub async fn payment_method_delete_api() {}
|
||||
|
||||
/// List customer saved payment methods for a payment
|
||||
/// Payment Methods - Payment Methods List
|
||||
///
|
||||
/// To filter and list the applicable payment methods for a particular Customer ID, is to be associated with a payment
|
||||
/// List the payment methods eligible for a payment method.
|
||||
#[cfg(feature = "v2")]
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/v2/payments/{id}/saved-payment-methods",
|
||||
request_body(
|
||||
content = PaymentMethodListRequest,
|
||||
// TODO: Add examples and add param for customer_id
|
||||
path = "/v2/payment-methods/{id}/list-enabled-payment-methods",
|
||||
params(
|
||||
("id" = String, Path, description = "The global payment method id"),
|
||||
(
|
||||
"X-Profile-Id" = String, Header,
|
||||
description = "Profile ID associated to the payment method intent",
|
||||
example = json!({"X-Profile-Id": "pro_abcdefghijklmnop"})
|
||||
),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", body = CustomerPaymentMethodsListResponse),
|
||||
(status = 400, description = "Invalid Data"),
|
||||
(status = 404, description = "Payment Methods does not exist in records")
|
||||
(status = 200, description = "Get the payment methods", body = PaymentMethodListResponseForPayments),
|
||||
(status = 404, description = "No payment method found with the given id")
|
||||
),
|
||||
tag = "Payment Methods",
|
||||
operation_id = "List all Payment Methods for a Customer",
|
||||
security(("publishable_key" = []))
|
||||
operation_id = "List Payment methods for a Payment Method Intent",
|
||||
security(("api_key" = [], "ephemeral_key" = []))
|
||||
)]
|
||||
#[cfg(feature = "v2")]
|
||||
pub async fn list_customer_payment_method_for_payment() {}
|
||||
|
||||
/// List saved payment methods for a Customer
|
||||
///
|
||||
/// To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/v2/customers/{id}/saved-payment-methods",
|
||||
request_body(
|
||||
content = PaymentMethodListRequest,
|
||||
// TODO: Add examples and add param for customer_id
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Payment Methods retrieved", body = CustomerPaymentMethodsListResponse),
|
||||
(status = 400, description = "Invalid Data"),
|
||||
(status = 404, description = "Payment Methods does not exist in records")
|
||||
),
|
||||
tag = "Payment Methods",
|
||||
operation_id = "List all Payment Methods for a Customer",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[cfg(feature = "v2")]
|
||||
pub async fn list_customer_payment_method_api() {}
|
||||
pub fn list_payment_methods() {}
|
||||
|
||||
Reference in New Issue
Block a user