mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 10:40:29 +01:00
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using NBitcoin.Payment;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BTCPayServer.Controllers
|
|
{
|
|
public class PaymentRequestActionResult : IActionResult
|
|
{
|
|
PaymentRequest req;
|
|
public PaymentRequestActionResult(PaymentRequest req)
|
|
{
|
|
this.req = req;
|
|
}
|
|
public Task ExecuteResultAsync(ActionContext context)
|
|
{
|
|
context.HttpContext.Response.Headers["Content-Transfer-Encoding"] = "binary";
|
|
context.HttpContext.Response.ContentType = "application/bitcoin-paymentrequest";
|
|
req.WriteTo(context.HttpContext.Response.Body);
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
public class PaymentAckActionResult : IActionResult
|
|
{
|
|
PaymentACK req;
|
|
public PaymentAckActionResult(PaymentACK req)
|
|
{
|
|
this.req = req;
|
|
}
|
|
public Task ExecuteResultAsync(ActionContext context)
|
|
{
|
|
context.HttpContext.Response.Headers["Content-Transfer-Encoding"] = "binary";
|
|
context.HttpContext.Response.ContentType = "application/bitcoin-paymentack";
|
|
req.WriteTo(context.HttpContext.Response.Body);
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|