Custom BTCPay donation integration

fixes #122
This commit is contained in:
softsimon
2020-10-07 20:15:42 +07:00
parent 96b3419227
commit 5859f4ff9b
14 changed files with 359 additions and 15 deletions

View File

@@ -61,4 +61,16 @@ export class ApiService {
});
return this.httpClient.get<number[]>(this.apiBaseUrl + '/transaction-times', { params });
}
requestDonation$(amount: number, orderId: string): Observable<any> {
const params = {
amount: amount,
orderId: orderId,
};
return this.httpClient.post<any>(this.apiBaseUrl + '/donations', params);
}
getDonation$(): Observable<any[]> {
return this.httpClient.get<any[]>(this.apiBaseUrl + '/donations');
}
}

View File

@@ -34,6 +34,7 @@ export class StateService {
vbytesPerSecond$ = new ReplaySubject<number>(1);
lastDifficultyAdjustment$ = new ReplaySubject<number>(1);
gitCommit$ = new ReplaySubject<string>(1);
donationConfirmed$ = new Subject();
live2Chart$ = new Subject<OptimizedMempoolStats>();

View File

@@ -155,6 +155,10 @@ export class WebsocketService {
this.stateService.gitCommit$.next(response['git-commit']);
}
if (response.donationConfirmed) {
this.stateService.donationConfirmed$.next(true);
}
if (this.goneOffline === true) {
this.goneOffline = false;
if (this.lastWant) {
@@ -189,6 +193,10 @@ export class WebsocketService {
this.isTrackingTx = true;
}
trackDonation(id: string) {
this.websocketSubject.next({ 'track-donation': id });
}
stopTrackingTransaction() {
if (!this.isTrackingTx) {
return;