Compare commits

..

No commits in common. "main" and "v2.0.2" have entirely different histories.
main ... v2.0.2

3 changed files with 13 additions and 58 deletions

View File

@ -8,16 +8,7 @@
const id = btcpay.xfRegistry.nextInvoiceId
if (!id) return
setTimeout(this.closeOverlay)
btcpay.xfRegistry.nextInvoiceId = ''
btcpay.showInvoice(id)
},
closeOverlay () {
const overlays = document.querySelectorAll('.overlay-container.is-active')
if (overlays.length === 0) return
const lastOverlay = overlays[overlays.length - 1]
const overlay = lastOverlay.querySelector('.overlay')
@ -26,6 +17,9 @@
} else {
overlay.dispatchEvent(new Event('overlay:hide'))
}
btcpay.xfRegistry.nextInvoiceId = ''
btcpay.showInvoice(id)
}
}

View File

@ -38,7 +38,7 @@ class BTCPayServer extends AbstractProvider
$purchaseRequest->fastUpdate('provider_metadata', $invoice->getId());
$scriptUrl = $this->modalJsUrl($purchaseRequest->PaymentProfile);
$scriptUrl = $purchaseRequest->PaymentProfile->options['host'] . '/modal/btcpay.js';
if ($purchaseRequest->PaymentProfile->options['invoice_alert'] ?? false) {
$this->sendAlertWithInvoice($purchase, $invoice, $scriptUrl);
@ -51,32 +51,6 @@ class BTCPayServer extends AbstractProvider
);
}
public function processPayment(
Controller $controller,
PurchaseRequest $purchaseRequest,
PaymentProfile $paymentProfile,
Purchase $purchase
) {
$invoice = $this->getInvoice($purchaseRequest->provider_metadata, $paymentProfile);
if (! $invoice) {
throw $controller->exception($controller->noPermission());
}
$scriptUrl = $this->modalJsUrl($paymentProfile);
return $controller->view(
'BS\BtcPayServer:Initiate\BTCPayServer',
'btcpay_show_invoice',
compact('purchaseRequest', 'invoice', 'scriptUrl')
);
}
protected function modalJsUrl(PaymentProfile $paymentProfile): string
{
return $paymentProfile->options['host'].'/modal/btcpay.js';
}
protected function sendAlertWithInvoice(
Purchase $purchase,
InvoiceResult $invoice,
@ -125,7 +99,6 @@ class BTCPayServer extends AbstractProvider
[
'request_key' => $purchaseRequest->request_key,
'purchase_request_id' => $purchaseRequest->purchase_request_id,
'itemDesc' => $purchase->title,
],
$checkoutOptions
);
@ -136,16 +109,6 @@ class BTCPayServer extends AbstractProvider
}
}
protected function getInvoice(string $invoiceId, PaymentProfile $paymentProfile): ?InvoiceResult
{
$invoiceClient = new Invoice($paymentProfile->options['host'], $paymentProfile->options['api_key']);
try {
return $invoiceClient->getInvoice($paymentProfile->options['store_id'], $invoiceId);
} catch (\Exception $e) {
return null;
}
}
/**
* @inheritDoc
*/
@ -254,6 +217,7 @@ 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, '/');

View File

@ -1,17 +1,14 @@
{
"legacy_addon_id": "",
"title": "BTCPay Provider",
"title": "[021] BTCPay Provider",
"description": "Payment provider for BTCPay Server.",
"version_id": 2000370,
"version_string": "2.0.3",
"dev": "Genesis\u2122",
"dev_url": "https://gnz.is",
"version_id": 2000170,
"version_string": "2.0.1",
"dev": "021",
"dev_url": "https://devsell.io/",
"faq_url": "",
"support_url": "",
"extra_urls": {
"Discover more amazing add-ons": "https://gnz.is",
"Order custom services": "https://gnz.is/go/customdev"
},
"support_url": "https://devsell.io/",
"extra_urls": [],
"require": {
"XF": [
2020070,
@ -20,4 +17,4 @@
},
"icon": "icon.png",
"composer_autoload": "vendor/composer"
}
}