Add notice for BTCpay invoices and requests.

refs #135
This commit is contained in:
softsimon 2020-10-13 18:26:10 +07:00
parent 3fd5277912
commit 94e06a3a6b
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -20,6 +20,8 @@ class Donations {
}
createRequest(amount: number, orderId: string): Promise<any> {
logger.notice('New invoice request. Handle: ' + orderId + ' Amount: ' + amount + ' BTC');
const postData = {
'price': amount,
'orderId': orderId,
@ -46,12 +48,11 @@ class Donations {
}
async $handleWebhookRequest(data: any) {
logger.notice('Received BTCPayServer webhook data: ' + JSON.stringify(data));
if (!data || !data.id) {
return;
}
const response = await this.getStatus(data.id);
logger.notice(`Received BTCPayServer webhook. Invoice ID: ${data.id} Status: ${response.status} BTC Paid: ${response.btcPaid}`);
if (response.status !== 'complete' && response.status !== 'confirmed' && response.status !== 'paid') {
return;
}