diff --git a/src/app/features/clipboard/clipboard-details/clipboard-details.component.ts b/src/app/features/clipboard/clipboard-details/clipboard-details.component.ts index c716e32..4e74e7f 100644 --- a/src/app/features/clipboard/clipboard-details/clipboard-details.component.ts +++ b/src/app/features/clipboard/clipboard-details/clipboard-details.component.ts @@ -29,16 +29,45 @@ export class ClipboardDetailsComponent extends BaseClipboardComponent { onVerify(): void { (async () => { - var result = await this.queryPayments(this.clipboardItem?.value ?? "") + const value = this.clipboardItem?.value; + + if (!value) { + return; + } + + const result = await this.queryPayments(value); if (result) { this.clipboardItemChange.emit(result as PaymentClipboardItem); - } else { - this.toastrService.error(`Payment not found.`); + return; } + + this.showPaymentNotFoundToast(value); })(); } + private showPaymentNotFoundToast(value: string): void { + this.toastrService.error( + `For more info on why this payment was not found click here.`, + 'Payment not found', + { + enableHtml: true, + tapToDismiss: false + } + ); + + setTimeout(() => { + const link = document.querySelector('.toast-error .payment-link'); + if (link) { + link.addEventListener('click', (e) => { + e.preventDefault(); + const url = `${this.serverService.baseUrl}/v2/verify/${encodeURIComponent(value)}`; + window.electron.openUrl(url); + }); + } + }, 100); + } + private async queryPayments(value: string): Promise { try { const paymentClipboardItems = await lastValueFrom(this.serverService.getPayment(value)); diff --git a/src/app/shared/services/server.service.ts b/src/app/shared/services/server.service.ts index 8b8d7d1..e2b6f3f 100644 --- a/src/app/shared/services/server.service.ts +++ b/src/app/shared/services/server.service.ts @@ -18,7 +18,7 @@ export class ServerService { return this.httpClient.get(`${this.baseUrl}/v2/payments/${encodeURIComponent(value)}`); } - private get baseUrl(): string { + get baseUrl(): string { if (environment.production == false) { return 'http://localhost:3000'; }