diff --git a/modules/gateways/bitpaycheckout.php b/modules/gateways/bitpaycheckout.php
index f9adbab..ff5c63f 100644
--- a/modules/gateways/bitpaycheckout.php
+++ b/modules/gateways/bitpaycheckout.php
@@ -19,8 +19,11 @@
die("This file cannot be accessed directly");
}
-include_once(__DIR__ . DIRECTORY_SEPARATOR . 'bitpaycheckout' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
-use BitPaySDK\PosClient;
+include_once(__DIR__ . DIRECTORY_SEPARATOR . 'bitpaycheckout'
+ . DIRECTORY_SEPARATOR . 'vendor'
+ . DIRECTORY_SEPARATOR . 'autoload.php');
+
+ use BitPaySDK\PosClient;
use BitPaySDK\Model\Invoice\Invoice;
use BitPaySDK\Model\Invoice\Buyer;
use BitPaySDK\Model\Facade;
@@ -96,6 +99,7 @@ function bitpaycheckout_config()
'Type' => 'text',
'Size' => '25',
'Default' => '',
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
'Description' => 'Your development merchant token. Create one here and uncheck `Require Authentication`.',
),
// a text field type allows for single line text input
@@ -104,6 +108,7 @@ function bitpaycheckout_config()
'Type' => 'text',
'Size' => '25',
'Default' => '',
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
'Description' => 'Your production merchant token. Create one here and uncheck `Require Authentication`.',
),
@@ -111,12 +116,14 @@ function bitpaycheckout_config()
'FriendlyName' => 'Endpoint',
'Type' => 'dropdown',
'Options' => 'Test,Production',
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
'Description' => 'Select Test for testing the plugin, Production when you are ready to go live.
',
),
'bitpay_checkout_mode' => array(
'FriendlyName' => 'Payment UX',
'Type' => 'dropdown',
'Options' => 'Modal,Redirect',
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
'Description' => 'Select Modal to keep the user on the invoice page, or Redirect to have them view the invoice at BitPay.com, and be redirected after payment.
',
),
);
@@ -147,7 +154,7 @@ function bitpaycheckout_link($config_params)
$client = new PosClient($bitpay_checkout_token, $bitpay_checkout_endpoint);
- #check to make sure we don't already have a valid BitPay Invoice active
+ // Check to make sure we don't already have a valid BitPay Invoice active
$checkDup = Capsule::table('_bitpay_checkout_transactions')
->select('transaction_id')
->where('order_id', '=', $config_params['invoiceid'])
@@ -179,7 +186,7 @@ function bitpaycheckout_link($config_params)
$moduleDisplayName = $config_params['name'];
$moduleName = $config_params['paymentmethod'];
- #BITPAY INVOICE DETAILS
+ // BITPAY INVOICE DETAILS
$params = new stdClass();
$dir = dirname($_SERVER['REQUEST_URI']);
@@ -188,13 +195,17 @@ function bitpaycheckout_link($config_params)
}
$params->orderId = trim($invoiceId);
- $params->notificationURL = $protocol . $_SERVER['SERVER_NAME'] . $dir . '/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php';
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
+ $params->notificationURL = $protocol . $_SERVER['SERVER_NAME']. $dir . '/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php';
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
$params->redirectURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$params->fullNotifications = true;
$protocol = 'https://';
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
$notificationURL = $protocol . $_SERVER['SERVER_NAME'] . $dir . '/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php';
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
$redirectURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$invoice = new Invoice($amount, $currencyCode);
@@ -231,6 +242,7 @@ function bitpaycheckout_link($config_params)
try {
$statement = $pdo->prepare(
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
'insert into _bitpay_checkout_transactions (order_id, transaction_id, transaction_status,created_at) values (:order_id, :transaction_id, :transaction_status,:created_at)'
);
@@ -250,8 +262,10 @@ function bitpaycheckout_link($config_params)
}
if ($bitpay_checkout_mode == 'Modal') {
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
$htmlOutput .= '';
} else {
+ // @phpcs:ignore Generic.Files.LineLength.TooLong
$htmlOutput .= '';
}
?>
@@ -273,7 +287,7 @@ function redirectURL($url){
}
}, false);
function showModal(){
- //show the modal
+ // Show the modal
bitpay.enableTestMode()
diff --git a/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php b/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php
index 43a57c0..0768e0c 100644
--- a/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php
+++ b/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php
@@ -22,11 +22,12 @@
// Require libraries needed for gateway module functions.
require_once '../../../../init.php';
-require_once '../../../../includes/gatewayfunctions.php';
-require_once '../../../../includes/invoicefunctions.php';
+require_once ROOTDIR . "/includes/gatewayfunctions.php";
+require_once ROOTDIR . "/includes/invoicefunctions.php";
// Detect module name from filename.
$gatewayModuleName = 'bitpaycheckout';
+
// Fetch gateway configuration parameters.
$gatewayParams = getGatewayVariables($gatewayModuleName);
define("TEST_URL", 'https://test.bitpay.com/invoices/');
diff --git a/phpcbf.phar b/phpcbf.phar
new file mode 100644
index 0000000..aaf58d4
Binary files /dev/null and b/phpcbf.phar differ
diff --git a/phpcs.phar b/phpcs.phar
new file mode 100644
index 0000000..bd26ba6
Binary files /dev/null and b/phpcs.phar differ
diff --git a/phpcs.xml b/phpcs.xml
index 385fb12..c2d6795 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -12,4 +12,8 @@
modules/
*/vendor/*
+
+
+
+