feat(router): add /relay endpoint (#6870)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Shankar Singh C
2024-12-20 19:36:54 +05:30
committed by GitHub
parent 02f0824d30
commit 22de8ad132
11 changed files with 468 additions and 1 deletions

View File

@ -84,6 +84,10 @@ Never share your secret api keys. Keep them guarded and secure.
routes::payments::payments_complete_authorize,
routes::payments::payments_post_session_tokens,
// Routes for relay
routes::relay,
routes::relay_retrieve,
// Routes for refunds
routes::refunds::refunds_create,
routes::refunds::refunds_retrieve,
@ -520,6 +524,13 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payment_methods::PaymentMethodCollectLinkResponse,
api_models::refunds::RefundListRequest,
api_models::refunds::RefundListResponse,
api_models::relay::RelayRequest,
api_models::relay::RelayType,
api_models::relay::RelayData,
api_models::relay::RelayRefundRequest,
api_models::relay::RelayResponse,
api_models::relay::RelayStatus,
api_models::relay::RelayError,
api_models::payments::AmountFilter,
api_models::mandates::MandateRevokedResponse,
api_models::mandates::MandateResponse,

View File

@ -16,10 +16,11 @@ pub mod payouts;
pub mod poll;
pub mod profile;
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::*, routing::*, webhook_events::*,
payment_method::*, payments::*, poll::*, refunds::*, relay::*, routing::*, webhook_events::*,
};

View File

@ -0,0 +1,57 @@
/// Relay - Create
///
/// Creates a relay request.
#[utoipa::path(
post,
path = "/relay",
request_body(
content = RelayRequest,
examples((
"Create a relay request" = (
value = json!({
"connector_resource_id": "7256228702616471803954",
"connector_id": "mca_5apGeP94tMts6rg3U3kR",
"type": "refund",
"data": {
"amount": 6540,
"currency": "USD"
}
})
)
))
),
responses(
(status = 200, description = "Relay request", body = RelayResponse),
(status = 400, description = "Invalid data")
),
params(
("X-Profile-Id" = String, Header, description = "Profile ID for authentication"),
("X-Idempotency-Key" = String, Header, description = "Idempotency Key for relay request")
),
tag = "Relay",
operation_id = "Relay Request",
security(("api_key" = []))
)]
pub async fn relay() {}
/// Relay - Retrieve
///
/// Retrieves a relay details.
#[utoipa::path(
get,
path = "/relay/{relay_id}",
params (("id" = String, Path, description = "The unique identifier for the Relay")),
responses(
(status = 200, description = "Relay Retrieved", body = RelayResponse),
(status = 404, description = "Relay details was not found")
),
params(
("X-Profile-Id" = String, Header, description = "Profile ID for authentication")
),
tag = "Relay",
operation_id = "Retrieve a Relay details",
security(("api_key" = []), ("ephemeral_key" = []))
)]
pub async fn relay_retrieve() {}