Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(router): add /retrieve api for relay #6924

Merged
merged 5 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api-reference/api-reference/relay/relay--retrieve.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: openapi_spec get /relay/{relay_id}
---
3 changes: 3 additions & 0 deletions api-reference/api-reference/relay/relay.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: openapi_spec post /relay
---
7 changes: 7 additions & 0 deletions api-reference/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@
"api-reference/routing/routing--activate-config"
]
},
{
"group": "Relay",
"pages": [
"api-reference/relay/relay",
"api-reference/relay/relay--retrieve"
]
},
{
"group": "Schemas",
"pages": ["api-reference/schemas/outgoing--webhook"]
Expand Down
281 changes: 281 additions & 0 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,123 @@
]
}
},
"/relay": {
"post": {
"tags": [
"Relay"
],
"summary": "Relay - Create",
"description": "Creates a relay request.",
"operationId": "Relay Request",
"parameters": [
{
"name": "X-Profile-Id",
"in": "header",
"description": "Profile ID for authentication",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Idempotency-Key",
"in": "header",
"description": "Idempotency Key for relay request",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RelayRequest"
},
"examples": {
"Create a relay request": {
"value": {
"connector_id": "mca_5apGeP94tMts6rg3U3kR",
"connector_resource_id": "7256228702616471803954",
"data": {
"amount": 6540,
"currency": "USD"
},
"type": "refund"
}
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Relay request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RelayResponse"
}
}
}
},
"400": {
"description": "Invalid data"
}
},
"security": [
{
"api_key": []
}
]
}
},
"/relay/{relay_id}": {
"get": {
"tags": [
"Relay"
],
"summary": "Relay - Retrieve",
"description": "Retrieves a relay details.",
"operationId": "Retrieve a Relay details",
"parameters": [
{
"name": "X-Profile-Id",
"in": "header",
"description": "Profile ID for authentication",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Relay Retrieved",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RelayResponse"
}
}
}
},
"404": {
"description": "Relay details was not found"
}
},
"security": [
{
"api_key": []
},
{
"ephemeral_key": []
}
]
}
},
"/refunds": {
"post": {
"tags": [
Expand Down Expand Up @@ -22709,6 +22826,170 @@
},
"additionalProperties": false
},
"RelayData": {
"oneOf": [
{
"type": "object",
"required": [
"refund"
],
"properties": {
"refund": {
"$ref": "#/components/schemas/RelayRefundRequest"
}
}
}
]
},
"RelayError": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string",
"description": "The error code"
},
"message": {
"type": "string",
"description": "The error message"
}
}
},
"RelayRefundRequest": {
"type": "object",
"required": [
"amount",
"currency"
],
"properties": {
"amount": {
"type": "integer",
"format": "int64",
"description": "The amount that is being refunded",
"example": 6540
},
"currency": {
"$ref": "#/components/schemas/Currency"
},
"reason": {
"type": "string",
"description": "The reason for the refund",
"example": "Customer returned the product",
"nullable": true,
"maxLength": 255
}
}
},
"RelayRequest": {
"type": "object",
"required": [
"connector_resource_id",
"connector_id",
"type"
],
"properties": {
"connector_resource_id": {
"type": "string",
"description": "The identifier that is associated to a resource at the connector reference to which the relay request is being made",
"example": "7256228702616471803954"
},
"connector_id": {
"type": "string",
"description": "Identifier of the connector ( merchant connector account ) which was chosen to make the payment",
"example": "mca_5apGeP94tMts6rg3U3kR"
},
"type": {
"$ref": "#/components/schemas/RelayType"
},
"data": {
"allOf": [
{
"$ref": "#/components/schemas/RelayData"
}
],
"nullable": true
}
}
},
"RelayResponse": {
"type": "object",
"required": [
"id",
"status",
"connector_resource_id",
"connector_id",
"profile_id",
"type"
],
"properties": {
"id": {
"type": "string",
"description": "The unique identifier for the Relay",
"example": "relay_mbabizu24mvu3mela5njyhpit4"
},
"status": {
"$ref": "#/components/schemas/RelayStatus"
},
"connector_resource_id": {
"type": "string",
"description": "The identifier that is associated to a resource at the connector reference to which the relay request is being made",
"example": "pi_3MKEivSFNglxLpam0ZaL98q9"
},
"error": {
"allOf": [
{
"$ref": "#/components/schemas/RelayError"
}
],
"nullable": true
},
"connector_reference_id": {
"type": "string",
"description": "The identifier that is associated to a resource at the connector to which the relay request is being made",
"example": "re_3QY4TnEOqOywnAIx1Mm1p7GQ",
"nullable": true
},
"connector_id": {
"type": "string",
"description": "Identifier of the connector ( merchant connector account ) which was chosen to make the payment",
"example": "mca_5apGeP94tMts6rg3U3kR"
},
"profile_id": {
"type": "string",
"description": "The business profile that is associated with this relay request.",
"example": "pro_abcdefghijklmnopqrstuvwxyz"
},
"type": {
"$ref": "#/components/schemas/RelayType"
},
"data": {
"allOf": [
{
"$ref": "#/components/schemas/RelayData"
}
],
"nullable": true
}
}
},
"RelayStatus": {
"type": "string",
"enum": [
"created",
"pending",
"success",
"failure"
]
},
"RelayType": {
"type": "string",
"enum": [
"refund"
]
},
"RequestPaymentMethodTypes": {
"type": "object",
"required": [
Expand Down
1 change: 1 addition & 0 deletions crates/api_models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub mod poll;
#[cfg(feature = "recon")]
pub mod recon;
pub mod refunds;
pub mod relay;
pub mod routing;
pub mod surcharge_decision_configs;
pub mod user;
Expand Down
Loading
Loading