feat: invoice details to Payment (#309)

This commit is contained in:
yse
2024-06-18 17:32:51 +02:00
committed by GitHub
parent 78228d8961
commit 4e76e94d26
13 changed files with 72 additions and 21 deletions

View File

@@ -306,6 +306,7 @@ fun asPayment(payment: ReadableMap): Payment? {
val amountSat = payment.getDouble("amountSat").toULong()
val feesSat = payment.getDouble("feesSat").toULong()
val preimage = if (hasNonNullKey(payment, "preimage")) payment.getString("preimage") else null
val bolt11 = if (hasNonNullKey(payment, "bolt11")) payment.getString("bolt11") else null
val refundTxId = if (hasNonNullKey(payment, "refundTxId")) payment.getString("refundTxId") else null
val refundTxAmountSat = if (hasNonNullKey(payment, "refundTxAmountSat")) payment.getDouble("refundTxAmountSat").toULong() else null
val paymentType = payment.getString("paymentType")?.let { asPaymentType(it) }!!
@@ -317,6 +318,7 @@ fun asPayment(payment: ReadableMap): Payment? {
amountSat,
feesSat,
preimage,
bolt11,
refundTxId,
refundTxAmountSat,
paymentType,
@@ -332,6 +334,7 @@ fun readableMapOf(payment: Payment): ReadableMap =
"amountSat" to payment.amountSat,
"feesSat" to payment.feesSat,
"preimage" to payment.preimage,
"bolt11" to payment.bolt11,
"refundTxId" to payment.refundTxId,
"refundTxAmountSat" to payment.refundTxAmountSat,
"paymentType" to payment.paymentType.name.lowercase(),