aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/payments.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/payments.js b/lib/payments.js
index 19cb5ce4..cb9658af 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -39,7 +39,9 @@ export let debit = async (
let rate = store.rates[currency];
let iid = await g(`invoice:${hash}`);
- let invoice = typeof iid === "String" ? await g(`invoice:${iid}`) : iid;
+ if (iid && iid.hash) iid = iid.hash;
+ let invoice = await g(`invoice:${iid}`);
+
if (invoice) {
ref = invoice.uid;
@@ -116,7 +118,9 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
amount = parseInt(amount) || 0;
let iid = await g(`invoice:${hash}`);
- let invoice = typeof iid === "String" ? await g(`invoice:${iid}`) : iid;
+ if (iid && iid.hash) iid = iid.hash;
+ let invoice = await g(`invoice:${iid}`);
+
if (!invoice) return warn("failed to credit", hash, ", invoice not found");
let { tip } = invoice;