aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.css
blob: 12fad732fecdf1a18af43d598ddd376c6f64f0bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import config from "$config";
import got from "got";
import { l } from "$lib/logging";

export const callWebhook = async (invoice, payment) => {
  try {
    if (!invoice || !payment) return;

    let { address, received, text, webhook, secret } = invoice;

    if (webhook) {
      let { amount, confirmed, hash, memo } = payment;

      l("calling webhook", webhook, amount, hash, address, text);
      let res = await got.post(webhook, {
        json: {
          address,
          amount,
          confirmed,
          hash,
          memo,
          received,
          text,
          secret
        }
      });
      return res;
    }
  } catch (e) {
    console.log("problem calling webhook", e);
  }
};