Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil Hodges 338 posts 987 karma points
    Feb 17, 2020 @ 11:00
    Neil Hodges
    0

    Sage Pay VPS Protocol version 2.23 > 3.00

    Hi

    We've set a Tea Commerce site live, the client is saying that some customers are getting timeouts from Sage Pay.

    Sage Pay has said this is due to the VPSProtocol being 2.23 and that they should upgrade to 3.00

    Are we able to upgrade to VPSProtocol 3.00? if so can this be done via a setting in the back office of Tea Commerce or do we have to grab the payment provider code and, change manually and compile into a DLL and add to the project?

    Anyone else done this? Are there extra settings needed or is it a straight swap?

    This link seems to suggest some extra info needs to be sent for version 3.00 - https://www.sagepay.co.uk/support/12/36/upgrading-from-2-23-to-3-00-a-brief-overview

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 17, 2020 @ 11:27
    Matt Brailsford
    0

    Hi Neil,

    Hmm, this sounds like it's a slightly bigger upgrade of the Payment Provider vs just changing a setting to be 3.0.0 as it looks like some fields have changed / added.

    It'll be within here that needs updating https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders.SagePay/SagePay.cs#L56 The protocol version will need updating, and then going through the fields that are setup and make sure these match with the 3.0.0 protocol base on that link.

    If you are up for the challenge, and if it is just some fields that have changed, it shouldn't be too big a task if you wanted to try and update the provider yourself. A PR would be fantastic.

    If not, that's no problem. I'll try to jump onto it as soon as I can.

    Matt

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 17, 2020 @ 11:32
    Matt Brailsford
    0

    PS I've posted this on Twitter to see if anyone has already done the upgrade themselves and whether they have any code they can share.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 18, 2020 @ 09:45
    Matt Brailsford
    0

    Hi Neil

    I've had a quick look through that site and the Server Integration guide and I think it might be possible that changing the VPSProtocol from 2.23 to 3.00 might be all that is needed. The upgrade page you linked to does mention some other field, but this is mostly to do with their From Protocol, but we use their Server Protocol which those don't apply to.

    Looking at the list of fields they need, they do all seem to line up. To investigate fully I will need to look through all the documents and setup a test environment, but if you wanted to try it yourself, you could pull the payment providers repository down, modify the SagePay provider replacing all instances of 2.23 to 3.00, compile and replace the payment providers DLL in your bin folder and then run some test transactions + refunds + cancels + authorize requests and see if things work.

    When compiling the payment providers dll, they do all get compiled individually, so you can either copy over just the ones you are using, or if you use the build script (run the build batch file in the root) it should merge them all together for you.

    Let me know how you get on.

    Matt

  • Neil Hodges 338 posts 987 karma points
    Feb 18, 2020 @ 12:40
    Neil Hodges
    0

    HI Matt

    Sorry, I've not got back to you sooner.

    I'll give it a go and come back to you. Literally swimming in it up to eyelids at the minute with project work.

    Soon as I get a free half-hour I'll test this and let you know the results.

  • Neil Hodges 338 posts 987 karma points
    Mar 11, 2020 @ 17:36
    Neil Hodges
    0

    HI Matt

    Finally got some time to have a play around with this.

    Ive downloaded the PaymentProviders as a zip, opened up the .sln

    Changed the instances for 2.23 to 3.00 where ever its mentioned.

    Rebuilt the solution.

    Grabbed the DLL TeaCommerce.PaymentProviders.SagePay.dll from > \Tea-Commerce-Payment-Providers-master\Tea-Commerce-Payment-Providers-master\Source\TeaCommerce.PaymentProviders.SagePay\bin\Debug

    and then added it to my Bin folder.

    I've checked out on the site using the SagePay Sandbox and ngrok and it sends me to the 2.23 version of Sage Pay still. That's if what I've done above is correct?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Mar 11, 2020 @ 19:53
    Matt Brailsford
    0

    Do you still have a TeaCommerce.PaymentProviders.dll in your bin folder? If so, I’m guessing it’s using the old one in there instead.

    If you change the name of the replacement provider class and in the PaymentProviderAttribute, compile, deploy, then switch the payment method in the back office to use this new one, that should work.

  • Neil Hodges 338 posts 987 karma points
    Mar 12, 2020 @ 09:24
    Neil Hodges
    0

    Ah yep that got it, Removed the TeaCommerce.PaymentProviders.dll

    I made sure the new SagePay DLL was in my Bin folder.

    And yep the new Sage Pay checkout 3.00 now showing :)

    I'll run a few test transactions and test it all works, and report back here.

  • Neil Hodges 338 posts 987 karma points
    Mar 12, 2020 @ 09:51
    Neil Hodges
    0

    Ok, tested with 3.00 changes and it resulted in the dreaded 5006 error

    Server error 5006: Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL
    

    Changed back to 2.23 to double-check it's not ngrok or something silly, but alas I can checkout fine with 2.23 version.

    So changed back to 3.00 to double-check, and again 5006 error.

    Logfile below:

    <args>{}</args></log4net.Error>
     2020-03-12 09:42:22,660 [P19404/D15/T49] WARN  TeaCommerce.PaymentProviders.Classic.SagePay - Sage Pay(CART-172) - Error  in callback - status: ABORT | status details: 2008 : The Transaction timed-out.
     2020-03-12 09:42:22,952 [P19404/D15/T181] INFO  TeaCommerce.PaymentProviders.Classic.SagePay - <log4net.Error>Exception during StringFormat: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. <format>Form:
    VPSProtocol : 3.00
    TxType : PAYMENT
    VendorTxCode : CART-174
    VPSTxId : {22C6F42A-96CE-0E72-B94F-DDEEF4533DE8}
    Status : ABORT
    StatusDetail : 2008 : The Transaction timed-out.
    TxAuthNo : 5073929
    AVSCV2 : SECURITY CODE MATCH ONLY
    AddressResult : NOTMATCHED
    PostCodeResult : NOTMATCHED
    CV2Result : MATCHED
    GiftAid : 0
    3DSecureStatus : NOTCHECKED
    CardType : VISA
    Last4Digits : 0006
    VPSSignature : C244D7BDBE08877A54A33EFE4B291BEA
    DeclineCode : 00
    ExpiryDate : 0221
    BankAuthCode : 999777
    </format><args>{}</args></log4net.Error>
     2020-03-12 09:42:22,952 [P19404/D15/T181] WARN  TeaCommerce.PaymentProviders.Classic.SagePay - Sage Pay(CART-174) - VPSSignature check isn't valid - Calculated signature: 661B89759FEC387D2D231C318A997684 | SagePay VPSSignature: C244D7BDBE08877A54A33EFE4B291BEA
    
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Mar 12, 2020 @ 11:10
    Matt Brailsford
    100

    Ok, according to the inetgration guide here

    https://www.sagepay.co.uk/file/25046/download-document/SERVER_Integration_and_Protocol_Guidelines_270815.pdf?token=hoe1qCabC0zabeKFMZPiisd8AXD2L86xk8OTZWFmJkw
    

    The VPSSignature is made up from the following:

    {VPSTxId }+ VendorTxCode +
    Status + TxAuthNo +
    VendorName + AVSCV2 +
    SecurityKey + AddressResult
    + PostCodeResult +
    CV2Result + GiftAid +
    3DSecureStatus + CAVV +
    AddressStatus + PayerStatus
    + CardType + Last4Digits +
    DeclineCode + ExpiryDate +
    FraudResponse +
    BankAuthCode
    

    So it looks like the md5CheckValue that is created here:

    https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders.SagePay/SagePay.cs#L221

    needs to have DeclineCode + ExpiryDate + FraudResponse + BankAuthCode appended to the end.

    I think you should be able to access those from the Request, so you may just need to add the following onto the md5CheckValue

    md5CheckValue += HttpUtility.UrlDecode(request.Form["DeclineCode"]); 
    md5CheckValue += HttpUtility.UrlDecode(request.Form["ExpiryDate"]);
    md5CheckValue += HttpUtility.UrlDecode(request.Form["FraudResponse"]);
    md5CheckValue += HttpUtility.UrlDecode(request.Form["BankAuthCode"]);
    

    Give that a try and see how you get on

    Matt

  • Neil Hodges 338 posts 987 karma points
    Mar 12, 2020 @ 11:49
    Neil Hodges
    0

    Yep, that got it Matt, works perfectly.

    Thanks once again!!

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Mar 12, 2020 @ 11:52
    Matt Brailsford
    0

    Awesome!

    If you want to submit that as a PR, or just send over the changed files, I'll look to get that updated in the core provider.

    Glad we were able to get it working though 👍

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft