Add payment data to crypto info in invoice api model

Depends on https://github.com/MetacoSA/NBitpayClient/pull/22
This commit is contained in:
Kukks 2019-04-08 15:28:17 +02:00
parent f093f85dbf
commit 37869fd049

View File

@ -356,7 +356,6 @@ namespace BTCPayServer.Services.Invoices
return DateTimeOffset.UtcNow > ExpirationTime;
}
public InvoiceResponse EntityToDTO(BTCPayNetworkProvider networkProvider)
{
ServerUrl = ServerUrl ?? "";
@ -417,6 +416,22 @@ namespace BTCPayServer.Services.Invoices
var scheme = info.Network.UriScheme;
cryptoInfo.Url = ServerUrl.WithTrailingSlash() + $"i/{paymentId}/{Id}";
cryptoInfo.Payments = GetPayments(info.Network).Select(entity =>
{
var data = entity.GetCryptoPaymentData();
return new InvoicePaymentInfo()
{
Id = data.GetPaymentId(),
Fee = entity.NetworkFee,
Value = data.GetValue(),
Completed = data.PaymentCompleted(entity, info.Network),
Confirmed = data.PaymentConfirmed(entity, SpeedPolicy, info.Network),
Destination = data.GetDestination(info.Network),
PaymentType = data.GetPaymentType().ToString(),
ReceivedDate = entity.ReceivedTime.DateTime
};
});
if (paymentId.PaymentType == PaymentTypes.BTCLike)
{
var minerInfo = new MinerFeeInfo();