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 /relay endpoint #6870

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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
253 changes: 253 additions & 0 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,104 @@
]
}
},
"/relay": {
"post": {
"tags": [
"Relay"
],
"summary": "Relay - Create",
"description": "Creates a relay request.",
"operationId": "Relay Request",
"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"
},
"profile_id": "pro_abcdefghijklmnopqrstuvwxyz",
"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": "id",
"in": "path",
"description": "The unique identifier for the Relay",
"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 @@ -22896,6 +22994,161 @@
},
"additionalProperties": false
},
"RelayData": {
"oneOf": [
{
"$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",
"profile_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 ) to which relay request is being made",
"example": "mca_5apGeP94tMts6rg3U3kR"
},
"profile_id": {
"type": "string",
"description": "The business profile that is associated with this payment request",
"example": "pro_abcdefghijklmnopqrstuvwxyz"
},
"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"
},
"error": {
"allOf": [
{
"$ref": "#/components/schemas/RelayError"
}
],
"nullable": true
},
"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"
},
"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": [
"success",
"processing",
"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