Jump to content
thirty bees forum
  • 0

SagePay PayNow Module


Raithlin

Question

Hi all,

I'm using ThirtyBees 1.04 with the SagePay PayNow module (3rd party payment gateway) for PrestaShop. Tested with PrestaShop 1.6.11, it works perfectly until it comes back from the payment provider, at which point it simply reverts back to the first order page. The result is a payment without an order. I'm looking at the code to figure out what has changed and why it doesn't get to the order confirmation page. Any help would be appreciated, from where to look for changes to a sample payment module that works - anything that will help me sort this out. I'm a C# developer by trade, but PHP isn't too different, and I've done plenty of web dev over the years. I've taken a look at the code as I said, just looking for some pointers here.

TIA

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 1

I am seeing the exact same issue, no problem on Prestashop, but thirty bees does not process the order.

I see the post back but the Cart Does not get turned into a valid order

105.186.16.177 - - [27/Feb/2018:13:02:47 +0200] "GET /modules/paynow/logo.png HTTP/1.1" 200 3326 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10133) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6" 41.21.175.145 - - [27/Feb/2018:13:06:12 +0200] "POST /modules/paynow/paynowcallback.php?key=xxxxxxxxxxx0f716d7fa8cd8b3064&idcart=23188&idmodule=185 HTTP/1.1" 302 4708 "-" "-" 105.186.16.177 - - [27/Feb/2018:13:06:13 +0200] "POST /modules/paynow/paynowcallback.php?key=xxxxxxxxxxx0f716d7fa8cd8b3064&idcart=23188&idmodule=185 HTTP/1.1" 302 630 "https://paynow.sagepay.co.za/Site/PayNowAccept.aspx" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10133) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6" 105.186.16.177 - - [27/Feb/2018:13:06:14 +0200] "GET /index.php?controller=order-confirmation?key=xxxxxxxxxxx0f716d7fa8cd8b3064&idcart=23188&idmodule=185 HTTP/1.1" 302 389 "https://paynow.sagepay.co.za/Site/PayNowAccept.aspx" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10133) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6" 105.186.16.177 - - [27/Feb/2018:13:06:14 +0200] "GET /order-history HTTP/1.1" 200 7936 "https://paynow.sagepay.co.za/Site/PayNowAccept.aspx" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10133) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6"

I do also get a warning on the dispatcher...

[Tue Feb 27 13:06:13.512467 2018] [fcgid:warn] [pid 160555] [client 41.21.175.145:55652] modfcgid: stderr: PHP Warning: Invalid argument supplied for foreach() in /var/www/clients/client2/web5/web/classes/Dispatcher.php on line 513 [Tue Feb 27 13:06:13.959738 2018] [fcgid:warn] [pid 160555] [client 41.21.175.145:55652] modfcgid: stderr: PHP Warning: Invalid argument supplied for foreach() in /var/www/clients/client2/web5/web/classes/Dispatcher.php on line 513

This is what I get in the module debug log

2018-02-27 13:06:12 : Verify data received 2018-02-27 13:06:12 : Host = gateway.sagepay.co.za 2018-02-27 13:06:12 : Params = RequestTrace=36973.31290079 2018-02-27 13:06:12 : curl_init 2018-02-27 13:06:13 : Response:

2018-02-27 13:06:13 : Amount: Valid! 2018-02-27 13:06:13 : --> valOne: [string] true 2018-02-27 13:06:13 : --> valTwo: [string] true 2018-02-27 13:06:13 : TransactionAccepted: Valid! 2018-02-27 13:06:13 : Reference: Valid! 2018-02-27 13:06:13 : RequestTrace: Valid! 2018-02-27 13:06:13 : pnValidData: true 2018-02-27 13:06:13 : Check status and update order 2018-02-27 13:06:13 : - Complete 2018-02-27 13:06:13 : - Redirecting to order-confirmation 2018-02-27 13:06:14 : SagePayNow Validation initiated. 2018-02-27 13:06:14 : Get posted data 2018-02-27 13:06:14 : SagePayNow Data: Array ( [TransactionAccepted] => true [CardHolderIpAddr] => 198.6.6.1 [RequestTrace] => 36973.31290079 [Reference] => 23188_2018022746 [Extra1] => 1337 [Extra2] => 23188 [Extra3] => xxxxxxxxxxx0f716d7fa8cd8b3064 [Amount] => 3765.0000 [Method] => 1 )

2018-02-27 13:06:14 : Purchase: Cart Object ( [idshopgroup] => 1 [idshop] => 1 [idaddressdelivery] => 1378 [idaddressinvoice] => 1378 [idcurrency] => 3 [idcustomer] => 1337 [idguest] => 576807 [idlang] => 1 [recyclable] => 0 [gift] => 0 [giftmessage] => [mobiletheme] => 0 [dateadd] => 2018-02-27 12:57:25 [securekey] => xxxxxxxxxxx0f716d7fa8cd8b3064 [idcarrier] => 28 [dateupd] => 2018-02-27 13:02:33 [checkedTos] => [pictures] => [textFields] => [deliveryoption] => a:1:{i:1378;s:3:"28,";} [allowseperatedpackage] => 0 [products:protected] => [taxCalculationMethod:protected] => 0 [webserviceParameters:protected] => Array ( [fields] => Array ( [idaddressdelivery] => Array ( [xlink_resource] => addresses )

                [id_address_invoice] => Array
                    (
                        [xlink_resource] => addresses
                    )

                [id_currency] => Array
                    (
                        [xlink_resource] => currencies
                    )

                [id_customer] => Array
                    (
                        [xlink_resource] => customers
                    )

                [id_guest] => Array
                    (
                        [xlink_resource] => guests
                    )

                [id_lang] => Array
                    (
                        [xlink_resource] => languages
                    )

            )

        [associations] => Array
            (
                [cart_rows] => Array
                    (
                        [resource] => cart_row
                        [virtual_entity] => 1
                        [fields] => Array
                            (
                                [id_product] => Array
                                    (
                                        [required] => 1
                                        [xlink_resource] => products
                                    )

                                [id_product_attribute] => Array
                                    (
                                        [required] => 1
                                        [xlink_resource] => combinations
                                    )

                                [id_address_delivery] => Array
                                    (
                                        [required] => 1
                                        [xlink_resource] => addresses
                                    )

                                [quantity] => Array
                                    (
                                        [required] => 1
                                    )

                            )

                    )

            )

    )

[id] => 23188
[id_shop_list] => 
[get_shop_from_context:protected] => 1
[table:protected] => cart
[identifier:protected] => id_cart
[fieldsRequired:protected] => Array
    (
        [0] => id_currency
        [1] => id_lang
    )

[fieldsSize:protected] => Array
    (
        [secure_key] => 32
    )

[fieldsValidate:protected] => Array
    (
        [id_shop_group] => isUnsignedId
        [id_shop] => isUnsignedId
        [id_address_delivery] => isUnsignedId
        [id_address_invoice] => isUnsignedId
        [id_carrier] => isUnsignedId
        [id_currency] => isUnsignedId
        [id_customer] => isUnsignedId
        [id_guest] => isUnsignedId
        [id_lang] => isUnsignedId
        [recyclable] => isBool
        [gift] => isBool
        [gift_message] => isMessage
        [mobile_theme] => isBool
        [allow_seperated_package] => isBool
        [date_add] => isDate
        [date_upd] => isDate
    )

[fieldsRequiredLang:protected] => Array
    (
    )

[fieldsSizeLang:protected] => Array
    (
    )

[fieldsValidateLang:protected] => Array
    (
    )

[tables:protected] => Array
    (
    )

[image_dir:protected] => 
[image_format:protected] => jpg
[def:protected] => Array
    (
        [table] => cart
        [primary] => id_cart
        [fields] => Array
            (
                [id_shop_group] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                    )

                [id_shop] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                    )

                [id_address_delivery] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                    )

                [id_address_invoice] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                    )

                [id_carrier] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                    )

                [id_currency] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                        [required] => 1
                    )

                [id_customer] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                    )

                [id_guest] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                    )

                [id_lang] => Array
                    (
                        [type] => 1
                        [validate] => isUnsignedId
                        [required] => 1
                    )

                [recyclable] => Array
                    (
                        [type] => 2
                        [validate] => isBool
                    )

                [gift] => Array
                    (
                        [type] => 2
                        [validate] => isBool
                    )

                [gift_message] => Array
                    (
                        [type] => 3
                        [validate] => isMessage
                    )

                [mobile_theme] => Array
                    (
                        [type] => 2
                        [validate] => isBool
                    )

                [delivery_option] => Array
                    (
                        [type] => 3
                    )

                [secure_key] => Array
                    (
                        [type] => 3
                        [size] => 32
                    )

                [allow_seperated_package] => Array
                    (
                        [type] => 2
                        [validate] => isBool
                    )

                [date_add] => Array
                    (
                        [type] => 5
                        [validate] => isDate
                    )

                [date_upd] => Array
                    (
                        [type] => 5
                        [validate] => isDate
                    )

            )

        [classname] => Cart
    )

[update_fields:protected] => 
[force_id] => 

)

2018-02-27 13:06:14 : Verify data received 2018-02-27 13:06:14 : Host = gateway.sagepay.co.za 2018-02-27 13:06:14 : Params = RequestTrace=36973.31290079 2018-02-27 13:06:14 : curl_init 2018-02-27 13:06:14 : Response:

2018-02-27 13:06:14 : Amount: Valid! 2018-02-27 13:06:14 : --> valOne: [string] true 2018-02-27 13:06:14 : --> valTwo: [string] true 2018-02-27 13:06:14 : TransactionAccepted: Valid! 2018-02-27 13:06:14 : Reference: Valid! 2018-02-27 13:06:14 : RequestTrace: Valid! 2018-02-27 13:06:14 : pnValidData: true 2018-02-27 13:06:14 : Check status and update order 2018-02-27 13:06:14 : - Complete 2018-02-27 13:06:14 : - Redirecting to order-confirmationxxxxxxxxxxx

Link to comment
Share on other sites

  • 0

I added the redirect URL to the log. Can anyone confirm if we are missing anything on this?

index.php?controller=order-confirmation&key=xxxx24d7a231aa37d91113f6905xxxx&idcart=69&idmodule=100

I see the code is setup as follows: Tools::redirect('index.php?controller=order-confirmation&'.$SERVER['QUERYSTRING']);

Is that not perhaps causing the & issues we are seeing on the redirect line above? Would it not be worth recreating the line, as in say the Authorize module? Tools::redirect($url.'idmodule='.(int) $authorizeaim->id.'&idcart='.(int) $cart->id.'&key='.$authorder->securekey);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...