Thank you so much for creating this module. I am excited to put it to work, but I need a hand with a couple of errors. I'm afraid I do not code PHP and this is the first module I've tried to install.
osCommerce Online Merchant v2.2 RC2a
PHP Version 4.4.9
As the website administrator, I go to the module to install square. Square is not there and I see:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/username/public_html/includes/modules/payment/square.php on line 320
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/username/public_html/includes/modules/payment/square.php on line 320
Parse error: syntax error, unexpected T_STRING in /home/username/public_html/includes/modules/payment/square.php on line 320
I go to the file and I find line 320:
$transaction_api = new \SquareConnect\Api\TransactionApi();
It's in this function block:
function before_process() {
global $order, $HTTP_POST_VARS, $customer_id;
require(DIR_WS_CLASSES . "square" . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . 'autoload.php');
$requirement_query = tep_db_query("select f.configuration_value as access_token, s.configuration_value AS locationId from configuration f, configuration s where f.configuration_key = 'MODULE_PAYMENT_SQUARE_ACCESS_TOKEN' AND s.configuration_key = 'MODULE_PAYMENT_SQUARE_LOCATION_ID';");
$requirement_array = tep_db_fetch_array($requirement_query);
$access_token = $requirement_array['access_token'];
$locationID = $requirement_array['locationId'];
$transaction_api = new \SquareConnect\Api\TransactionApi();
$request_body = array (
"card_nonce" => $HTTP_POST_VARS['nonce'],
# Monetary amounts are specified in the smallest unit of the applicable currency.
# This amount is in cents. It's also hard-coded for $1.00, which isn't very useful.
"amount_money" => array (
"amount" => (round($order->info['total'], 2) * 100 ),
# Amount explanation:
# 100 is 1.00 USD
# 10000 is 100.00 USD
"currency" => "USD"
),
I tried a couple of syntax changes to line 320.
Original:
$transaction_api = new \SquareConnect\Api\TransactionApi();
Syntax Change 1:
$transaction_api = new ['\SquareConnect\Api\TransactionApi']();
Result:
The other warnings disappear and I'm left with the following error.
Parse error: syntax error, unexpected '[', expecting T_STRING or T_VARIABLE or '$' in /home/username/public_html/includes/modules/payment/square.php on line 320
I couldn't find the \SquareConnect\Api\TransactionApi path in my file system.
I look forward to any thoughts you have. I'd love to start using Square.
Thanks!