mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 14:04:12 +01:00
Greenfield get app details (#4102)
* Add Greenfield API endpoints for retrieving app details * add app items details * Add GetPosApp and GetCrowdfundApp to LocalBTCPayServerClient * Simplify POS app data items example * Document app type enum * make "RequiresRefundEmail" nullable * remove "Template" and "PerksTemplate" fields
This commit is contained in:
parent
9ba03848f2
commit
b055844973
6 changed files with 608 additions and 11 deletions
|
@ -70,6 +70,26 @@ namespace BTCPayServer.Client
|
|||
return await HandleResponse<AppDataBase[]>(response);
|
||||
}
|
||||
|
||||
public virtual async Task<PointOfSaleAppData> GetPosApp(string appId, CancellationToken token = default)
|
||||
{
|
||||
if (appId == null)
|
||||
throw new ArgumentNullException(nameof(appId));
|
||||
var response = await _httpClient.SendAsync(
|
||||
CreateHttpRequest($"api/v1/apps/pos/{appId}",
|
||||
method: HttpMethod.Get), token);
|
||||
return await HandleResponse<PointOfSaleAppData>(response);
|
||||
}
|
||||
|
||||
public virtual async Task<CrowdfundAppData> GetCrowdfundApp(string appId, CancellationToken token = default)
|
||||
{
|
||||
if (appId == null)
|
||||
throw new ArgumentNullException(nameof(appId));
|
||||
var response = await _httpClient.SendAsync(
|
||||
CreateHttpRequest($"api/v1/apps/crowdfund/{appId}",
|
||||
method: HttpMethod.Get), token);
|
||||
return await HandleResponse<CrowdfundAppData>(response);
|
||||
}
|
||||
|
||||
public virtual async Task DeleteApp(string appId, CancellationToken token = default)
|
||||
{
|
||||
if (appId == null)
|
||||
|
|
|
@ -15,11 +15,53 @@ namespace BTCPayServer.Client.Models
|
|||
|
||||
public class PointOfSaleAppData : AppDataBase
|
||||
{
|
||||
// We can add POS specific things here later
|
||||
public string Title { get; set; }
|
||||
public string DefaultView { get; set; }
|
||||
public bool ShowCustomAmount { get; set; }
|
||||
public bool ShowDiscount { get; set; }
|
||||
public bool EnableTips { get; set; }
|
||||
public string Currency { get; set; }
|
||||
public object Items { get; set; }
|
||||
public string FixedAmountPayButtonText { get; set; }
|
||||
public string CustomAmountPayButtonText { get; set; }
|
||||
public string TipText { get; set; }
|
||||
public string CustomCSSLink { get; set; }
|
||||
public string NotificationUrl { get; set; }
|
||||
public string RedirectUrl { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string EmbeddedCSS { get; set; }
|
||||
public bool? RedirectAutomatically { get; set; }
|
||||
public bool? RequiresRefundEmail { get; set; }
|
||||
}
|
||||
|
||||
public class CrowdfundAppData : AppDataBase
|
||||
{
|
||||
// We can add Crowdfund specific things here later
|
||||
public string Title { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public bool EnforceTargetAmount { get; set; }
|
||||
[JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))]
|
||||
public DateTimeOffset? StartDate { get; set; }
|
||||
public string TargetCurrency { get; set; }
|
||||
public string Description { get; set; }
|
||||
[JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))]
|
||||
public DateTimeOffset? EndDate { get; set; }
|
||||
public decimal? TargetAmount { get; set; }
|
||||
public string CustomCSSLink { get; set; }
|
||||
public string MainImageUrl { get; set; }
|
||||
public string EmbeddedCSS { get; set; }
|
||||
public string NotificationUrl { get; set; }
|
||||
public string Tagline { get; set; }
|
||||
public object Perks { get; set; }
|
||||
public bool DisqusEnabled { get; set; }
|
||||
public string DisqusShortname { get; set; }
|
||||
public bool SoundsEnabled { get; set; }
|
||||
public bool AnimationsEnabled { get; set; }
|
||||
public int ResetEveryAmount { get; set; }
|
||||
public string ResetEvery { get; set; }
|
||||
public bool DisplayPerksValue { get; set; }
|
||||
public bool DisplayPerksRanking { get; set; }
|
||||
public bool SortPerksByPopularity { get; set; }
|
||||
public string[] Sounds { get; set; }
|
||||
public string[] AnimationColors { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -251,18 +251,23 @@ namespace BTCPayServer.Tests
|
|||
new CreatePointOfSaleAppRequest()
|
||||
{
|
||||
AppName = "test app from API",
|
||||
Currency = "JPY"
|
||||
Currency = "JPY",
|
||||
Title = "test app title"
|
||||
}
|
||||
);
|
||||
Assert.Equal("test app from API", app.Name);
|
||||
Assert.Equal(user.StoreId, app.StoreId);
|
||||
Assert.Equal("PointOfSale", app.AppType);
|
||||
Assert.Equal("test app title", app.Title);
|
||||
|
||||
// Make sure we return a 404 if we try to get an app that doesn't exist
|
||||
await AssertHttpError(404, async () =>
|
||||
{
|
||||
await client.GetApp("some random ID lol");
|
||||
});
|
||||
await AssertHttpError(404, async () => {
|
||||
await client.GetPosApp("some random ID lol");
|
||||
});
|
||||
|
||||
// Test that we can retrieve the app data
|
||||
var retrievedApp = await client.GetApp(app.Id);
|
||||
|
@ -271,10 +276,23 @@ namespace BTCPayServer.Tests
|
|||
Assert.Equal(app.AppType, retrievedApp.AppType);
|
||||
|
||||
// Test that we can update the app data
|
||||
await client.UpdatePointOfSaleApp(app.Id, new CreatePointOfSaleAppRequest() { AppName = "new app name" });
|
||||
await client.UpdatePointOfSaleApp(
|
||||
app.Id,
|
||||
new CreatePointOfSaleAppRequest()
|
||||
{
|
||||
AppName = "new app name",
|
||||
Title = "new app title"
|
||||
}
|
||||
);
|
||||
// Test generic GET app endpoint first
|
||||
retrievedApp = await client.GetApp(app.Id);
|
||||
Assert.Equal("new app name", retrievedApp.Name);
|
||||
|
||||
// Test the POS-specific endpoint also
|
||||
var retrievedPosApp = await client.GetPosApp(app.Id);
|
||||
Assert.Equal("new app name", retrievedPosApp.Name);
|
||||
Assert.Equal("new app title", retrievedPosApp.Title);
|
||||
|
||||
// Make sure we return a 404 if we try to delete an app that doesn't exist
|
||||
await AssertHttpError(404, async () =>
|
||||
{
|
||||
|
@ -291,7 +309,7 @@ namespace BTCPayServer.Tests
|
|||
|
||||
[Fact(Timeout = TestTimeout)]
|
||||
[Trait("Integration", "Integration")]
|
||||
public async Task CanCreateCrowdfundApp()
|
||||
public async Task CanCreateReadAndDeleteCrowdfundApp()
|
||||
{
|
||||
using var tester = CreateServerTester();
|
||||
await tester.StartAsync();
|
||||
|
@ -394,10 +412,48 @@ namespace BTCPayServer.Tests
|
|||
);
|
||||
|
||||
// Test creating a crowdfund app
|
||||
var app = await client.CreateCrowdfundApp(user.StoreId, new CreateCrowdfundAppRequest() { AppName = "test app from API" });
|
||||
var app = await client.CreateCrowdfundApp(
|
||||
user.StoreId,
|
||||
new CreateCrowdfundAppRequest()
|
||||
{
|
||||
AppName = "test app from API",
|
||||
Title = "test app title"
|
||||
}
|
||||
);
|
||||
Assert.Equal("test app from API", app.Name);
|
||||
Assert.Equal(user.StoreId, app.StoreId);
|
||||
Assert.Equal("Crowdfund", app.AppType);
|
||||
|
||||
// Make sure we return a 404 if we try to get an app that doesn't exist
|
||||
await AssertHttpError(404, async () => {
|
||||
await client.GetApp("some random ID lol");
|
||||
});
|
||||
await AssertHttpError(404, async () => {
|
||||
await client.GetCrowdfundApp("some random ID lol");
|
||||
});
|
||||
|
||||
// Test that we can retrieve the app data
|
||||
var retrievedApp = await client.GetApp(app.Id);
|
||||
Assert.Equal(app.Name, retrievedApp.Name);
|
||||
Assert.Equal(app.StoreId, retrievedApp.StoreId);
|
||||
Assert.Equal(app.AppType, retrievedApp.AppType);
|
||||
|
||||
// Test the crowdfund-specific endpoint also
|
||||
var retrievedPosApp = await client.GetCrowdfundApp(app.Id);
|
||||
Assert.Equal(app.Name, retrievedPosApp.Name);
|
||||
Assert.Equal(app.Title, retrievedPosApp.Title);
|
||||
|
||||
// Make sure we return a 404 if we try to delete an app that doesn't exist
|
||||
await AssertHttpError(404, async () =>
|
||||
{
|
||||
await client.DeleteApp("some random ID lol");
|
||||
});
|
||||
|
||||
// Test deleting the newly created app
|
||||
await client.DeleteApp(retrievedApp.Id);
|
||||
await AssertHttpError(404, async () => {
|
||||
await client.GetApp(retrievedApp.Id);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact(Timeout = TestTimeout)]
|
||||
|
|
|
@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BTCPayServer.Controllers.Greenfield
|
||||
{
|
||||
|
@ -176,6 +177,32 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||
return Ok(ToModel(app));
|
||||
}
|
||||
|
||||
[HttpGet("~/api/v1/apps/pos/{appId}")]
|
||||
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
||||
public async Task<IActionResult> GetPosApp(string appId)
|
||||
{
|
||||
var app = await _appService.GetApp(appId, AppType.PointOfSale);
|
||||
if (app == null)
|
||||
{
|
||||
return AppNotFound();
|
||||
}
|
||||
|
||||
return Ok(ToPointOfSaleModel(app));
|
||||
}
|
||||
|
||||
[HttpGet("~/api/v1/apps/crowdfund/{appId}")]
|
||||
[Authorize(Policy = Policies.CanModifyStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
|
||||
public async Task<IActionResult> GetCrowdfundApp(string appId)
|
||||
{
|
||||
var app = await _appService.GetApp(appId, AppType.Crowdfund);
|
||||
if (app == null)
|
||||
{
|
||||
return AppNotFound();
|
||||
}
|
||||
|
||||
return Ok(ToCrowdfundModel(app));
|
||||
}
|
||||
|
||||
[HttpDelete("~/api/v1/apps/{appId}")]
|
||||
public async Task<IActionResult> DeleteApp(string appId)
|
||||
{
|
||||
|
@ -284,6 +311,8 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||
|
||||
private PointOfSaleAppData ToPointOfSaleModel(AppData appData)
|
||||
{
|
||||
var settings = appData.GetSettings<PointOfSaleSettings>();
|
||||
|
||||
return new PointOfSaleAppData
|
||||
{
|
||||
Id = appData.Id,
|
||||
|
@ -291,6 +320,31 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||
Name = appData.Name,
|
||||
StoreId = appData.StoreDataId,
|
||||
Created = appData.Created,
|
||||
Title = settings.Title,
|
||||
DefaultView = settings.DefaultView.ToString(),
|
||||
ShowCustomAmount = settings.ShowCustomAmount,
|
||||
ShowDiscount = settings.ShowDiscount,
|
||||
EnableTips = settings.EnableTips,
|
||||
Currency = settings.Currency,
|
||||
Items = JsonConvert.DeserializeObject(
|
||||
JsonConvert.SerializeObject(
|
||||
_appService.Parse(settings.Template, settings.Currency),
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
|
||||
}
|
||||
)
|
||||
),
|
||||
FixedAmountPayButtonText = settings.ButtonText,
|
||||
CustomAmountPayButtonText = settings.CustomButtonText,
|
||||
TipText = settings.CustomTipText,
|
||||
CustomCSSLink = settings.CustomCSSLink,
|
||||
NotificationUrl = settings.NotificationUrl,
|
||||
RedirectUrl = settings.RedirectUrl,
|
||||
Description = settings.Description,
|
||||
EmbeddedCSS = settings.EmbeddedCSS,
|
||||
RedirectAutomatically = settings.RedirectAutomatically ?? false,
|
||||
RequiresRefundEmail = settings.RequiresRefundEmail == RequiresRefundEmail.InheritFromStore ? null : settings.RequiresRefundEmail == RequiresRefundEmail.On,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -324,13 +378,48 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||
|
||||
private CrowdfundAppData ToCrowdfundModel(AppData appData)
|
||||
{
|
||||
var settings = appData.GetSettings<CrowdfundSettings>();
|
||||
|
||||
return new CrowdfundAppData
|
||||
{
|
||||
Id = appData.Id,
|
||||
AppType = appData.AppType,
|
||||
Name = appData.Name,
|
||||
StoreId = appData.StoreDataId,
|
||||
Created = appData.Created
|
||||
Created = appData.Created,
|
||||
Title = settings.Title,
|
||||
Enabled = settings.Enabled,
|
||||
EnforceTargetAmount = settings.EnforceTargetAmount,
|
||||
StartDate = settings.StartDate,
|
||||
TargetCurrency = settings.TargetCurrency,
|
||||
Description = settings.Description,
|
||||
EndDate = settings.EndDate,
|
||||
TargetAmount = settings.TargetAmount,
|
||||
CustomCSSLink = settings.CustomCSSLink,
|
||||
MainImageUrl = settings.MainImageUrl,
|
||||
EmbeddedCSS = settings.EmbeddedCSS,
|
||||
NotificationUrl = settings.NotificationUrl,
|
||||
Tagline = settings.Tagline,
|
||||
Perks = JsonConvert.DeserializeObject(
|
||||
JsonConvert.SerializeObject(
|
||||
_appService.Parse(settings.PerksTemplate, settings.TargetCurrency),
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
|
||||
}
|
||||
)
|
||||
),
|
||||
DisqusEnabled = settings.DisqusEnabled,
|
||||
DisqusShortname = settings.DisqusShortname,
|
||||
SoundsEnabled = settings.SoundsEnabled,
|
||||
AnimationsEnabled = settings.AnimationsEnabled,
|
||||
ResetEveryAmount = settings.ResetEveryAmount,
|
||||
ResetEvery = settings.ResetEvery.ToString(),
|
||||
DisplayPerksValue = settings.DisplayPerksValue,
|
||||
DisplayPerksRanking = settings.DisplayPerksRanking,
|
||||
SortPerksByPopularity = settings.SortPerksByPopularity,
|
||||
Sounds = settings.Sounds,
|
||||
AnimationColors = settings.AnimationColors
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1292,5 +1292,17 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||
{
|
||||
HandleActionResult(await GetController<GreenfieldStoreLightningAddressesController>().RemoveStoreLightningAddress(storeId, username));
|
||||
}
|
||||
|
||||
public override async Task<PointOfSaleAppData> GetPosApp(string appId,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
return GetFromActionResult<PointOfSaleAppData>(await GetController<GreenfieldAppsController>().GetPosApp(appId));
|
||||
}
|
||||
|
||||
public override async Task<CrowdfundAppData> GetCrowdfundApp(string appId,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
return GetFromActionResult<CrowdfundAppData>(await GetController<GreenfieldAppsController>().GetCrowdfundApp(appId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,6 +124,84 @@
|
|||
"Basic": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"tags": [
|
||||
"Apps",
|
||||
"POS",
|
||||
"Point of Sale"
|
||||
],
|
||||
"operationId": "Apps_GetPointOfSaleApp",
|
||||
"summary": "Get Point of Sale app data",
|
||||
"description": "Returns POS app data",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "POS app data",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/PointOfSaleAppData"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "POS app with specified ID was not found"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"API_Key": [
|
||||
"btcpay.store.canmodifystoresettings"
|
||||
],
|
||||
"Basic": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/apps/crowdfund/{appId}": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "appId",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"description": "Crowdfund app ID",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"get": {
|
||||
"tags": [
|
||||
"Apps",
|
||||
"Crowdfund"
|
||||
],
|
||||
"operationId": "Apps_GetCrowdfundApp",
|
||||
"summary": "Get crowdfund app data",
|
||||
"description": "Returns crowdfund app data",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Crowdfund app data",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CrowdfundAppData"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Crowdfund app with specified ID was not found"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"API_Key": [
|
||||
"btcpay.store.canmodifystoresettings"
|
||||
],
|
||||
"Basic": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/stores/{storeId}/apps/crowdfund": {
|
||||
|
@ -194,7 +272,7 @@
|
|||
"tags": [
|
||||
"Apps"
|
||||
],
|
||||
"operationId": "Apps_GetPointOfSaleApp",
|
||||
"operationId": "Apps_GetApp",
|
||||
"summary": "Get basic app data",
|
||||
"description": "Returns basic app data shared between all types of apps",
|
||||
"parameters": [
|
||||
|
@ -236,7 +314,7 @@
|
|||
"tags": [
|
||||
"Apps"
|
||||
],
|
||||
"operationId": "Apps_DeletePointOfSaleApp",
|
||||
"operationId": "Apps_DeleteApp",
|
||||
"summary": "Delete app",
|
||||
"description": "Deletes apps with specified ID",
|
||||
"parameters": [
|
||||
|
@ -354,6 +432,135 @@
|
|||
"$ref": "#/components/schemas/BasicAppData"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "Display title of the app",
|
||||
"example": "My PoS app"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "App description",
|
||||
"example": "This is my amazing PoS app"
|
||||
},
|
||||
"defaultView": {
|
||||
"type": "string",
|
||||
"description": "App view type (e.g., static, cart, etc...)",
|
||||
"example": "Cart",
|
||||
"x-enumNames": [
|
||||
"Static",
|
||||
"Cart",
|
||||
"Light",
|
||||
"Print"
|
||||
],
|
||||
"enum": [
|
||||
"Static",
|
||||
"Cart",
|
||||
"Light",
|
||||
"Print"
|
||||
]
|
||||
},
|
||||
"showCustomAmount": {
|
||||
"type": "boolean",
|
||||
"description": "Whether the option to enter a custom amount is shown",
|
||||
"example": true
|
||||
},
|
||||
"showDiscount": {
|
||||
"type": "boolean",
|
||||
"description": "Whether the option to enter a discount is shown",
|
||||
"example": false
|
||||
},
|
||||
"enableTips": {
|
||||
"type": "boolean",
|
||||
"description": "Whether the option to enter a tip is shown",
|
||||
"example": true
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"description": "Currency used for the app",
|
||||
"example": "BTC"
|
||||
},
|
||||
"items": {
|
||||
"type": "object",
|
||||
"description": "JSON object of app items",
|
||||
"example": [
|
||||
{
|
||||
"description": "Lovely, fresh and tender, Meng Ding Gan Lu ('sweet dew') is grown in the lush Meng Ding Mountains of the southwestern province of Sichuan where it has been cultivated for over a thousand years.",
|
||||
"id": "green tea",
|
||||
"image": "~/img/pos-sample/green-tea.jpg",
|
||||
"price": {
|
||||
"type": 2,
|
||||
"formatted": "$1.00",
|
||||
"value": 1.0
|
||||
},
|
||||
"title": "Green Tea",
|
||||
"buyButtonText": null,
|
||||
"inventory": 5,
|
||||
"paymentMethods": null,
|
||||
"disabled": false
|
||||
},
|
||||
{
|
||||
"description": "Tian Jian Tian Jian means 'heavenly tippy tea' in Chinese, and it describes the finest grade of dark tea. Our Tian Jian dark tea is from Hunan province which is famous for making some of the best dark teas available.",
|
||||
"id": "black tea",
|
||||
"image": "~/img/pos-sample/black-tea.jpg",
|
||||
"price": {
|
||||
"type": 2,
|
||||
"formatted": "$1.00",
|
||||
"value": 1.0
|
||||
},
|
||||
"title": "Black Tea",
|
||||
"buyButtonText": "Test Buy Button Text",
|
||||
"inventory": null,
|
||||
"paymentMethods": null,
|
||||
"disabled": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"fixedAmountPayButtonText": {
|
||||
"type": "string",
|
||||
"description": "Payment button text template for items with a set price",
|
||||
"example": "Buy for {0}"
|
||||
},
|
||||
"customAmountPayButtonText": {
|
||||
"type": "string",
|
||||
"description": "Payment button text which appears for items which allow user to input a custom amount",
|
||||
"example": "Pay"
|
||||
},
|
||||
"tipText": {
|
||||
"type": "string",
|
||||
"description": "Prompt which appears next to the tip amount field if tipping is enabled",
|
||||
"example": "Do you want to leave a tip?"
|
||||
},
|
||||
"customCSSLink": {
|
||||
"type": "string",
|
||||
"description": "Link to a custom CSS stylesheet to be used in the app",
|
||||
"example": "https://bootswatch.com/4/slate/bootstrap.min.css"
|
||||
},
|
||||
"notificationUrl": {
|
||||
"type": "string",
|
||||
"description": "Callback notification url to POST to once when invoice is paid for and once when there are enough blockchain confirmations"
|
||||
},
|
||||
"redirectUrl": {
|
||||
"type": "string",
|
||||
"description": "URL user is redirected to once invoice is paid"
|
||||
},
|
||||
"embeddedCSS": {
|
||||
"type": "string",
|
||||
"description": "Custom CSS embedded into the app"
|
||||
},
|
||||
"redirectAutomatically": {
|
||||
"type": "boolean",
|
||||
"description": "Whether user is redirected to specified redirect URL automatically after the invoice is paid",
|
||||
"example": true
|
||||
},
|
||||
"requiresRefundEmail": {
|
||||
"type": "boolean",
|
||||
"description": "Whether refund email is required when paying the invoice. Defaults to `null` if not explicitly set.",
|
||||
"example": false,
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -363,6 +570,177 @@
|
|||
"$ref": "#/components/schemas/BasicAppData"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "Display title of the app",
|
||||
"example": "My crowdfund app"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "App description",
|
||||
"example": "My crowdfund description"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"description": "Whether the app is enabled to be viewed by everyone",
|
||||
"example": true
|
||||
},
|
||||
"enforceTargetAmount": {
|
||||
"type": "boolean",
|
||||
"description": "Whether contributions over the set target amount are allowed",
|
||||
"example": false
|
||||
},
|
||||
"startDate": {
|
||||
"type": "number",
|
||||
"description": "UNIX timestamp for crowdfund start time (https://www.unixtimestamp.com/)",
|
||||
"allOf": [ {"$ref": "#/components/schemas/UnixTimestamp"}],
|
||||
"example": 768658369
|
||||
},
|
||||
"endDate": {
|
||||
"type": "number",
|
||||
"description": "UNIX timestamp for crowdfund end time (https://www.unixtimestamp.com/)",
|
||||
"allOf": [ {"$ref": "#/components/schemas/UnixTimestamp"}],
|
||||
"example": 771336769
|
||||
},
|
||||
"targetCurrency": {
|
||||
"type": "string",
|
||||
"description": "Target currency for the crowdfund",
|
||||
"example": "BTC"
|
||||
},
|
||||
"targetAmount": {
|
||||
"type": "number",
|
||||
"description": "Target amount for the crowdfund",
|
||||
"example": 420.69
|
||||
},
|
||||
"customCSSLink": {
|
||||
"type": "string",
|
||||
"description": "Link to a custom CSS stylesheet to be used in the app"
|
||||
},
|
||||
"mainImageUrl": {
|
||||
"type": "string",
|
||||
"description": "URL for image used as a cover image for the app"
|
||||
},
|
||||
"embeddedCSS": {
|
||||
"type": "string",
|
||||
"description": "Custom CSS embedded into the app"
|
||||
},
|
||||
"perks": {
|
||||
"type": "object",
|
||||
"description": "JSON of perks available in the app",
|
||||
"example": [
|
||||
{
|
||||
"description": null,
|
||||
"id": "test perk",
|
||||
"image": null,
|
||||
"price": {
|
||||
"type": 2,
|
||||
"formatted": "$100.00",
|
||||
"value": 100.0
|
||||
},
|
||||
"title": "test perk",
|
||||
"buyButtonText": null,
|
||||
"inventory": null,
|
||||
"paymentMethods": null,
|
||||
"disabled": false
|
||||
},
|
||||
{
|
||||
"description": "this is an amazing perk",
|
||||
"id": "test test",
|
||||
"image": "https://mainnet.demo.btcpayserver.org/img/errorpages/404_nicolas.jpg",
|
||||
"price": {
|
||||
"type": 1,
|
||||
"formatted": "$69.42",
|
||||
"value": 69.42
|
||||
},
|
||||
"title": "test test",
|
||||
"buyButtonText": null,
|
||||
"inventory": 5,
|
||||
"paymentMethods": null,
|
||||
"disabled": false
|
||||
},
|
||||
{
|
||||
"description": null,
|
||||
"id": "f$t45hj764325",
|
||||
"image": null,
|
||||
"price": {
|
||||
"type": 0,
|
||||
"formatted": null,
|
||||
"value": null
|
||||
},
|
||||
"title": "amazing perk",
|
||||
"buyButtonText": "button text",
|
||||
"inventory": null,
|
||||
"paymentMethods": null,
|
||||
"disabled": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"notificationUrl": {
|
||||
"type": "string",
|
||||
"description": "Callback notification url to POST to once when invoice is paid for and once when there are enough blockchain confirmations"
|
||||
},
|
||||
"tagline": {
|
||||
"type": "string",
|
||||
"description": "Tagline for the app displayed to user",
|
||||
"example": "I can't believe it's not butter"
|
||||
},
|
||||
"disqusEnabled": {
|
||||
"type": "boolean",
|
||||
"description": "Whether Disqus is enabled for the app"
|
||||
},
|
||||
"disqusShortname": {
|
||||
"type": "string",
|
||||
"description": "Disqus shortname to used for the app"
|
||||
},
|
||||
"soundsEnabled": {
|
||||
"type": "boolean",
|
||||
"description": "Whether sounds on new contributions are enabled",
|
||||
"example": false
|
||||
},
|
||||
"animationsEnabled": {
|
||||
"type": "boolean",
|
||||
"description": "Whether background animations on new contributions are enabled",
|
||||
"example": true
|
||||
},
|
||||
"resetEveryAmount": {
|
||||
"type": "number",
|
||||
"description": "Contribution goal reset frequency amount",
|
||||
"example": 1
|
||||
},
|
||||
"resetEvery": {
|
||||
"type": "string",
|
||||
"description": "Contribution goal reset frequency",
|
||||
"example": "Day"
|
||||
},
|
||||
"displayPerksValue": {
|
||||
"type": "boolean",
|
||||
"description": "Whether perk values are displayed",
|
||||
"example": false
|
||||
},
|
||||
"sortPerksByPopularity": {
|
||||
"type": "boolean",
|
||||
"description": "Whether perks are sorted by popularity",
|
||||
"default": true
|
||||
},
|
||||
"sounds": {
|
||||
"type": "array",
|
||||
"description": "Array of custom sounds which can be used on new contributions",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"example": ["https://github.com/ClaudiuHKS/AdvancedQuakeSounds/raw/master/sound/AQS/doublekill.wav"]
|
||||
},
|
||||
"animationColors": {
|
||||
"type": "array",
|
||||
"description": "Array of custom HEX colors which can be used for background animations on new contributions",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"example": ["#FF0000", "#00FF00", "#0000FF"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -505,7 +883,7 @@
|
|||
},
|
||||
"requiresRefundEmail": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to redirect user to redirect URL automatically once invoice is paid. Defaults to what is set in the store settings",
|
||||
"description": "Whether refund email is required when paying the invoice. Defaults to what is set in the store settings",
|
||||
"nullable": true
|
||||
},
|
||||
"checkoutType": {
|
||||
|
@ -654,7 +1032,7 @@
|
|||
},
|
||||
"displayPerksValue": {
|
||||
"type": "boolean",
|
||||
"description": "Enables background animations on new contributions if set to true",
|
||||
"description": "Displays values of perks if set to true",
|
||||
"default": false,
|
||||
"nullable": true
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue