btcpayserver/BTCPayServer/wwwroot/swagger/v1/swagger.template.misc.json
Wouter Samaey d8c1c51a21
Auto-detect language on payment page (#2552)
* Auto-detect language on payment page

based on the requst Accept-Language header, which is the language you configured in your browser/OS and this 99.99% accurate

* Update BTCPayServer/Services/LanguageService.cs

Co-authored-by: britttttk <39231115+britttttk@users.noreply.github.com>

* Update BTCPayServer/Services/LanguageService.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

* Update BTCPayServer/Services/LanguageService.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

* Update BTCPayServer/Services/LanguageService.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

* Added loop for all locales in Accept-Language sorted by weight + check if know this language

* New public method so a unit test can be created for it

* Unit test for language detection

* Fix language service when not in browser context

* fall back to default lang

* Auto-detect setting + ?lang=auto support

* Added invoice param "?lang=auto" info to docs

* Using null-coalescing assignment operator

* Reduce complexity and http dependency in language service

Co-authored-by: britttttk <39231115+britttttk@users.noreply.github.com>
Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
2021-07-27 08:17:56 +02:00

128 lines
5.1 KiB
JSON

{
"paths": {
"/misc/permissions": {
"get": {
"tags": [
"Miscelleneous"
],
"summary": "Permissions metadata",
"description": "The metadata of available permissions",
"operationId": "permissionsMetadata",
"responses": {
"200": {
"description": "The metadata of available permissions",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The permission id",
"nullable": false
},
"included": {
"type": "array",
"description": "Permissions included in this array are also granted by this permission",
"nullable": false,
"items": {
"type": "string"
}
}
}
}
}
}
}
}
},
"security": []
}
},
"/misc/lang": {
"get": {
"tags": [
"Miscelleneous"
],
"summary": "Language codes",
"description": "The supported language codes",
"operationId": "langCodes",
"responses": {
"200": {
"description": "The supported language codes",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The language code",
"nullable": false
},
"currentLanguage": {
"type": "string",
"description": "The language name",
"nullable": false
}
}
}
}
}
}
}
},
"security": []
}
},
"/i/{invoiceId}": {
"parameters": [
{
"name": "invoiceId",
"in": "path",
"required": true,
"description": "The invoice id",
"schema": {
"type": "string"
}
},
{
"name": "lang",
"in": "query",
"required": false,
"description": "The preferred language of the checkout page. You can use \"auto\" to use the language of the customer's browser or see the list of language codes with [this operation](#operation/langCodes).",
"schema": {
"type": "string"
}
}
],
"get": {
"tags": [
"Miscelleneous"
],
"summary": "Invoice checkout",
"description": "View the checkout page of an invoice",
"responses": {
"200": {
"description": "The checkout page",
"content": {
"text/html": {
"example": "The HTML checkout page of the invoice"
}
}
}
},
"security": []
}
}
},
"tags": [
{
"name": "Miscelleneous"
}
]
}