From 09f717b1a3f6a5ed3e4fe1d4930b7571672205b3 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Mon, 22 Feb 2021 14:33:55 -0400 Subject: [PATCH] several order types --- services/gunDB/contact-api/jobs/onOrders.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/gunDB/contact-api/jobs/onOrders.js b/services/gunDB/contact-api/jobs/onOrders.js index 8496cdfe..8d7a717e 100644 --- a/services/gunDB/contact-api/jobs/onOrders.js +++ b/services/gunDB/contact-api/jobs/onOrders.js @@ -11,6 +11,7 @@ const { Constants: { ErrorCode }, Schema } = Common +const { assertNever } = require('assert-never') const LightningServices = require('../../../../utils/lightningServices') const { @@ -222,12 +223,23 @@ const listenerForAddr = (addr, SEA) => async (order, orderID) => { const onData = invoice => { if (invoice.settled) { writeCoordinate(invoice.r_hash.toString(), coord) + if (order.targetType === 'tip') { getUser() .get('postToTipCount') // CAST: Checked above. .get(/** @type {string} */ (order.ackInfo)) .set(null) // each item in the set is a tip + } else if (order.targetType === 'contentReveal') { + // TODO + } else if (order.targetType === 'spontaneousPayment') { + // no action required + } else if (order.targetType === 'torrentSeed') { + // TODO + } else if (order.targetType === 'other') { + // TODO + } else { + assertNever(order.targetType) } stream.off()