diff --git a/modules/gateways/bit-pay/.htaccess b/modules/gateways/bit-pay/.htaccess old mode 100644 new mode 100755 diff --git a/modules/gateways/bit-pay/bp_lib.php b/modules/gateways/bit-pay/bp_lib.php old mode 100644 new mode 100755 index 0aa7763..d65c675 --- a/modules/gateways/bit-pay/bp_lib.php +++ b/modules/gateways/bit-pay/bp_lib.php @@ -147,6 +147,7 @@ function bpCreateInvoice($orderId, $price, $posData, $options = array()) } $post = json_encode($post); + $response = bpCurl($network, $options['apiKey'], $post); return $response; diff --git a/modules/gateways/bit-pay/bp_options.php b/modules/gateways/bit-pay/bp_options.php old mode 100644 new mode 100755 diff --git a/modules/gateways/bit-pay/createinvoice.php b/modules/gateways/bit-pay/createinvoice.php index 5491886..793d19c 100755 --- a/modules/gateways/bit-pay/createinvoice.php +++ b/modules/gateways/bit-pay/createinvoice.php @@ -23,6 +23,8 @@ * THE SOFTWARE. */ +use WHMCS\Database\Capsule; + include '../../../includes/functions.php'; include '../../../includes/gatewayfunctions.php'; include '../../../includes/invoicefunctions.php'; @@ -45,8 +47,8 @@ // get invoice $invoiceId = (int) $_POST['invoiceId']; $price = $currency = false; -$result = mysql_query("SELECT tblinvoices.total, tblinvoices.status, tblcurrencies.code FROM tblinvoices, tblclients, tblcurrencies where tblinvoices.userid = tblclients.id and tblclients.currency = tblcurrencies.id and tblinvoices.id=$invoiceId"); -$data = mysql_fetch_assoc($result); +$result = Capsule::connection()->select("SELECT tblinvoices.total, tblinvoices.status, tblcurrencies.code FROM tblinvoices, tblclients, tblcurrencies where tblinvoices.userid = tblclients.id and tblclients.currency = tblcurrencies.id and tblinvoices.id=$invoiceId"); +$data = (array)$result[0]; if (!$data) { bpLog('[ERROR] In modules/gateways/bitpay/createinvoice.php: No invoice found for invoice id #' . $invoiceId); @@ -65,8 +67,8 @@ // if convert-to option is set (gateway setting), then convert to requested currency $convertTo = false; $query = "SELECT value from tblpaymentgateways where `gateway` = '$gatewaymodule' and `setting` = 'convertto'"; -$result = mysql_query($query); -$data = mysql_fetch_assoc($result); +$result = Capsule::connection()->select($query); +$data = (array)$result[0]; if ($data) { $convertTo = $data['value']; @@ -75,16 +77,16 @@ if ($convertTo) { // fetch $currency and $convertTo currencies $query = "SELECT rate FROM tblcurrencies where `code` = '$currency'"; - $result = mysql_query($query); - $currentCurrency = mysql_fetch_assoc($result); + $result = Capsule::connection()->select($query); + $currentCurrency = (array)$result[0]; if (!$currentCurrency) { bpLog('[ERROR] In modules/gateways/bitpay/createinvoice.php: Invalid invoice currency of ' . $currency); die('[ERROR] In modules/gateways/bitpay/createinvoice.php: Invalid invoice currency of ' . $currency); } - $result = mysql_query("SELECT code, rate FROM tblcurrencies where `id` = $convertTo"); - $convertToCurrency = mysql_fetch_assoc($result); + $result = Capsule::connection()->select("SELECT code, rate FROM tblcurrencies where `id` = $convertTo"); + $convertToCurrency = (array)$result[0]; if (!$convertToCurrency) { bpLog('[ERROR] In modules/gateways/bitpay/createinvoice.php: Invalid convertTo currency of ' . $convertTo); @@ -100,10 +102,9 @@ unset($options['invoiceId']); unset($options['systemURL']); -unset($options['redirectURL']); $options['notificationURL'] = $_POST['systemURL'].'/modules/gateways/callback/bitpay.php'; -$options['redirectURL'] = isset($_POST['redirectURL']) ? $_POST['redirectURL'] : $_POST['systemURL']; +$options['redirectURL'] = $_POST['systemURL']; $options['apiKey'] = $GATEWAY['apiKey']; $options['transactionSpeed'] = $GATEWAY['transactionSpeed']; $options['currency'] = $currency; diff --git a/modules/gateways/bit-pay/index.php b/modules/gateways/bit-pay/index.php old mode 100644 new mode 100755 diff --git a/modules/gateways/bitpay.php b/modules/gateways/bitpay.php index 6cad7b0..131817b 100755 --- a/modules/gateways/bitpay.php +++ b/modules/gateways/bitpay.php @@ -96,7 +96,7 @@ function bitpay_link($params) 'buyerEmail' => $email, 'buyerPhone' => $phone, ); - + $form = '