Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
m,
we have an order, 10030690, and we are trying to get the details of that order.
Yes, like
index.php?cmd=orders&page=1&oID=10030686&action=edit
for example.
Quote:
Originally Posted by
carlwhat
was that order processed using square_webPay or the old square version? do you know?
Same version, same files, same store etc.... Only difference is different merchant.
Quote:
Originally Posted by
carlwhat
what is the date of the order?
All Square orders prior to switching the merchant information for Square.
Quote:
Originally Posted by
carlwhat
when you say, reinstalled and configured, is the configuration new from the time the order was originally placed?
Yes
Quote:
Originally Posted by
carlwhat
is this problem just occurring for this order or for all orders?
All Square orders prior to switching the merchant information for Square.
Quote:
Originally Posted by
carlwhat
just before line 113 which has the getOrders call you can add:
PHP Code:
if (is_array($response['results'])) {
trigger_error(json_encode($response['results']));
return new Models\Order;
}
and then post the results of the corresponding log file. and we can take a look at what is happening.
best.
913
[05-Oct-2023 21:34:50 America/New_York] Request URI: /admin/index.php?cmd=orders&page=1&oID=10030690&action=edit, IP address: 000.000.000.000
--> PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Square\Models\Order::__construct(), 0 passed in /home/xxx/public_html/includes/modules/payment/square_webPay.php on line 915 and exactly 1 expected in /home/xxx/public_html/includes/modules/payment/square_webPay/square/square/src/Models/Order.php:172
Stack trace:
#0 /home/xxx/public_html/includes/modules/payment/square_webPay.php(915): Square\Models\Order->__construct()
#1 /home/xxx/public_html/includes/modules/payment/square_webPay.php(526): square_webPay->lookupOrderDetails(10030690)
#2 /home/xxx/public_html/admin/orders.php(741): square_webPay->admin_notification(10030690)
#3 /home/xxx/public_html/admin/index.php(11): require('/home/xxx/...')
#4 {main}
thrown in /home/xxx/public_html/includes/modules/payment/square_webPay/square/square/src/Models/Order.php on line 172.
Thanks =)
Re: Square WebPay support thread.
ok. you have new credentials. and you are trying to get the details of an order that made use of previous credentials. that is the problem you are experiencing.
i would like to point out that i do not use square (nor do any of the few clients i have); and i only decided to code this module at the request of one of the admins.
i tried to follow the path of the previous square module, and really i never liked the idea of making an API call every time someone is looking at an order in the admin. it is a waste of bandwidth IMO, and totally unnecessary. if one looks at my authorize.net card on file module, i only make API calls when needed, ie when refunded or doing an add-on transaction, etc.
for those of you that are experiencing this error, here is the solution. script:
includes/modules/payment/square_webPay.php
lines 912 -913 on version 1.0.4
PHP Code:
//from
$response = $this->processResult($apiResponse, $request);
return $response['results']->getOrders();
//to
$response = $this->processResult($apiResponse, $request);
if ($response['errors']) {
return [];
}
return $response['results']->getOrders();
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
ok. you have new credentials. and you are trying to get the details of an order that made use of previous credentials. that is the problem you are experiencing.
i would like to point out that i do not use square (nor do any of the few clients i have); and i only decided to code this module at the request of one of the admins.
i tried to follow the path of the previous square module, and really i never liked the idea of making an API call every time someone is looking at an order in the admin. it is a waste of bandwidth IMO, and totally unnecessary. if one looks at my authorize.net card on file module, i only make API calls when needed, ie when refunded or doing an add-on transaction, etc.
for those of you that are experiencing this error, here is the solution. script:
includes/modules/payment/square_webPay.php
lines 912 -913 on version 1.0.4
PHP Code:
//from
$response = $this->processResult($apiResponse, $request);
return $response['results']->getOrders();
//to
$response = $this->processResult($apiResponse, $request);
if ($response['errors']) {
return [];
}
return $response['results']->getOrders();
It doesn't work for me.
Here is what I have
Code:
$request = new Models\BatchRetrieveOrdersRequest($ids);
try {
$apiResponse = $this->client->getOrdersApi()->batchRetrieveOrders($request);
//orders fix (https://www.zen-cart.com/showthread.php?228750-Square-WebPay-support-thread&p=1397245#post1397245)
//$response = $this->processResult($apiResponse, $request);
//return $response['results']->getOrders();
$response = $this->processResult($apiResponse, $request);
if ($response['errors']) {
return [];
}
return $response['results']->getOrders();
} catch (\SquareConnect\ApiException $e) {
return new Models\Order;
}
}
Here is the error
[06-Oct-2023 10:10:23 America/New_York] Request URI: /XX/index.php?cmd=orders&page=1&oID=10030684&action=edit, IP address: 000.000.000.000
--> PHP Fatal error: Uncaught Error: Call to a member function getOrders() on array in /home/XXX/public_html/includes/modules/payment/square_webPay.php:919
Stack trace:
#0 /home/XXX/public_html/includes/modules/payment/square_webPay.php(526): square_webPay->lookupOrderDetails(10030684)
#1 /home/XXX/public_html/XX/orders.php(741): square_webPay->admin_notification(10030684)
#2 /home/XXX/public_html/XX/index.php(11): require('/home/XXX/...')
#3 {main}
thrown in /home/XXX/public_html/includes/modules/payment/square_webPay.php on line 919.
Re: Square WebPay support thread.
before the getOrders, aka, the error line, add
PHP Code:
trigger_error('Response: ' . json_encode($response));
and post that log.
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
before the getOrders, aka, the error line, add
PHP Code:
trigger_error('Response: ' . json_encode($response));
and post that log.
[06-Oct-2023 10:32:26 America/New_York] Request URI: /xxx/index.php?cmd=orders&page=1&oID=10030689&action=edit, IP address: 134.215.175.155
--> PHP Fatal error: Uncaught Error: Call to a member function getOrders() on array in /home/xxx/public_html/includes/modules/payment/square_webPay.php:920
Stack trace:
#0 /home/xxx/public_html/includes/modules/payment/square_webPay.php(526): square_webPay->lookupOrderDetails(10030689)
#1 /home/xxx/public_html/xxx/orders.php(741): square_webPay->admin_notification(10030689)
#2 /home/xxx/public_html/xxx/index.php(11): require('/home/xxx/...')
#3 {main}
thrown in /home/xxx/public_html/includes/modules/payment/square_webPay.php on line 920.
Re: Square WebPay support thread.
you are not posting the contents of:
trigger_error('Response: ' . json_encode($response));
i need a log file that starts with:
Response:
if you want more help.
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
you are not posting the contents of:
trigger_error('Response: ' . json_encode($response));
i need a log file that starts with:
Response:
if you want more help.
One was not generated
Re: Square WebPay support thread.
try:
PHP Code:
trigger_error('Response: ' . json_encode($response), E_USER_WARNING);
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
try:
PHP Code:
trigger_error('Response: ' . json_encode($response), E_USER_WARNING);
[09-Oct-2023 06:03:08 America/New_York] Request URI: /XX/index.php?cmd=orders&page=1&oID=10030681&action=edit, IP address: 000.000.000.000
#1 trigger_error() called at [/home/XXX/public_html/includes/modules/payment/square_webPay.php:919]
#2 square_webPay->lookupOrderDetails() called at [/home/XXX/public_html/includes/modules/payment/square_webPay.php:526]
#3 square_webPay->admin_notification() called at [/home/XXX/public_html/XX/orders.php:741]
#4 require(/home/XXX/public_html/XX/orders.php) called at [/home/XXX/public_html/XX/index.php:11]
--> PHP Warning: Response: {"error":true,"results":[{"category":"AUTHENTICATION_ERROR","code":"FORBIDDEN","detail":"Cannot fetch orders for a different merchant."}]} in /home/XXX/public_html/includes/modules/payment/square_webPay.php on line 919.
[09-Oct-2023 06:03:08 America/New_York] Request URI: /XX/index.php?cmd=orders&page=1&oID=10030681&action=edit, IP address: 000.000.000.000
--> PHP Fatal error: Uncaught Error: Call to a member function getOrders() on array in /home/XXX/public_html/includes/modules/payment/square_webPay.php:920
Stack trace:
#0 /home/XXX/public_html/includes/modules/payment/square_webPay.php(526): square_webPay->lookupOrderDetails(10030681)
#1 /home/XXX/public_html/XX/orders.php(741): square_webPay->admin_notification(10030681)
#2 /home/XXX/public_html/XX/index.php(11): require('/home/XXX/...')
#3 {main}
thrown in /home/XXX/public_html/includes/modules/payment/square_webPay.php on line 920.
Re: Square WebPay support thread.
look back at this post.
PHP Code:
//from
if ($response['errors']) {
//to
if ($response['error']) {
TSIS.