HotcakesCommerce / hotcakes-commerce-core

The core of the e-commerce part of the overall solution. This is an ecommerce shopping cart solution built on top of the DNN (DotNetNuke) CMS. Anyone can do commerce online now!
https://mmmcommerce.com
MIT License
68 stars 55 forks source link

Checkout CleanCreditCard error after 3.6.0 upgrade #385

Closed puresystems closed 2 years ago

puresystems commented 2 years ago

Describe the bug

Using Credit card checkout, on submitting the payment form, the form says the payment failed and asks for it to be entered again, in the DNN log we see an error.

Software Versions

To Reproduce

Steps to reproduce the behavior:

  1. Add a product to the basked and go to checkout
  2. Select Credit Card payment and enter details
  3. Click Pay Now to complete purchase
  4. See error

Expected behavior

Payment is processed

Actual behavior

The payment displays the standard Payment Failed message and ask the user to retry.

Error log

AbsoluteURL:/DesktopModules/Hotcakes/API/mvc/checkout/CleanCreditCard DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke ExceptionGUID:31024cdc-1c1b-4bba-aa4a-1632ce5aa085 AssemblyVersion: PortalId:-1 UserId:-1 TabId:-1 RawUrl: Referrer: UserAgent: ExceptionHash:WHIS170eMrXhMvqDJ9fo2XqaVHk= Message:Length of the data to decrypt is invalid. StackTrace: at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) at System.Security.Cryptography.CryptoStream.FlushFinalBlock() at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamReader.Dispose(Boolean disposing) at System.IO.TextReader.Dispose() at Hotcakes.Modules.Core.Controllers.CheckoutController.DecryptStringFromBytes(Byte[] cipherText, Byte[] key, Byte[] iv) InnerMessage: InnerStackTrace: Source:mscorlib FileName: FileLineNumber:0 FileColumnNumber:0 Method:

Additional context

We had upgraded HC from 3.2.3 to 3.6.0, previously it was working. I wonder if there is something out of date which we've missed when upgrading which has broken something.

WillStrohl commented 2 years ago

We didn't see this during testing. Which payment method(s) are you seeing this with?

puresystems commented 2 years ago

So the Payment Method is set to Credit Card.

Credit Card options:

I'm sure that this would have been spotted by now which makes me wonder if something (dll) is out of date possibly.

mtrutledge commented 2 years ago

Check your Hotcakes View. The Checkout.js Script was updated to encrypt the credit card number in transit. If you have customized your view set you will need to update your views. I was seeing this same error because my Checkout.js in my custom view set was not updated. Start at this line: https://github.com/HotcakesCommerce/hotcakes-commerce-core/blob/d99611e477e2e2d0f82df99e1e65678504c162fb/Website/Portals/_default/HotcakesViews/_default/Scripts/Checkout.js#L19

Also make sure your store received an AES encryption key in the Store Settings table in the database.

puresystems commented 2 years ago

Thanks! Missed the js updates from the HC View, that solved the problem.

mtrutledge commented 2 years ago

@puresystems Awesome. Glad to hear that worked. Can you close this issue? Or is that something @WillStrohl will have to do?