Would you share this
Payment Module Error
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: Payment Module Error
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Payment Module Error
Sure - I'll look for it, next time I'm on my PC.
//Daniel
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Payment Module Error
I could only find the draft for OSC 2.3:
For the Phoenix-shops, an update to the payment module fixed it, and I'm afraid I didn't keep the solutions for them around (though I might just have put the files somewhere and forgot about it - I'm still trying to find the right way to organise these kind of things, which means everything is rather messy
)
//Daniel
Code: Select all
//Fix return from Mobilepay - can be hooked in Phoenix using SiteWide-hook
$cart_QuickPay_ID = $_GET['cart_QuickPay_ID'];
$order_id = substr($cart_QuickPay_ID, strpos($cart_QuickPay_ID, '-') + 1);
if( !tep_session_is_registered('customer_id') && isset($_GET['cart_QuickPay_ID'])) {
//Find the right customer
$customer_info_query = tep_db_query("select c.customers_id, c.customers_firstname, o.customers_email_address, o.delivery_name, o.payment_method, ot.title, ot.value from customers c, orders o, orders_total ot where orders_id = '" . (int)$order_id . "' AND c.customers_email_address = o.customers_email_address AND ot.class = 'ot_shipping'");
$customer_info = tep_db_fetch_array($customer_info_query);
$customer_id = $customer_info['customers_id'];
tep_session_register('customer_id');
$customer_first_name = $customer_info['customers_firstname'];
tep_session_register('customer_first_name');
$shipping = $customer_info['delivery_name'];
tep_session_register('shipping');
$sendto = $customer_default_address_id;
tep_session_register('sendto');
$shipping = array('id' => 1,
'title' => $customer_info['title'],
'cost' => $customer_info['value']);
tep_session_register('shipping');
$payment = $customer_info['payment_method'];
tep_session_register('payment');
$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
//Restore cart contents
$cart->restore_contents();
$cartID = $cart->cartID;
tep_session_register('cartID');
}
//End fix return from Mobilepay//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: Payment Module Error
Thank you,Kofod95 wrote: ↑Sat Jul 09, 2022 10:31 am I could only find the draft for OSC 2.3:
For the Phoenix-shops, an update to the payment module fixed it, and I'm afraid I didn't keep the solutions for them around (though I might just have put the files somewhere and forgot about it - I'm still trying to find the right way to organise these kind of things, which means everything is rather messyCode: Select all
//Fix return from Mobilepay - can be hooked in Phoenix using SiteWide-hook $cart_QuickPay_ID = $_GET['cart_QuickPay_ID']; $order_id = substr($cart_QuickPay_ID, strpos($cart_QuickPay_ID, '-') + 1); if( !tep_session_is_registered('customer_id') && isset($_GET['cart_QuickPay_ID'])) { //Find the right customer $customer_info_query = tep_db_query("select c.customers_id, c.customers_firstname, o.customers_email_address, o.delivery_name, o.payment_method, ot.title, ot.value from customers c, orders o, orders_total ot where orders_id = '" . (int)$order_id . "' AND c.customers_email_address = o.customers_email_address AND ot.class = 'ot_shipping'"); $customer_info = tep_db_fetch_array($customer_info_query); $customer_id = $customer_info['customers_id']; tep_session_register('customer_id'); $customer_first_name = $customer_info['customers_firstname']; tep_session_register('customer_first_name'); $shipping = $customer_info['delivery_name']; tep_session_register('shipping'); $sendto = $customer_default_address_id; tep_session_register('sendto'); $shipping = array('id' => 1, 'title' => $customer_info['title'], 'cost' => $customer_info['value']); tep_session_register('shipping'); $payment = $customer_info['payment_method']; tep_session_register('payment'); $sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand()); //Restore cart contents $cart->restore_contents(); $cartID = $cart->cartID; tep_session_register('cartID'); } //End fix return from Mobilepay)
//Daniel
As far as I see the quick pay module saves the order before leaving the shop.
Sagepay direct, which is the module I have the issue, does not save the order to the database before the external 3D check. So this approach will not work for me. Or did you add to the Quickpay module the code to save the order?
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Payment Module Error
When I look at SagePay Direct, line 356, I see
Code: Select all
'VendorData' => 'Customer ID ' . $_SESSION['customer_id'],-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: Payment Module Error
Thank you Matt,
It’s an early EDGE or even Gold/pre Gold BS 3 version.
Before I do a live store test, if I add the session id to the redirect URL in ext\modules\payment\sage_pay\redirect.php:
and in checkout process.php at the top:
Could this work?
It’s an early EDGE or even Gold/pre Gold BS 3 version.
Before I do a live store test, if I add the session id to the redirect URL in ext\modules\payment\sage_pay\redirect.php:
Code: Select all
$redirect_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=3D&session=' . session_id(), 'SSL');
Code: Select all
include('includes/application_top.php');
if ( isset($_GET['check']) && $_GET['check'] == '3D' && isset($_GET['session']) ) {
$GLOBALS['SID'] = $_GET['session'];
tep_session_recreate();
}
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Payment Module Error
Have you tried just with Force Cookies turned off? Then it shouldn't need special code to recreate the session. Or with Force Cookies on, edit application_top.php (around line 151) to something like with You might have to edit tep_session_start too.
Code: Select all
$redirect_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, session_name() . '=' . session_id(), 'SSL');
Code: Select all
// set the session ID if it exists
if (( SESSION_FORCE_COOKIE_USE == 'False' ) || (isset($_GET['check']) && ('3D' == $_GET['check']))) {Code: Select all
$redirect_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=3D&' . session_name() . '=' . session_id(), 'SSL');-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: Payment Module Error
I did some simulated tests. Adding the session to the return URL works with Force Cookies turned off. But the other modification with Force Cookies turned on, redirects to index.php because of this check in session.php:
Meanwhile, if this problem persists in actual Phoenix 1.0.8.16 Pro with sagepay direct, it would be good to address it in core?
Code: Select all
if ($sane_session_id == false) {
tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));
}
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Payment Module Error
Though this may no longer be relevant, you are correct: QuickPay saves the order by default with a "Preparing"-status before leaving the shop. It also adds a link to the payment window in admin, that the shop owner can send to the customer, to help them make the payment.raiwa wrote: ↑Sat Jul 09, 2022 5:33 pm As far as I see the quick pay module saves the order before leaving the shop.
Sagepay direct, which is the module I have the issue, does not save the order to the database before the external 3D check. So this approach will not work for me. Or did you add to the Quickpay module the code to save the order?
I would think the suggestion @ecartz brought is better anyway, but saving the order before leaving the shop, but without clearing the cart until the payment is authorized has come in handy at times.
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide