SagePay for 2.4 version

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi Guys,
            Has anyone made SagePay working for 2.4 version,  if yes please can you help me to make it work.  I have upgraded my version 1.9 to 2.4.  Thanks in advance

Rahol
12 years ago
Hi, I just uploaded it to the extensions page. It should appear as soon as it is approved.
12 years ago
carlosmartinezt wrote:
It should appear as soon as it is approved.

https://www.nopcommerce.com/p/400/sagepay-server-integration-iframe-and-redirect-methods.aspx
P.S. Thanks, Carlos!
12 years ago
hi Ya,

I have installed the plugin and I get an error.
Error (INVALID: Simulator cannot find your vendor name in its database. The simulator saw the Vendor Name 'mytestsite')
VPSProtocol=2.23&TxType=PAYMENT&Vendor='mytestsite&VendorTxCode=cbc6976d-9683-4615-838d-1b80a940ee44&Amount=90.00&Currency=GBP&Description=eCommerce+Order+from+'mytestsite&NotificationURL=http%3a%2f%2fmytestsite.co.cc%2fcheckout%2fpaymentinfoPlugins%2fPaymentSagePayServer%2fNotificationPage&BillingSurname=Billy&BillingFirstnames=Jones&BillingAddress1=Test+Street&BillingCity=London&BillingPostCode=12334534&BillingCountry=GB&BillingPhone=1233453&DeliverySurname=Billy&DeliveryFirstnames=Jones&DeliveryAddress1=Test+Street&DeliveryCity=Uxbridge&DeliveryPostCode=12334534&DeliveryCountry=GB&DeliveryPhone=1233453&CustomerEMail=admin%40yourStore.com&AllowGiftAid=0&ApplyAVSCV2=0&Apply3DSecure=0


I am new to this any help / assistance please.
12 years ago
The extension doesn't seem to work unfortunately. Just tried it (v2.3) and got compile error missing IMobileDeviceHelper; and runtime error 'No parameterless constructor defined for this object.'

An error occurred when trying to create a controller of type 'Nop.Plugin.Payments.SagePayServer.Controllers.PaymentSagePayServerController'. Make sure that the controller has a parameterless public constructor.]
12 years ago
after removing the references to 'IMobileDeviceHelper' I did get this plugin to work. However if the author would kindly answer a few queries it would be appreciated.

When using oncepagecheckout and normal profile the responsepage hangs on 'please wait to be redirected....'. I see the info about it one page checkout not using this mode, however can that be changed? Basically my client wants to see the 'sagepay' logo and have the open to complete the transaction on the sagepay site.

Thanks
Sean
12 years ago
Hi Guys,

Should have really asked this question here. Would you have any idea as to why this might be happening with the SagePay plugin:

https://www.nopcommerce.com/boards/t/15998/strange-sagepay-problem.aspx

Thanks
12 years ago
Is it hanging on a page that reads words to the effect, 'your order is being processed please wait to be redirected?' or something similar? Are you using One page checkout?
12 years ago
Hi,

No we are using normal checkout. It is not hanging on this page that you mention. Rather this page, it is called ResponsePage.cshtml in the Sagepay plugin is doing a post:

<form id="confirmorderform" action="@Url.RouteUrl("CheckoutConfirm")" method="post" target="_parent">
            <p>
                Your order is being processed...</p>
            <p class="lbLoading" style="background-repeat: no-repeat; min-height: 40px;">
                Please wait while you are redirected to the completion page.</p>
        </form>
                                        
        <script type="text/javascript">
            $('#confirmorderform').submit();
        </script>


to the CheckoutController.ConfirmOrder action. When it goes to the controller it hits this code:

var cart = _workContext.CurrentCustomer.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList();
            if (cart.Count == 0)
            {
                return RedirectToRoute("ShoppingCart");
            }


And the cart.Count is equal to 0, there are no items in the user shopping cart, because the CurrentCustomer has been lost and I believe it is because the session has been lost.
The strange thing is that this happens only from time to time. Maybe it has to do with the browser, maybe an older browser like IE 6 will lose the session when there is an IFrame.
But the most important thing is that in the SagePay Plugin the PaymentSagePayServerController.ResponsePage action has this comment:

/// <summary>
        /// Action performed right after Sage pay Redirects from the Notification page. **It does not validate the session (if inside an iframe)
        /// </summary>
        /// <returns></returns>

Thanks
12 years ago
7Spikes wrote:
Hi,

No we are using normal checkout. It is not hanging on this page that you mention. Rather this page, it is called ResponsePage.cshtml in the Sagepay plugin is doing a post:

<form id="confirmorderform" action="@Url.RouteUrl("CheckoutConfirm")" method="post" target="_parent">
            <p>
                Your order is being processed...</p>
            <p class="lbLoading" style="background-repeat: no-repeat; min-height: 40px;">
                Please wait while you are redirected to the completion page.</p>
        </form>
                                        
        <script type="text/javascript">
            $('#confirmorderform').submit();
        </script>


to the CheckoutController.ConfirmOrder action. When it goes to the controller it hits this code:

var cart = _workContext.CurrentCustomer.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList();
            if (cart.Count == 0)
            {
                return RedirectToRoute("ShoppingCart");
            }


And the cart.Count is equal to 0, there are no items in the user shopping cart, because the CurrentCustomer has been lost and I believe it is because the session has been lost.
The strange thing is that this happens only from time to time. Maybe it has to do with the browser, maybe an older browser like IE 6 will lose the session when there is an IFrame.
But the most important thing is that in the SagePay Plugin the PaymentSagePayServerController.ResponsePage action has this comment:

/// <summary>
        /// Action performed right after Sage pay Redirects from the Notification page. **It does not validate the session (if inside an iframe)
        /// </summary>
        /// <returns></returns>

Thanks



By reading your code, it seems like you are using an old version of the plugin which had the problem of not keeping the session becuase it was automatically redirecting to the order confirmation:
 $('#confirmorderform').submit();


Make sure the view ResponsePage.cshtml is the correct one. It should have:


<script type="text/javascript">
                $('#PaymentInfoForm').submit();
            </script>


The plugin now posts to the PaymentInfo action which stores the payment info session and then redirects to the Confirm action (for a user to pres the button to confirm the order).

Also, if even updating the plugin does not work, it is safer to use a multiple page checkout.

I must also mention, that the plugin was well tested in NopCommerce 2.4. Versions 2.3 and 2.2 should work but a few references to the mobileDevice helper have to be removed.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.