btcpayserver/BTCPayServer/wwwroot/swagger/v1/swagger.template.payment-requests.json
Andrew Camilleri 022285806b
Form Builder (#4137)
* wip

* Cleanups

* UI updates

* Update UIFormsController.cs

* Make predefined forms usable statically

* Add support for pos app + forms

* pay request form rough support

* invoice form through receipt page

* Display form name in inherit from store setting

* Do not request additional forms on invoice from pay request

* fix up code

* move checkoutform id in checkout appearance outside of checkotu v2 toggle

* general fixes for form system

* fix pav bug

* UI updates

* Fix warnings in Form builder (#4331)

* Fix build warnings about string?

Enable nullable on UIFormsController.cs
Fixes CS8632 The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

* Clean up lack of space in injected services in Submit() of UIFormsController.cs

* Remove unused variables (CS0219) and assignment of nullable value to nullable type (CS8600)

* Cleanup double semicolons while we're at tit

* Fix: If reverse proxy wasn't well configured, and error message should have been displayed (#4322)

* fix monero issue

* Server Settings: Update Policies page (#4326)

Handles the multiple submit buttons on that page and closes #4319.

Contains some UI unifications with other pages and also shows the block explorers without needing to toggle the section via JS.

* Change confirmed to settled. (#4328)

* POS: Fix null pointer

Introduced in #4307, the referenced object needs to be `itemChoice` instead of `choice`.

* Add documentation link to plugins (#4329)

* Add documentation link to plugins

* Minor UI updates

Co-authored-by: Dennis Reimann <mail@dennisreimann.de>

* Fix flaky test (#4330)

* Fix flaky test

* Update BTCPayServer/PayoutProcessors/BaseAutomatedPayoutProcessor.cs

Co-authored-by: d11n <mail@dennisreimann.de>

Co-authored-by: d11n <mail@dennisreimann.de>

* Remove invoice and store level form

* add form test

* fix migration for forms

* fix

* make pay request form submission redirect to invoice

* Refactor FormQuery to only be able to query single store and single form

* Put the Authorize at controller level on UIForms

* Fix warnings

* Fix ef request

* Fix query to forms, ensure no permission bypass

* Fix modify

* Remove storeId from step form

* Remove useless storeId parameter

* Hide custom form feature in UI

* Minor cleanups

* Remove custom form options from select for now

* More minor syntax cleanups

* Update test

* Add index - needs migration

* Refactoring: Use PostRedirect instead of TempData for data transfer

* Remove untested and unfinished code

* formResponse should be a JObject, not a string

* Fix case for Form type

Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
Co-authored-by: JesterHodl <103882255+jesterhodl@users.noreply.github.com>
Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
Co-authored-by: Andreas Tasch <andy.tasch@gmail.com>
2022-11-25 10:42:55 +09:00

494 lines
20 KiB
JSON

{
"paths": {
"/api/v1/stores/{storeId}/payment-requests": {
"get": {
"tags": [
"Payment Requests"
],
"summary": "Get payment requests",
"parameters": [
{
"name": "storeId",
"in": "path",
"required": true,
"description": "The store to query",
"schema": { "type": "string" }
}
],
"description": "View information about the existing payment requests",
"operationId": "PaymentRequests_GetPaymentRequests",
"responses": {
"200": {
"description": "List of payment requests",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentRequestDataList"
}
}
}
},
"401": {
"description": "Missing authorization",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
},
"security": [
{
"API_Key": [
"btcpay.store.canviewpaymentrequests"
],
"Basic": []
}
]
},
"post": {
"tags": [
"Payment Requests"
],
"summary": "Create a new payment request",
"parameters": [
{
"name": "storeId",
"in": "path",
"required": true,
"description": "The store to query",
"schema": { "type": "string" }
}
],
"description": "Create a new payment request",
"operationId": "PaymentRequests_CreatePaymentRequest",
"responses": {
"200": {
"description": "Information about the new payment request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentRequestData"
}
}
}
},
"400": {
"description": "A list of errors that occurred when creating the payment request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationProblemDetails"
}
}
}
},
"403": {
"description": "If you are authenticated but forbidden to add new payment requests"
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentRequestBaseData"
}
}
}
},
"security": [
{
"API_Key": [
"btcpay.store.canmodifypaymentrequests"
],
"Basic": []
}
]
}
},
"/api/v1/stores/{storeId}/payment-requests/{paymentRequestId}": {
"get": {
"tags": [
"Payment Requests"
],
"summary": "Get payment request",
"parameters": [
{
"name": "storeId",
"in": "path",
"required": true,
"description": "The store to fetch",
"schema": { "type": "string" }
},
{
"name": "paymentRequestId",
"in": "path",
"required": true,
"description": "The payment request to fetch",
"schema": { "type": "string" }
}
],
"description": "View information about the specified payment request",
"operationId": "PaymentRequests_GetPaymentRequest",
"responses": {
"200": {
"description": "specified payment request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentRequestData"
}
}
}
},
"403": {
"description": "If you are authenticated but forbidden to view the specified payment request"
},
"404": {
"description": "The key is not found for this payment request"
}
},
"security": [
{
"API_Key": [
"btcpay.store.canviewpaymentrequests"
],
"Basic": []
}
]
},
"delete": {
"tags": [
"Payment Requests"
],
"summary": "Archive payment request",
"description": "Archives the specified payment request.",
"operationId": "PaymentRequests_ArchivePaymentRequest",
"parameters": [
{
"name": "storeId",
"in": "path",
"required": true,
"description": "The store the payment request belongs to",
"schema": { "type": "string" }
},
{
"name": "paymentRequestId",
"in": "path",
"required": true,
"description": "The payment request to remove",
"schema": { "type": "string" }
}
],
"responses": {
"200": {
"description": "The payment request has been archived"
},
"400": {
"description": "A list of errors that occurred when archiving the payment request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationProblemDetails"
}
}
}
},
"403": {
"description": "If you are authenticated but forbidden to archive the specified payment request"
},
"404": {
"description": "The key is not found for this payment request"
}
},
"security": [
{
"API_Key": [ "btcpay.store.canmodifypaymentrequests" ],
"Basic": []
}
]
},
"put": {
"tags": [
"Payment Requests"
],
"summary": "Update payment request",
"parameters": [
{
"name": "storeId",
"in": "path",
"required": true,
"description": "The store to query",
"schema": { "type": "string" }
},
{
"name": "paymentRequestId",
"in": "path",
"required": true,
"description": "The payment request to update",
"schema": { "type": "string" }
}
],
"description": "Update a payment request",
"operationId": "PaymentRequests_UpdatePaymentRequest",
"responses": {
"200": {
"description": "The updated payment request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentRequestData"
}
}
}
},
"400": {
"description": "A list of errors that occurred when updating the payment request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationProblemDetails"
}
}
}
},
"403": {
"description": "If you are authenticated but forbidden to update the payment request"
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentRequestBaseData"
}
}
}
},
"security": [
{
"API_Key": [
"btcpay.store.canmodifypaymentrequests"
],
"Basic": []
}
]
}
},
"/api/v1/stores/{storeId}/payment-requests/{paymentRequestId}/pay": {
"post": {
"tags": [
"Payment Requests"
],
"summary": "Create a new invoice for the payment request",
"parameters": [
{
"name": "storeId",
"in": "path",
"required": true,
"description": "The store to fetch",
"schema": { "type": "string" }
},
{
"name": "paymentRequestId",
"in": "path",
"required": true,
"description": "The payment request to create",
"schema": { "type": "string" }
}
],
"description": "Create a new invoice for the payment request, or reuse an existing one",
"requestBody": {
"description": "Invoice creation request",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"amount": {
"type": "string",
"format": "decimal",
"minimum": 0,
"exclusiveMinimum": true,
"description": "The amount of the invoice. If `null` or `unspecified`, it will be set to the payment request's due amount. Note that the payment's request `allowCustomPaymentAmounts` must be `true`, or a 422 error will be sent back.'",
"nullable": true,
"example": "0.1"
},
"allowPendingInvoiceReuse": {
"type": "boolean",
"nullable": true,
"default": false,
"description": "If `true`, this endpoint will not necessarily create a new invoice, and instead attempt to give back a pending one for this payment request."
}
}
}
}
}
},
"responses": {
"200": {
"description": "A new invoice",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvoiceData"
}
}
}
},
"422": {
"description": "Unable to validate the request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationProblemDetails"
}
}
}
},
"400": {
"description": "Wellknown error codes are: `archived`, `already-paid`, `expired`",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
},
"security": [
{
"API_Key": [
"btcpay.store.canviewpaymentrequests"
],
"Basic": []
}
]
}
}
},
"components": {
"schemas": {
"PaymentRequestDataList": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PaymentRequestData"
}
},
"PaymentRequestData": {
"allOf": [
{
"$ref": "#/components/schemas/PaymentRequestBaseData"
},
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The id of the payment request",
"nullable": false
},
"storeId": {
"type": "string",
"description": "The store identifier that the payment request belongs to"
},
"status": {
"type": "string",
"enum": [ "Pending", "Completed", "Expired" ],
"description": "The status of the payment request",
"nullable": false
},
"createdTime": {
"description": "The creation date of the payment request",
"allOf": [ { "$ref": "#/components/schemas/UnixTimestamp" } ],
"nullable": false
}
}
}
]
},
"PaymentRequestBaseData": {
"type": "object",
"additionalProperties": false,
"properties": {
"amount": {
"type": "string",
"format": "decimal",
"minimum": 0,
"exclusiveMinimum": true,
"description": "The amount of the payment request",
"nullable": false
},
"title": {
"type": "string",
"description": "The title of the payment request",
"nullable": false
},
"currency": {
"type": "string",
"format": "ISO 4217 Currency code(BTC, EUR, USD, etc)",
"description": "The currency of the payment request. If empty, the store's default currency code will be used.",
"nullable": true
},
"email": {
"type": "string",
"description": "The email used in invoices generated by the payment request",
"nullable": true,
"format": "email"
},
"description": {
"type": "string",
"description": "The description of the payment request",
"nullable": true,
"format": "html"
},
"expiryDate": {
"description": "The expiry date of the payment request",
"nullable": true,
"allOf": [ { "$ref": "#/components/schemas/UnixTimestamp" } ]
},
"embeddedCSS": {
"type": "string",
"description": "Custom CSS styling for the payment request",
"nullable": true,
"format": "css",
"maximum": 500
},
"customCSSLink": {
"type": "string",
"description": "Custom CSS link for styling the payment request",
"nullable": true,
"format": "uri"
},
"allowCustomPaymentAmounts": {
"type": "boolean",
"description": "Whether to allow users to create invoices that partially pay the payment request ",
"nullable": true
},
"formId": {
"type": "string",
"description": "Form ID to request customer data",
"nullable": true
},
"formResponse": {
"type": "object",
"description": "Form data response",
"nullable": true
}
}
}
}
},
"tags": [
{
"name": "Payment Requests",
"description": "Payment Requests operations"
}
]
}