diff --git a/BTCPayServer.Client/Models/InvoiceData.cs b/BTCPayServer.Client/Models/InvoiceData.cs index cb30793f6..21209af29 100644 --- a/BTCPayServer.Client/Models/InvoiceData.cs +++ b/BTCPayServer.Client/Models/InvoiceData.cs @@ -13,60 +13,5 @@ namespace BTCPayServer.Client.Models public InvoiceStatus Status { get; set; } [JsonConverter(typeof(StringEnumConverter))] public InvoiceExceptionStatus AdditionalStatus { get; set; } - public Dictionary PaymentMethodData { get; set; } - - public class PaymentMethodDataModel - { - public string Destination { get; set; } - public string PaymentLink { get; set; } - - [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] - public decimal Rate { get; set; } - - [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] - public decimal PaymentMethodPaid { get; set; } - - [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] - public decimal TotalPaid { get; set; } - - [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] - public decimal Due { get; set; } - - [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] - public decimal Amount { get; set; } - - [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] - public decimal NetworkFee { get; set; } - - public List Payments { get; set; } - - public class Payment - { - public string Id { get; set; } - - [JsonConverter(typeof(NBitcoin.JsonConverters.DateTimeToUnixTimeConverter))] - public DateTime ReceivedDate { get; set; } - - [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] - public decimal Value { get; set; } - - [JsonProperty(ItemConverterType = typeof(NumericStringJsonConverter))] - public decimal Fee { get; set; } - - [JsonConverter(typeof(StringEnumConverter))] - public PaymentStatus Status { get; set; } - - public string Destination { get; set; } - - public enum PaymentStatus - { - Invalid, - AwaitingConfirmation, - AwaitingCompletion, - Complete - } - } - } - } } diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 134ac4af5..c18c150e9 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -246,5 +246,5 @@ <_ContentIncludedByDefault Remove="Views\Components\NotificationsDropdown\Default.cshtml" /> - + diff --git a/BTCPayServer/Controllers/GreenField/InvoiceController.cs b/BTCPayServer/Controllers/GreenField/InvoiceController.cs index 9fb31470b..a1774bb10 100644 --- a/BTCPayServer/Controllers/GreenField/InvoiceController.cs +++ b/BTCPayServer/Controllers/GreenField/InvoiceController.cs @@ -269,50 +269,7 @@ namespace BTCPayServer.Controllers.GreenField PaymentMethods = entity.GetPaymentMethods().Select(method => method.GetId().ToString()).ToArray(), SpeedPolicy = entity.SpeedPolicy - }, - PaymentMethodData = entity.GetPaymentMethods().ToDictionary(method => method.GetId().ToString(), - method => - { - var accounting = method.Calculate(); - var details = method.GetPaymentMethodDetails(); - var payments = method.ParentEntity.GetPayments().Where(paymentEntity => - paymentEntity.GetPaymentMethodId() == method.GetId()); - - return new InvoiceData.PaymentMethodDataModel() - { - Destination = details.GetPaymentDestination(), - Rate = method.Rate, - Due = accounting.Due.ToDecimal(MoneyUnit.BTC), - TotalPaid = accounting.Paid.ToDecimal(MoneyUnit.BTC), - PaymentMethodPaid = accounting.CryptoPaid.ToDecimal(MoneyUnit.BTC), - Amount = accounting.Due.ToDecimal(MoneyUnit.BTC), - NetworkFee = accounting.NetworkFee.ToDecimal(MoneyUnit.BTC), - PaymentLink = - method.GetId().PaymentType.GetPaymentLink(method.Network, details, accounting.Due, - Request.GetAbsoluteRoot()), - Payments = payments.Select(paymentEntity => - { - var data = paymentEntity.GetCryptoPaymentData(); - return new InvoiceData.PaymentMethodDataModel.Payment() - { - Destination = data.GetDestination(), - Id = data.GetPaymentId(), - Status = !paymentEntity.Accounted - ? InvoiceData.PaymentMethodDataModel.Payment.PaymentStatus.Invalid - : data.PaymentCompleted(paymentEntity) - ? InvoiceData.PaymentMethodDataModel.Payment.PaymentStatus.Complete - : data.PaymentConfirmed(paymentEntity, entity.SpeedPolicy) - ? InvoiceData.PaymentMethodDataModel.Payment.PaymentStatus - .AwaitingCompletion - : InvoiceData.PaymentMethodDataModel.Payment.PaymentStatus - .AwaitingConfirmation, - Fee = paymentEntity.NetworkFee, - Value = data.GetValue(), - ReceivedDate = paymentEntity.ReceivedTime.DateTime - }; - }).ToList() - }; - }) + } }; } } diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.invoices.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.invoices.json index 5cc3d1688..1a376b35c 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.invoices.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.invoices.json @@ -533,124 +533,11 @@ "additionalStatus": { "$ref": "#/components/schemas/InvoiceAdditionalStatus", "description": "a secondary status of the invoice" - }, - "paymentMethodData": { - "type": "object", - "nullable": false, - "additionalProperties": { - "$ref": "#/components/schemas/PaymentMethodDataModel" - }, - "description": "Activated payment methods details" } } } ] }, - "PaymentMethodDataModel": { - "type": "object", - "additionalProperties": false, - "properties": { - "destination": { - "type": "string", - "nullable": true, - "description": "The destination the payment must be made to" - }, - "paymentLink": { - "type": "string", - "nullable": true, - "description": "A payment link that helps pay to the payment destination" - }, - "rate": { - "type": "string", - "format": "decimal", - "description": "The rate between this payment method's currency and the invoice currency" - }, - "paymentMethodPaid": { - "type": "string", - "format": "decimal", - "description": "The amount paid by this payment method" - }, - "totalPaid": { - "type": "string", - "format": "decimal", - "description": "The total amount paid by all payment methods to the invoice, converted to this payment method's currency" - }, - "due": { - "type": "string", - "format": "decimal", - "description": "The total amount left to be paid, converted to this payment method's currency" - }, - "amount": { - "type": "string", - "format": "decimal", - "description": "The invoice amount, converted to this payment method's currency" - }, - "networkFee": { - "type": "string", - "format": "decimal", - "description": "The added merchant fee to pay for network costs of this payment method." - }, - "payments": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/Payment" - }, - "description": "Payments made with this payment method." - } - } - }, - "Payment": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "nullable": true, - "description": "A unique identifier for this payment" - }, - "receivedDate": { - "type": "string", - "format": "date-time", - "description": "The date the payment was recorded" - }, - "value": { - "type": "string", - "format": "decimal", - "description": "The value of the payment" - }, - "fee": { - "type": "string", - "format": "decimal", - "description": "The fee paid for the payment" - }, - "status": { - "$ref": "#/components/schemas/PaymentStatus", - "description": "The status of the payment" - }, - "destination": { - "type": "string", - "nullable": true, - "description": "The destination the payment was made to" - } - } - }, - "PaymentStatus": { - "type": "string", - "description": "", - "x-enumNames": [ - "Invalid", - "AwaitingConfirmation", - "AwaitingCompletion", - "Complete" - ], - "enum": [ - "Invalid", - "AwaitingConfirmation", - "AwaitingCompletion", - "Complete" - ] - }, "CreateInvoiceRequest": { "type": "object", "additionalProperties": false, @@ -699,8 +586,8 @@ "nullable": true, "items": { "type": "string" - }, - "description": "A specific set of payment methods to use for this invoice" + }, + "description": "A specific set of payment methods to use for this invoice (ie. BTC, BTC_OnChain). By default, select all payment methods activated in the store." }, "expirationMinutes": { "type": "integer",