mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-20 13:34:37 +01:00
Add redirectAutomatically to GreenField Invoice API (#2321)
This commit is contained in:
parent
949136b161
commit
e8df010449
5 changed files with 18 additions and 8 deletions
|
@ -33,6 +33,8 @@ namespace BTCPayServer.Client.Models
|
|||
public double? PaymentTolerance { get; set; }
|
||||
[JsonProperty("redirectURL")]
|
||||
public string RedirectURL { get; set; }
|
||||
|
||||
public bool? RedirectAutomatically { get; set; }
|
||||
public string DefaultLanguage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -948,8 +948,12 @@ namespace BTCPayServer.Tests
|
|||
});
|
||||
await user.RegisterDerivationSchemeAsync("BTC");
|
||||
var newInvoice = await client.CreateInvoice(user.StoreId,
|
||||
new CreateInvoiceRequest() { Currency = "USD", Amount = 1, Metadata = JObject.Parse("{\"itemCode\": \"testitem\"}") });
|
||||
|
||||
new CreateInvoiceRequest() { Currency = "USD", Amount = 1, Metadata = JObject.Parse("{\"itemCode\": \"testitem\"}"), Checkout = new CreateInvoiceRequest.CheckoutOptions()
|
||||
{
|
||||
RedirectAutomatically = true
|
||||
}});
|
||||
Assert.True(newInvoice.Checkout.RedirectAutomatically);
|
||||
|
||||
//list
|
||||
var invoices = await viewOnly.GetInvoices(user.StoreId);
|
||||
|
||||
|
|
|
@ -5,14 +5,12 @@ using BTCPayServer.Abstractions.Constants;
|
|||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Payments;
|
||||
using BTCPayServer.Security;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
||||
using NBitcoin;
|
||||
using CreateInvoiceRequest = BTCPayServer.Client.Models.CreateInvoiceRequest;
|
||||
using InvoiceData = BTCPayServer.Client.Models.InvoiceData;
|
||||
|
|
|
@ -173,6 +173,7 @@ namespace BTCPayServer.Controllers
|
|||
entity.Price = invoice.Amount;
|
||||
entity.SpeedPolicy = invoice.Checkout.SpeedPolicy ?? store.SpeedPolicy;
|
||||
entity.DefaultLanguage = invoice.Checkout.DefaultLanguage;
|
||||
entity.RedirectAutomatically = invoice.Checkout.RedirectAutomatically ?? storeBlob.RedirectAutomatically;
|
||||
IPaymentFilter excludeFilter = null;
|
||||
if (invoice.Checkout.PaymentMethods != null)
|
||||
{
|
||||
|
|
|
@ -737,12 +737,12 @@
|
|||
"expirationMinutes": {
|
||||
"type": "integer",
|
||||
"nullable": true,
|
||||
"description": "The number of minutes after which an invoice becomes expired. Default to the store's settings. (The default store settings is 15)"
|
||||
"description": "The number of minutes after which an invoice becomes expired. Defaults to the store's settings. (The default store settings is 15)"
|
||||
},
|
||||
"monitoringMinutes": {
|
||||
"type": "integer",
|
||||
"nullable": true,
|
||||
"description": "The number of minutes after an invoice expired after which we are still monitoring for incoming payments. Default to the store's settings. (The default store settings is 1440, 1 day)"
|
||||
"description": "The number of minutes after an invoice expired after which we are still monitoring for incoming payments. Defaults to the store's settings. (The default store settings is 1440, 1 day)"
|
||||
},
|
||||
"paymentTolerance": {
|
||||
"type": "number",
|
||||
|
@ -750,12 +750,17 @@
|
|||
"nullable": true,
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"description": "A percentage determining whether to count the invoice as paid when the invoice is paid within the specified margin of error. Default to the store's settings. (The default store settings is 100)"
|
||||
"description": "A percentage determining whether to count the invoice as paid when the invoice is paid within the specified margin of error. Defaults to the store's settings. (The default store settings is 100)"
|
||||
},
|
||||
"redirectURL": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"description": "When the customer paid the invoice, the URL where the customer will be redirected when clicking on the `return to store` button. You can use placeholders `{InvoiceId}` or `{OrderId}` in the URL, BTCPay Server will replace those with this invoice `id` or `metadata.orderId` respectively."
|
||||
"description": "When the customer has paid the invoice, the URL where the customer will be redirected when clicking on the `return to store` button. You can use placeholders `{InvoiceId}` or `{OrderId}` in the URL, BTCPay Server will replace those with this invoice `id` or `metadata.orderId` respectively."
|
||||
},
|
||||
"redirectAutomatically": {
|
||||
"type": "boolean",
|
||||
"nullable": true,
|
||||
"description": "When the customer has paid the invoice, and a `redirectURL` is set, the checkout is redirected to `redirectURL` automatically if `redirectAutomatically` is true. Defaults to the store's settings. (The default store settings is false)"
|
||||
},
|
||||
"defaultLanguage": {
|
||||
"type": "string",
|
||||
|
|
Loading…
Add table
Reference in a new issue