Skip to content

Commit

Permalink
[Order] Show payment info if order was created via BTCPay Server
Browse files Browse the repository at this point in the history
  • Loading branch information
BitcoinMitchell committed Feb 21, 2024
1 parent 4d8d0c4 commit 73ef8ce
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions modules/btcpay/btcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,25 +295,30 @@ public function hookDisplayOrderDetail(array $params): ?string
return null;
}

// Get BTCPay URL or abort
if (empty($serverUrl = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST))) {
// Check if we actually have an order
$order = $params['order'];
if (!$order instanceof Order) {
return null;
}

// Ensure the client is ready for use
if (null === ($client = Client::createFromConfiguration($this->configuration)) || false === $client->isValid()) {
// If created by another module, return
if ($order->module !== $this->name) {
return false;
}

// Check if we actually have an cart
$cart = $params['cart'];
if (!$cart instanceof Cart) {
return null;
}

// Check if we actually have an order
$order = $params['order'];
if (!$order instanceof Order) {
// Get BTCPay URL or abort
if (empty($serverUrl = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST))) {
return null;
}

// Check if we actually have an order
$cart = $params['cart'];
if (!$cart instanceof Cart) {
// Ensure the client is ready for use
if (null === ($client = Client::createFromConfiguration($this->configuration)) || false === $client->isValid()) {
return null;
}

Expand Down

0 comments on commit 73ef8ce

Please sign in to comment.