Skip to content

Commit 7e84ecd

Browse files
feat(router): add /relay endpoint (#6870)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
1 parent 2606083 commit 7e84ecd

File tree

11 files changed

+468
-1
lines changed

11 files changed

+468
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: openapi_spec get /relay/{relay_id}
3+
---
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: openapi_spec post /relay
3+
---

api-reference/mint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@
234234
"api-reference/routing/routing--activate-config"
235235
]
236236
},
237+
{
238+
"group": "Relay",
239+
"pages": [
240+
"api-reference/relay/relay",
241+
"api-reference/relay/relay--retrieve"
242+
]
243+
},
237244
{
238245
"group": "Schemas",
239246
"pages": ["api-reference/schemas/outgoing--webhook"]

api-reference/openapi_spec.json

Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,123 @@
950950
]
951951
}
952952
},
953+
"/relay": {
954+
"post": {
955+
"tags": [
956+
"Relay"
957+
],
958+
"summary": "Relay - Create",
959+
"description": "Creates a relay request.",
960+
"operationId": "Relay Request",
961+
"parameters": [
962+
{
963+
"name": "X-Profile-Id",
964+
"in": "header",
965+
"description": "Profile ID for authentication",
966+
"required": true,
967+
"schema": {
968+
"type": "string"
969+
}
970+
},
971+
{
972+
"name": "X-Idempotency-Key",
973+
"in": "header",
974+
"description": "Idempotency Key for relay request",
975+
"required": true,
976+
"schema": {
977+
"type": "string"
978+
}
979+
}
980+
],
981+
"requestBody": {
982+
"content": {
983+
"application/json": {
984+
"schema": {
985+
"$ref": "#/components/schemas/RelayRequest"
986+
},
987+
"examples": {
988+
"Create a relay request": {
989+
"value": {
990+
"connector_id": "mca_5apGeP94tMts6rg3U3kR",
991+
"connector_resource_id": "7256228702616471803954",
992+
"data": {
993+
"amount": 6540,
994+
"currency": "USD"
995+
},
996+
"type": "refund"
997+
}
998+
}
999+
}
1000+
}
1001+
},
1002+
"required": true
1003+
},
1004+
"responses": {
1005+
"200": {
1006+
"description": "Relay request",
1007+
"content": {
1008+
"application/json": {
1009+
"schema": {
1010+
"$ref": "#/components/schemas/RelayResponse"
1011+
}
1012+
}
1013+
}
1014+
},
1015+
"400": {
1016+
"description": "Invalid data"
1017+
}
1018+
},
1019+
"security": [
1020+
{
1021+
"api_key": []
1022+
}
1023+
]
1024+
}
1025+
},
1026+
"/relay/{relay_id}": {
1027+
"get": {
1028+
"tags": [
1029+
"Relay"
1030+
],
1031+
"summary": "Relay - Retrieve",
1032+
"description": "Retrieves a relay details.",
1033+
"operationId": "Retrieve a Relay details",
1034+
"parameters": [
1035+
{
1036+
"name": "X-Profile-Id",
1037+
"in": "header",
1038+
"description": "Profile ID for authentication",
1039+
"required": true,
1040+
"schema": {
1041+
"type": "string"
1042+
}
1043+
}
1044+
],
1045+
"responses": {
1046+
"200": {
1047+
"description": "Relay Retrieved",
1048+
"content": {
1049+
"application/json": {
1050+
"schema": {
1051+
"$ref": "#/components/schemas/RelayResponse"
1052+
}
1053+
}
1054+
}
1055+
},
1056+
"404": {
1057+
"description": "Relay details was not found"
1058+
}
1059+
},
1060+
"security": [
1061+
{
1062+
"api_key": []
1063+
},
1064+
{
1065+
"ephemeral_key": []
1066+
}
1067+
]
1068+
}
1069+
},
9531070
"/refunds": {
9541071
"post": {
9551072
"tags": [
@@ -22709,6 +22826,161 @@
2270922826
},
2271022827
"additionalProperties": false
2271122828
},
22829+
"RelayData": {
22830+
"oneOf": [
22831+
{
22832+
"$ref": "#/components/schemas/RelayRefundRequest"
22833+
}
22834+
]
22835+
},
22836+
"RelayError": {
22837+
"type": "object",
22838+
"required": [
22839+
"code",
22840+
"message"
22841+
],
22842+
"properties": {
22843+
"code": {
22844+
"type": "string",
22845+
"description": "The error code"
22846+
},
22847+
"message": {
22848+
"type": "string",
22849+
"description": "The error message"
22850+
}
22851+
}
22852+
},
22853+
"RelayRefundRequest": {
22854+
"type": "object",
22855+
"required": [
22856+
"amount",
22857+
"currency"
22858+
],
22859+
"properties": {
22860+
"amount": {
22861+
"type": "integer",
22862+
"format": "int64",
22863+
"description": "The amount that is being refunded",
22864+
"example": 6540
22865+
},
22866+
"currency": {
22867+
"$ref": "#/components/schemas/Currency"
22868+
},
22869+
"reason": {
22870+
"type": "string",
22871+
"description": "The reason for the refund",
22872+
"example": "Customer returned the product",
22873+
"nullable": true,
22874+
"maxLength": 255
22875+
}
22876+
}
22877+
},
22878+
"RelayRequest": {
22879+
"type": "object",
22880+
"required": [
22881+
"connector_resource_id",
22882+
"connector_id",
22883+
"type"
22884+
],
22885+
"properties": {
22886+
"connector_resource_id": {
22887+
"type": "string",
22888+
"description": "The identifier that is associated to a resource at the connector to which the relay request is being made",
22889+
"example": "7256228702616471803954"
22890+
},
22891+
"connector_id": {
22892+
"type": "string",
22893+
"description": "Identifier of the connector ( merchant connector account ) to which relay request is being made",
22894+
"example": "mca_5apGeP94tMts6rg3U3kR"
22895+
},
22896+
"type": {
22897+
"$ref": "#/components/schemas/RelayType"
22898+
},
22899+
"data": {
22900+
"allOf": [
22901+
{
22902+
"$ref": "#/components/schemas/RelayData"
22903+
}
22904+
],
22905+
"nullable": true
22906+
}
22907+
}
22908+
},
22909+
"RelayResponse": {
22910+
"type": "object",
22911+
"required": [
22912+
"id",
22913+
"status",
22914+
"connector_resource_id",
22915+
"connector_id",
22916+
"profile_id",
22917+
"type"
22918+
],
22919+
"properties": {
22920+
"id": {
22921+
"type": "string",
22922+
"description": "The unique identifier for the Relay",
22923+
"example": "relay_mbabizu24mvu3mela5njyhpit4"
22924+
},
22925+
"status": {
22926+
"$ref": "#/components/schemas/RelayStatus"
22927+
},
22928+
"connector_reference_id": {
22929+
"type": "string",
22930+
"description": "The reference identifier provided by the connector for the relay request",
22931+
"example": "pi_3MKEivSFNglxLpam0ZaL98q9",
22932+
"nullable": true
22933+
},
22934+
"error": {
22935+
"allOf": [
22936+
{
22937+
"$ref": "#/components/schemas/RelayError"
22938+
}
22939+
],
22940+
"nullable": true
22941+
},
22942+
"connector_resource_id": {
22943+
"type": "string",
22944+
"description": "The identifier that is associated to a resource at the connector to which the relay request is being made",
22945+
"example": "7256228702616471803954"
22946+
},
22947+
"connector_id": {
22948+
"type": "string",
22949+
"description": "Identifier of the connector ( merchant connector account ) to which relay request is being made",
22950+
"example": "mca_5apGeP94tMts6rg3U3kR"
22951+
},
22952+
"profile_id": {
22953+
"type": "string",
22954+
"description": "The business profile that is associated with this relay request",
22955+
"example": "pro_abcdefghijklmnopqrstuvwxyz"
22956+
},
22957+
"type": {
22958+
"$ref": "#/components/schemas/RelayType"
22959+
},
22960+
"data": {
22961+
"allOf": [
22962+
{
22963+
"$ref": "#/components/schemas/RelayData"
22964+
}
22965+
],
22966+
"nullable": true
22967+
}
22968+
}
22969+
},
22970+
"RelayStatus": {
22971+
"type": "string",
22972+
"enum": [
22973+
"success",
22974+
"processing",
22975+
"failure"
22976+
]
22977+
},
22978+
"RelayType": {
22979+
"type": "string",
22980+
"enum": [
22981+
"refund"
22982+
]
22983+
},
2271222984
"RequestPaymentMethodTypes": {
2271322985
"type": "object",
2271422986
"required": [

crates/api_models/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub mod poll;
3131
#[cfg(feature = "recon")]
3232
pub mod recon;
3333
pub mod refunds;
34+
pub mod relay;
3435
pub mod routing;
3536
pub mod surcharge_decision_configs;
3637
pub mod user;

0 commit comments

Comments
 (0)