Skip to content

Commit 1be28d3

Browse files
feat(router): add /retrieve api for relay (#6924)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
1 parent 1ebd494 commit 1be28d3

File tree

36 files changed

+1833
-12
lines changed

36 files changed

+1833
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: openapi_spec get /relay/{relay_id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: openapi_spec post /relay
3+
---

api-reference/mint.json

+7
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

+281
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,170 @@
2270922826
},
2271022827
"additionalProperties": false
2271122828
},
22829+
"RelayData": {
22830+
"oneOf": [
22831+
{
22832+
"type": "object",
22833+
"required": [
22834+
"refund"
22835+
],
22836+
"properties": {
22837+
"refund": {
22838+
"$ref": "#/components/schemas/RelayRefundRequest"
22839+
}
22840+
}
22841+
}
22842+
]
22843+
},
22844+
"RelayError": {
22845+
"type": "object",
22846+
"required": [
22847+
"code",
22848+
"message"
22849+
],
22850+
"properties": {
22851+
"code": {
22852+
"type": "string",
22853+
"description": "The error code"
22854+
},
22855+
"message": {
22856+
"type": "string",
22857+
"description": "The error message"
22858+
}
22859+
}
22860+
},
22861+
"RelayRefundRequest": {
22862+
"type": "object",
22863+
"required": [
22864+
"amount",
22865+
"currency"
22866+
],
22867+
"properties": {
22868+
"amount": {
22869+
"type": "integer",
22870+
"format": "int64",
22871+
"description": "The amount that is being refunded",
22872+
"example": 6540
22873+
},
22874+
"currency": {
22875+
"$ref": "#/components/schemas/Currency"
22876+
},
22877+
"reason": {
22878+
"type": "string",
22879+
"description": "The reason for the refund",
22880+
"example": "Customer returned the product",
22881+
"nullable": true,
22882+
"maxLength": 255
22883+
}
22884+
}
22885+
},
22886+
"RelayRequest": {
22887+
"type": "object",
22888+
"required": [
22889+
"connector_resource_id",
22890+
"connector_id",
22891+
"type"
22892+
],
22893+
"properties": {
22894+
"connector_resource_id": {
22895+
"type": "string",
22896+
"description": "The identifier that is associated to a resource at the connector reference to which the relay request is being made",
22897+
"example": "7256228702616471803954"
22898+
},
22899+
"connector_id": {
22900+
"type": "string",
22901+
"description": "Identifier of the connector ( merchant connector account ) which was chosen to make the payment",
22902+
"example": "mca_5apGeP94tMts6rg3U3kR"
22903+
},
22904+
"type": {
22905+
"$ref": "#/components/schemas/RelayType"
22906+
},
22907+
"data": {
22908+
"allOf": [
22909+
{
22910+
"$ref": "#/components/schemas/RelayData"
22911+
}
22912+
],
22913+
"nullable": true
22914+
}
22915+
}
22916+
},
22917+
"RelayResponse": {
22918+
"type": "object",
22919+
"required": [
22920+
"id",
22921+
"status",
22922+
"connector_resource_id",
22923+
"connector_id",
22924+
"profile_id",
22925+
"type"
22926+
],
22927+
"properties": {
22928+
"id": {
22929+
"type": "string",
22930+
"description": "The unique identifier for the Relay",
22931+
"example": "relay_mbabizu24mvu3mela5njyhpit4"
22932+
},
22933+
"status": {
22934+
"$ref": "#/components/schemas/RelayStatus"
22935+
},
22936+
"connector_resource_id": {
22937+
"type": "string",
22938+
"description": "The identifier that is associated to a resource at the connector reference to which the relay request is being made",
22939+
"example": "pi_3MKEivSFNglxLpam0ZaL98q9"
22940+
},
22941+
"error": {
22942+
"allOf": [
22943+
{
22944+
"$ref": "#/components/schemas/RelayError"
22945+
}
22946+
],
22947+
"nullable": true
22948+
},
22949+
"connector_reference_id": {
22950+
"type": "string",
22951+
"description": "The identifier that is associated to a resource at the connector to which the relay request is being made",
22952+
"example": "re_3QY4TnEOqOywnAIx1Mm1p7GQ",
22953+
"nullable": true
22954+
},
22955+
"connector_id": {
22956+
"type": "string",
22957+
"description": "Identifier of the connector ( merchant connector account ) which was chosen to make the payment",
22958+
"example": "mca_5apGeP94tMts6rg3U3kR"
22959+
},
22960+
"profile_id": {
22961+
"type": "string",
22962+
"description": "The business profile that is associated with this relay request.",
22963+
"example": "pro_abcdefghijklmnopqrstuvwxyz"
22964+
},
22965+
"type": {
22966+
"$ref": "#/components/schemas/RelayType"
22967+
},
22968+
"data": {
22969+
"allOf": [
22970+
{
22971+
"$ref": "#/components/schemas/RelayData"
22972+
}
22973+
],
22974+
"nullable": true
22975+
}
22976+
}
22977+
},
22978+
"RelayStatus": {
22979+
"type": "string",
22980+
"enum": [
22981+
"created",
22982+
"pending",
22983+
"success",
22984+
"failure"
22985+
]
22986+
},
22987+
"RelayType": {
22988+
"type": "string",
22989+
"enum": [
22990+
"refund"
22991+
]
22992+
},
2271222993
"RequestPaymentMethodTypes": {
2271322994
"type": "object",
2271422995
"required": [

crates/api_models/src/lib.rs

+1
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)