Skip to content

Commit 6a60003

Browse files
committed
SP-986: Update comments formatting
1 parent 3e0256b commit 6a60003

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

modules/gateways/bitpaycheckout.php

+9-12
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
* @license http://www.whmcs.com/license/ WHMCS Eula
1616
*/
1717

18-
if (!defined("WHMCS")) {
19-
die("This file cannot be accessed directly");
18+
if (!defined('WHMCS')) {
19+
die('This file cannot be accessed directly');
2020
}
2121

22-
include_once(__DIR__ . DIRECTORY_SEPARATOR . 'bitpaycheckout'
22+
require(__DIR__ . DIRECTORY_SEPARATOR . 'bitpaycheckout'
2323
. DIRECTORY_SEPARATOR . 'vendor'
2424
. DIRECTORY_SEPARATOR . 'autoload.php');
2525

@@ -75,8 +75,6 @@ function ($table) {
7575
* * radio
7676
* * textarea
7777
*
78-
* Examples of each field type and their possible configuration parameters are
79-
* provided in the sample function below.
8078
*
8179
* @see https://developers.whmcs.com/payment-gateways/configuration/
8280
*
@@ -140,7 +138,7 @@ function bitpaycheckout_link($config_params)
140138
}
141139
$bitpay_checkout_mode = $config_params['bitpay_checkout_mode'];
142140

143-
$curpage = basename($_SERVER["SCRIPT_FILENAME"]);
141+
$curpage = basename($_SERVER['SCRIPT_FILENAME']);
144142

145143
$curpage = str_replace("/", "", $curpage);
146144
if ($curpage != 'viewinvoice.php') {
@@ -196,13 +194,12 @@ function bitpaycheckout_link($config_params)
196194

197195
$params->orderId = trim($invoiceId);
198196
// @phpcs:ignore Generic.Files.LineLength.TooLong
197+
$protocol = 'https://';
199198
$params->notificationURL = $protocol . $_SERVER['SERVER_NAME']. $dir . '/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php';
200199
// @phpcs:ignore Generic.Files.LineLength.TooLong
201200
$params->redirectURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
202201
$params->fullNotifications = true;
203202

204-
$protocol = 'https://';
205-
206203
// @phpcs:ignore Generic.Files.LineLength.TooLong
207204
$notificationURL = $protocol . $_SERVER['SERVER_NAME'] . $dir . '/modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php';
208205
// @phpcs:ignore Generic.Files.LineLength.TooLong
@@ -232,11 +229,11 @@ function bitpaycheckout_link($config_params)
232229
$invoice->setBuyer($buyer);
233230
$basicInvoice = $client->createInvoice($invoice, Facade::POS, false);
234231

235-
error_log("=======USER LOADED BITPAY CHECKOUT INVOICE=====");
232+
error_log('=======USER LOADED BITPAY CHECKOUT INVOICE=====');
236233
error_log(date('d.m.Y H:i:s'));
237-
error_log("=======END OF INVOICE==========================");
234+
error_log('=======END OF INVOICE==========================');
238235

239-
#insert into the database
236+
// Insert into the database
240237
$pdo = Capsule::connection()->getPdo();
241238
$pdo->beginTransaction();
242239

@@ -277,7 +274,7 @@ function redirectURL($url){
277274

278275
var payment_status = null;
279276
var is_paid = false;
280-
window.addEventListener("message", function(event) {
277+
window.addEventListener('message', function(event) {
281278
payment_status = event.data.status;
282279
if(payment_status == 'paid' || payment_status == 'confirmed' || payment_status == 'complete'){
283280
is_paid = true;

modules/gateways/bitpaycheckout/callback/bitpaycheckout_ipn.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function checkInvoiceStatus($url)
6262

6363
$orderid = checkCbInvoiceID($invoiceStatus->data->orderId, 'bitpaycheckout');
6464
$price = $invoiceStatus->data->price;
65-
//first see if the ipn matches
65+
// First see if the ipn matches
6666
$trans_data = Capsule::table('_bitpay_checkout_transactions')
6767
->select('order_id', 'transaction_id', 'transaction_status')
6868
->where([
@@ -76,13 +76,13 @@ function checkInvoiceStatus($url)
7676

7777
if ($btn_id) {
7878
switch ($data['status']) {
79-
//complete, update invoice table to Paid
79+
// Complete, update invoice table to Paid
8080
case 'complete':
8181
if ($transaction_status == $data['status']) {
8282
exit();
8383
}
8484

85-
//update the bitpay_invoice table
85+
// Update the bitpay_invoice table
8686
$table = '_bitpay_checkout_transactions';
8787
$update = array('transaction_status' => 'complete', 'updated_at' => date('Y-m-d H:i:s'));
8888
try {
@@ -105,9 +105,9 @@ function checkInvoiceStatus($url)
105105
);
106106
break;
107107

108-
//processing - put in Payment Pending
108+
// Processing - put in Payment Pending
109109
case 'paid':
110-
//update the invoices table
110+
// Update the invoices table
111111
$table = 'tblinvoices';
112112
$update = array("status" => 'Payment Pending','datepaid' => date('Y-m-d H:i:s'));
113113
try {
@@ -121,7 +121,7 @@ function checkInvoiceStatus($url)
121121
file_put_contents($file, $e, FILE_APPEND);
122122
}
123123

124-
//update the bitpay_invoice table
124+
// Update the bitpay_invoice table
125125
$table = '_bitpay_checkout_transactions';
126126
$update = array('transaction_status' => 'paid', 'updated_at' => date('Y-m-d H:i:s'));
127127
try {
@@ -136,9 +136,9 @@ function checkInvoiceStatus($url)
136136
}
137137
break;
138138

139-
//expired, remove from transaction table, wont be in invoice table
139+
// Expired, remove from transaction table, wont be in invoice table
140140
case 'expired':
141-
//delete any orphans
141+
// Delete any orphans
142142
$table = '_bitpay_checkout_transactions';
143143
try {
144144
Capsule::table($table)
@@ -149,7 +149,7 @@ function checkInvoiceStatus($url)
149149
}
150150
break;
151151

152-
//refunded, set invoice and bitpay transaction to refunded status
152+
// Refunded, set invoice and bitpay transaction to refunded status
153153
case 'pending':
154154
if ($event['name'] == 'refund_pending') {
155155
//update the invoices table
@@ -166,7 +166,7 @@ function checkInvoiceStatus($url)
166166
file_put_contents($file, $e, FILE_APPEND);
167167
}
168168

169-
//update the bitpay invoice table
169+
// Update the bitpay invoice table
170170
$table = '_bitpay_checkout_transactions';
171171
$update = array('transaction_status' => 'refunded', 'updated_at' => date('Y-m-d H:i:s'));
172172
try {

0 commit comments

Comments
 (0)