Skip to content

Commit

Permalink
remove duplicate vars
Browse files Browse the repository at this point in the history
  • Loading branch information
jlopp committed Jun 9, 2024
1 parent e643db6 commit f76a541
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions btcpay_callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const BTCPAY_IP_ADDRESS = ""; // external IP of your BTCPay server, used as sanity check / spam prevention
const YOUR_EMAIL_ADDRESS = "";
const FROM_EMAIL_ADDRESS = "[email protected]";
$headers = "From: " . FROM_EMAIL_ADDRESS . "\r\nReply-to: " . FROM_EMAIL_ADDRESS;

if ($_SERVER['REQUEST_METHOD'] != 'POST' || $_SERVER['REMOTE_ADDR'] != BTCPAY_IP_ADDRESS) {
http_response_code(401);
Expand All @@ -24,7 +25,6 @@
if ($invoice->status == "complete" || $invoice->status == "confirmed") {
if (!$orderData) {
$message = "Could not find message file for invoice " . $invoice->id . ", order " . $invoice->orderId;
$headers = "From: " . FROM_EMAIL_ADDRESS . "\r\nReply-to: " . FROM_EMAIL_ADDRESS;
mail(YOUR_EMAIL_ADDRESS, "Paid Message ERROR", $message, $headers);
} else {
$message = json_decode($orderData);
Expand All @@ -33,8 +33,9 @@
}
} else if (!$orderData) {
$message = "Could not find message file for invoice " . print_r($invoice, true);
$headers = "From: " . FROM_EMAIL_ADDRESS . "\r\nReply-to: " . FROM_EMAIL_ADDRESS;
mail(YOUR_EMAIL_ADDRESS, "Paid Message ERROR. invoice status: " . $invoice->status, $message, $headers);
} else {
mail(YOUR_EMAIL_ADDRESS, "Paid Message ERROR status ($invoice->status)", $message, $headers);
}
http_response_code(200);
?>

0 comments on commit f76a541

Please sign in to comment.