Results 1 to 10 of 821

Hybrid View

  1. #1
    Join Date
    Mar 2016
    Location
    Norcatur, Kansas, USA
    Posts
    80
    Plugin Contributions
    3

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Quote Originally Posted by DrByte View Post
    Um ... The error suggests that you've changed the PHP files associated with this module. If it was something Square did only on their end, the error would be different.

    What's the back-story of changes to the PHP files?

    Which set of files are you using? v0.9xxx? or 1.0-beta? Or a hybrid of files that you've changed independently?
    Ah, you are correct. I modified modules\payment\square.php around line 318 to add extra information about the order to the description passed to square:

    Code:
    	if (sizeof($order->products) < 100) {
    	    $p = '';
                for ($i = 0; $i < sizeof($order->products); $i++) {
                    $p2 = $order->products[$i];
    				if (!$p == '') {
    					$p .= ', ';
    				}
    				$p .= '(' . $p2['qty'] . ') ' . $p2['name'] ;
                }
            }
    		$p = 'Item(s) Ordered:' . $p;
    		
    		$d = 'Delivery Address: ' . $order->delivery['street_address'] . ', ' . $order->delivery['city'] . ', ' . $order->delivery['state'] . '  ' . $order->delivery['postcode'] . '  tel:' . $order->customer['telephone'];
    		$p .= '; ' . $d;
    
            $note = htmlentities(trim($order->billing['firstname'] . ' ' . $order->billing['lastname'] . ' ' . $p . ' ' . STORE_NAME));
    I had done this for the Stripe module and it worked great there because it basically duplicated the order information on the email that Stripe sent out to customers, which helped reassure them. The average order at my store is $3.5k, and some people are apprehensive about making such big purchases on the internet.

    I recently switched from Stripe to Square, and that is the reason for the module change. I will go read up how long the note field can be and modify the code to fit.

    Edit: So I reverted the payment module files back to the 1.0-beta (which is the version I'm using) and I still have the OAuthApi.php line 134 error.
    Last edited by Fjolsvith; 5 Mar 2020 at 03:54 AM.

  2. #2
    Join Date
    Mar 2016
    Location
    Norcatur, Kansas, USA
    Posts
    80
    Plugin Contributions
    3

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    I did receive an email from the Square Developer Team about new API updates and deprications yesterday, so I am pretty sure it is something to do with their API changes. I can forward it to you if you like, just send me a private message.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Quote Originally Posted by Fjolsvith View Post
    Ah, you are correct. I modified modules\payment\square.php around line 318 to add extra information about the order to the description passed to square:

    Code:
        if (sizeof($order->products) < 100) {
            $p = '';
                for ($i = 0; $i < sizeof($order->products); $i++) {
                    $p2 = $order->products[$i];
                    if (!$p == '') {
                        $p .= ', ';
                    }
                    $p .= '(' . $p2['qty'] . ') ' . $p2['name'] ;
                }
            }
            $p = 'Item(s) Ordered:' . $p;
            
            $d = 'Delivery Address: ' . $order->delivery['street_address'] . ', ' . $order->delivery['city'] . ', ' . $order->delivery['state'] . '  ' . $order->delivery['postcode'] . '  tel:' . $order->customer['telephone'];
            $p .= '; ' . $d;
    
            $note = htmlentities(trim($order->billing['firstname'] . ' ' . $order->billing['lastname'] . ' ' . $p . ' ' . STORE_NAME));
    After reviewing it, I figured it makes sense to incorporate this too, so (a modified form of) this is now in v1.0.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Mar 2016
    Location
    Norcatur, Kansas, USA
    Posts
    80
    Plugin Contributions
    3

    bug Re: Square Payment Module for Zen Cart [Support Thread]

    Okay, I found a bug in the 1.0 beta. It is in includes\modules\payments\square.php line 664:

    Code:
            $oauthApi = new SquareConnect\Api\OAuthApi($this->_sqConfig);
    The OAuthApi class initializes NOT with SquareConfiguration, but rather with ApiClient. See lines 34-45 of includes\classes\vendors\square\connect\lib\Api\OAuthApi.php:

    Code:
        /**
         * Constructor
         * @param \SquareConnect\ApiClient|null $apiClient The api client to use
         */
        function __construct($apiClient = null)
        {
            if ($apiClient == null) {
                $apiClient = new ApiClient();
                $apiClient->getConfig()->setHost('https://connect.squareup.com');
            }
      
            $this->apiClient = $apiClient;
        }
    So this is the error that is being thrown by this bug. This is the problem I have been experiencing:

    Code:
    [15-Mar-2020 20:47:11 America/Chicago] PHP Fatal error:  Uncaught Error: Call to undefined method SquareConnect\Configuration::callApi() in C:\wamp\www\store\includes\classes\vendors\square\connect\lib\Api\OAuthApi.php:134
    Stack trace:
    #0 C:\wamp\www\store\includes\classes\vendors\square\connect\lib\Api\OAuthApi.php(78): SquareConnect\Api\OAuthApi->obtainTokenWithHttpInfo(Object(SquareConnect\Model\ObtainTokenRequest))
    #1 C:\wamp\www\store\includes\modules\payment\square.php(676): SquareConnect\Api\OAuthApi->obtainToken(Object(SquareConnect\Model\ObtainTokenRequest))
    #2 C:\wamp\www\store\includes\modules\payment\square.php(541): square->renewOAuthToken()
    #3 C:\wamp\www\store\includes\modules\payment\square.php(476): square->token_refresh_check()
    #4 C:\wamp\www\store\includes\modules\payment\square.php(718): square->getAccessToken()
    #5 C:\wamp\www\store\includes\modules\payment\square.php(733): square->getLocationsList()
    #6 C:\wamp\www\store\includes\modules\payment\square.php(1264): square->getLocationsPulldownArray()
    #7 C:\wamp\www\store\wEn-nImda4eman\modules.php(307) : eval()'d code(1): zen_cfg_pull_down_square_locations('', 'MODULE_PAYMENT_...')
    #8 C:\wamp\www\store\wEn-nImda4eman\modules.php(307): eval()
    #9 {main}
      thrown in C:\wamp\www\store\includes\classes\vendors\square\connect\lib\Api\OAuthApi.php on line 134
    I believe I fixed it by modifying line 664 to:

    Code:
            $oauthApi = new SquareConnect\Api\OAuthApi($this->_apiConnection);
    Last edited by Fjolsvith; 16 Mar 2020 at 03:31 AM.

  5. #5
    Join Date
    Mar 2016
    Location
    Norcatur, Kansas, USA
    Posts
    80
    Plugin Contributions
    3

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Ah, good. I see you fixed the above bug in the 1.0 release. And, I'm proud of myself for devising the correct fix!

  6. #6
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: Square Payment Module for Zen Cart [Support Thread]

    Hmmm. I wonder if the same issue exists on line 677 (of the 1.0 file, not the beta).
    And if it does, I think the "fix" requires also calling setApiClient instead of setSquareConfig:

    Code:
            $this->setApiClient();
            $oauthApi = new SquareConnect\Api\OAuthApi($this->_apiConnection);
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. WordPress® for Zen Cart® (wp4zen) [Support Thread]
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 109
    Last Post: 1 Dec 2024, 01:36 PM
  2. Bambora/Beanstream Payment Module Support Thread
    By swguy in forum Addon Payment Modules
    Replies: 127
    Last Post: 26 Mar 2021, 04:13 PM
  3. v154 Support Thread: AddToAny for Zen Cart (The Universal Sharing Platform)
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 8 Apr 2019, 02:39 PM
  4. Layaway Payment Module Support Thread
    By Danielle in forum Addon Payment Modules
    Replies: 0
    Last Post: 21 Nov 2006, 06:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg