Lightning Network support implementation

This commit is contained in:
nicolas.dorier
2018-02-26 00:48:12 +09:00
parent 3d33ecf397
commit c8923af573
40 changed files with 2580 additions and 408 deletions

View File

@@ -17,13 +17,27 @@ namespace BTCPayServer.Payments
return BTCPayServer.DerivationStrategy.Parse(((JValue)value).Value<string>(), network);
}
//////////
else // if(paymentMethodId.PaymentType == PaymentTypes.Lightning)
else if (paymentMethodId.PaymentType == PaymentTypes.LightningLike)
{
// return JsonConvert.Deserialize<T>();
return JsonConvert.DeserializeObject<Payments.Lightning.LightningSupportedPaymentMethod>(value.ToString());
}
throw new NotSupportedException();
}
public static IPaymentMethodDetails DeserializePaymentMethodDetails(PaymentMethodId paymentMethodId, JObject jobj)
{
if(paymentMethodId.PaymentType == PaymentTypes.BTCLike)
{
return JsonConvert.DeserializeObject<Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod>(jobj.ToString());
}
if (paymentMethodId.PaymentType == PaymentTypes.LightningLike)
{
return JsonConvert.DeserializeObject<Payments.Lightning.LightningLikePaymentMethodDetails>(jobj.ToString());
}
throw new NotSupportedException(paymentMethodId.PaymentType.ToString());
}
public static JToken Serialize(ISupportedPaymentMethod factory)
{
// Legacy
@@ -39,5 +53,6 @@ namespace BTCPayServer.Payments
}
throw new NotSupportedException();
}
}
}