Expose buyer object to conform to bitpay API

This commit is contained in:
nicolas.dorier 2018-11-05 17:02:12 +09:00
parent dd7c4850f0
commit 9fc7f287d2
3 changed files with 13 additions and 2 deletions

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Version>1.0.3.6</Version>
<Version>1.0.3.7</Version>
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
</PropertyGroup>
<PropertyGroup>

View file

@ -247,6 +247,8 @@ namespace BTCPayServer.Models
public Dictionary<string, string> Addresses { get; set; }
[JsonProperty("paymentCodes")]
public Dictionary<string, NBitpayClient.InvoicePaymentUrls> PaymentCodes { get; set; }
[JsonProperty("buyer")]
public JObject Buyer { get; set; }
}
public class Flags
{

View file

@ -423,7 +423,16 @@ namespace BTCPayServer.Services.Invoices
#pragma warning restore CS0618
dto.CryptoInfo.Add(cryptoInfo);
dto.Buyer = new JObject();
dto.Buyer.Add(new JProperty("name", BuyerInformation.BuyerName));
dto.Buyer.Add(new JProperty("address1", BuyerInformation.BuyerAddress1));
dto.Buyer.Add(new JProperty("address2", BuyerInformation.BuyerAddress2));
dto.Buyer.Add(new JProperty("locality", BuyerInformation.BuyerCity));
dto.Buyer.Add(new JProperty("region", BuyerInformation.BuyerState));
dto.Buyer.Add(new JProperty("postalCode", BuyerInformation.BuyerZip));
dto.Buyer.Add(new JProperty("country", BuyerInformation.BuyerCountry));
dto.Buyer.Add(new JProperty("phone", BuyerInformation.BuyerPhone));
dto.Buyer.Add(new JProperty("email", BuyerInformation.BuyerEmail ?? RefundMail));
dto.PaymentCodes.Add(paymentId.ToString(), cryptoInfo.PaymentUrls);
dto.PaymentSubtotals.Add(paymentId.ToString(), subtotalPrice.Satoshi);
dto.PaymentTotals.Add(paymentId.ToString(), accounting.TotalDue.Satoshi);