Skip to content

Commit

Permalink
JSON Schema Update
Browse files Browse the repository at this point in the history
  • Loading branch information
binarysysadmin committed Mar 20, 2024
1 parent e3686b4 commit a820817
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _data/v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ groups:
title: P2P Advertiser Update
- name: p2p_chat_create
title: P2P Chat Create
- name: p2p_country_list
title: P2P Country List
- name: p2p_order_cancel
title: P2P Order Cancel
- name: p2p_order_confirm
Expand Down
4 changes: 4 additions & 0 deletions config/v3/p2p_country_list/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"p2p_country_list": 1,
"country": "id"
}
155 changes: 155 additions & 0 deletions config/v3/p2p_country_list/receive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "P2P Country List (response)",
"description": "List all or specific country and its payment methods.",
"type": "object",
"required": [
"echo_req",
"msg_type"
],
"properties": {
"p2p_country_list": {
"description": "Country identified by country code",
"type": "object",
"additionalProperties": true,
"patternProperties": {
"^([a-z]{2})?$": {
"description": "Country code identifier.",
"type": "object",
"additionalProperties": false,
"required": [
"country_name",
"cross_border_ads_enabled",
"fixed_rate_adverts",
"float_rate_adverts",
"float_rate_offset_limit",
"local_currency",
"payment_methods"
],
"properties": {
"country_name": {
"description": "Display name of country.",
"type": "string"
},
"cross_border_ads_enabled": {
"description": "When 1, users in this country may place orders on ads in other countries.",
"type": "integer",
"enum": [
0,
1
]
},
"fixed_rate_adverts": {
"description": "Availability of fixed rate adverts.",
"type": "string",
"enum": [
"disabled",
"enabled",
"list_only"
]
},
"float_rate_adverts": {
"description": "Availability of floating rate adverts.",
"type": "string",
"enum": [
"disabled",
"enabled",
"list_only"
]
},
"float_rate_offset_limit": {
"description": "Maximum rate offset for floating rate adverts.",
"type": "number"
},
"local_currency": {
"description": "Local currency of the country.",
"type": "string",
"pattern": "^[a-zA-Z0-9]{2,20}$",
"examples": [
"USD"
]
},
"payment_methods": {
"description": "Payment method identifier.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^[a-z0-9_]{1,30}$": {
"description": "Payment method identifier.",
"type": "object",
"additionalProperties": false,
"properties": {
"display_name": {
"description": "Display name of payment method.",
"type": "string"
},
"fields": {
"description": "Payment method field definitions.",
"type": "object",
"additionalProperties": false,
"minProperties": 1,
"patternProperties": {
"^[a-z0-9_]{1,30}$": {
"description": "Field identifier.",
"type": "object",
"additionalProperties": false,
"required": [
"display_name",
"required",
"type"
],
"properties": {
"display_name": {
"description": "Display name of payment method field.",
"type": "string"
},
"required": {
"description": "Is field required or optional.",
"type": "integer"
},
"type": {
"description": "Field type.",
"type": "string",
"enum": [
"text",
"memo"
]
}
}
}
}
},
"type": {
"description": "Payment method type.",
"type": "string",
"enum": [
"bank",
"ewallet",
"other"
]
}
}
}
}
}
}
}
}
},
"echo_req": {
"description": "Echo of the request made.",
"type": "object"
},
"msg_type": {
"description": "Action name of the request made.",
"type": "string",
"enum": [
"p2p_country_list"
]
},
"req_id": {
"description": "Optional field sent in request to map to response, present only when request contains `req_id`.",
"type": "integer"
}
}
}
41 changes: 41 additions & 0 deletions config/v3/p2p_country_list/send.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "P2P Country List (request)",
"description": "List all or specific country and its payment methods.",
"type": "object",
"auth_required": 1,
"auth_scopes": [
"payments"
],
"additionalProperties": false,
"required": [
"p2p_country_list"
],
"properties": {
"p2p_country_list": {
"description": "Must be 1",
"type": "integer",
"enum": [
1
]
},
"country": {
"description": "[Optional] 2-letter country code. If not provided all countries are returned.",
"type": "string",
"pattern": "^([a-z]{2})?$"
},
"loginid": {
"description": "[Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id.",
"type": "string",
"pattern": "^[A-Za-z]+[0-9]+$"
},
"passthrough": {
"description": "[Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field.",
"type": "object"
},
"req_id": {
"description": "[Optional] Used to map request to response.",
"type": "integer"
}
}
}

0 comments on commit a820817

Please sign in to comment.