parent
3fd5277912
commit
94e06a3a6b
@ -20,6 +20,8 @@ class Donations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createRequest(amount: number, orderId: string): Promise<any> {
|
createRequest(amount: number, orderId: string): Promise<any> {
|
||||||
|
logger.notice('New invoice request. Handle: ' + orderId + ' Amount: ' + amount + ' BTC');
|
||||||
|
|
||||||
const postData = {
|
const postData = {
|
||||||
'price': amount,
|
'price': amount,
|
||||||
'orderId': orderId,
|
'orderId': orderId,
|
||||||
@ -46,12 +48,11 @@ class Donations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async $handleWebhookRequest(data: any) {
|
async $handleWebhookRequest(data: any) {
|
||||||
logger.notice('Received BTCPayServer webhook data: ' + JSON.stringify(data));
|
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await this.getStatus(data.id);
|
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') {
|
if (response.status !== 'complete' && response.status !== 'confirmed' && response.status !== 'paid') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user