refactor: cleanup

This commit is contained in:
021-projects 2025-09-06 19:31:07 +03:00
parent 6056be8cff
commit 446f102455

View File

@ -38,7 +38,7 @@ class BTCPayServer extends AbstractProvider
$purchaseRequest->fastUpdate('provider_metadata', $invoice->getId());
$scriptUrl = $purchaseRequest->PaymentProfile->options['host'] . '/modal/btcpay.js';
$scriptUrl = $this->modalJsUrl($purchaseRequest->PaymentProfile);
if ($purchaseRequest->PaymentProfile->options['invoice_alert'] ?? false) {
$this->sendAlertWithInvoice($purchase, $invoice, $scriptUrl);
@ -63,7 +63,7 @@ class BTCPayServer extends AbstractProvider
throw $controller->exception($controller->noPermission());
}
$scriptUrl = $purchaseRequest->PaymentProfile->options['host'] . '/modal/btcpay.js';
$scriptUrl = $this->modalJsUrl($paymentProfile);
return $controller->view(
'BS\BtcPayServer:Initiate\BTCPayServer',
@ -72,6 +72,11 @@ class BTCPayServer extends AbstractProvider
);
}
protected function modalJsUrl(PaymentProfile $paymentProfile): string
{
return $paymentProfile->options['host'].'/modal/btcpay.js';
}
protected function sendAlertWithInvoice(
Purchase $purchase,
InvoiceResult $invoice,
@ -249,7 +254,6 @@ class BTCPayServer extends AbstractProvider
$apiKey = $options['api_key'] ?? '';
$storeId = $options['store_id'] ?? '';
$secret = $options['secret'] ?? '';
$invoiceAlert = (bool) ($options['invoice_alert'] ?? false);
$host = $options['host'] = rtrim($host, '/');