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
67 stars 55 forks source link

SI: INVALID_PARAMETER_SYNTAX PayPal Payments Pro Generates new errors #484

Closed gnossosp closed 6 months ago

gnossosp commented 7 months ago

Sponsorship

If this request requires additional support (e.g., such as direct email/phone/meeting/development), I have the following interest in helping to sponsor the effot via GitHub Sponsors:

Describe the bug

A clear and concise description of what the bug is.

Software Versions

To Reproduce

Just installed upgrade that fixed format error with PayPal Payments Pro. New error when submitting cart. Public Error: "The payment information you provided was not able to be processed. Please update your payment information and try again."

I've also did a new installation on a separate, clean, instance of DNN (same version) and the site generates same error.

Expected behavior

Should send payment information to PayPal Payments Pro.

Actual behavior

Admin Logs state (in part) ":Padding is invalid and cannot be removed."

Screenshots

If applicable, add screenshots to help explain your problem.

Error log

Note: Debug DLL's
Please replace the current extension DLL's with the debug DLL's (if these are available with the release) and reproduce the error with the debug DLL's before pasting the error log.

AbsoluteURL:/DesktopModules/Hotcakes/API/mvc/checkout/CleanCreditCard DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke ExceptionGUID:b2a9c6c9-fb96-498f-8f4c-e82584a7cae3 AssemblyVersion: PortalId:-1 UserId:-1 TabId:-1 RawUrl: Referrer: UserAgent: ExceptionHash:eOQD12PytrMyKfLTBSLq2qPQGfQ= Message:Padding is invalid and cannot be removed. StackTrace: at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast) 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

Additional context

Add any other context about the problem here.
I've cleared cache, restarted server as well as IIS Application pool and clean browser.

gnossosp commented 7 months ago

Internal Error at Payment Tab

: HCP_PPP_1001 - Unknown Payment Error: Object reference not set to an instance of an object. :: STACKTRACE - Stack Trace at Hotcakes.Payment.Gateways.PayPalPaymentsPro.<>c__DisplayClass13_0.b__0() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Hotcakes.Payment.Gateways.PayPalPaymentsPro.Charge(Transaction t) at Hotcakes.Payment.Gateways.PayPalPaymentsPro.ProcessTransaction(Transaction t)

gnossosp commented 7 months ago

Paypal Log - Appears that comma is still being sent in total. (Transaction works 999.00 or below) Request:{ "intent": "CAPTURE", "payer": { "address": { "address_line_1": "", "address_line_2": "", "admin_area_1": "MAIN TOWN", "admin_area_2": "South Carolina", "country_code": "US", "postal_code": "29621" }, "name": { "given_name": "", "surname": "" } }, "purchase_units": [ { "amount": { "breakdown": { "item_total": { "currency_code": "USD", "value": "5,000.00" } }, "currency_code": "USD", "value": "5,000.00" }, "invoice_id": "2231d1042-5816-4fcd-ba94-a57f7f1e195f", "shipping": { "address": { "address_details": "xxxxxx", "address_line_1": "", "address_line_2": "", "admin_area_1": "South Carolina", "admin_area_2": "ANDERSON", "country_code": "US", "postal_code": "29625" } } } ] }

Response

{ "debug_id": "a7a053aa2fde0", "details": [ { "description": "The value of a field does not conform to the expected format.", "field": "/purchase_units/@reference_id=='default'/amount/value", "issue": "INVALID_PARAMETER_SYNTAX", "location": "body", "value": "xxxxxx" }, { "description": "The value of a field does not conform to the expected format.", "field": "/purchase_units/@reference_id=='default'/amount/breakdown/item_total/value", "issue": "INVALID_PARAMETER_SYNTAX", "location": "body", "value": "xxxxxx" } ], "links": [ { "encType": "xxxxxx", "href": "https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_PARAMETER_SYNTAX", "rel": "information_link" } ], "message": "Request is not well-formed, syntactically incorrect, or violates schema.", "name": "INVALID_REQUEST" }

Response for lower dollar amount: { "create_time": "2023-12-07T12:47:40Z", "id": "7E612833GF5482525", "intent": "CAPTURE", "links": [ { "href": "https://api.sandbox.paypal.com/v2/checkout/orders/7E612833GF5482525", "method": "GET", "rel": "self" }, { "href": "https://www.sandbox.paypal.com/checkoutnow?token=7E612833GF5482525", "method": "GET", "rel": "approve" }, { "href": "https://api.sandbox.paypal.com/v2/checkout/orders/7E612833GF5482525", "method": "PATCH", "rel": "update" }, { "href": "https://api.sandbox.paypal.com/v2/checkout/orders/7E612833GF5482525/capture", "method": "POST", "rel": "capture" } ], "payer": { "address": { "address_line_1": "", "admin_area_1": "MAIN TOWN", "admin_area_2": "South Carolina", "country_code": "US", "postal_code": "29621" }, "name": { "given_name": "", "surname": "" } }, "purchase_units": [ { "amount": { "breakdown": { "item_total": { "currency_code": "USD", "value": "2.00" } }, "currency_code": "USD", "value": "2.00" }, "invoice_id": "30b121dc0-1042-4d8d-a1bd-c00ea2591f36", "payee": { "email_address": "", "merchant_id": "PZPZMXBRQSHT2" }, "reference_id": "default", "shipping": { "address": { "address_line_1": "*****", "admin_area_1": "South Carolina", "admin_area_2": "ANDERSON", "country_code": "US", "postal_code": "29625" } } } ], "status": "CREATED" }

gnossosp commented 7 months ago

OK, I was able to fix this by making additional edits to the RestPaypalApi.cs file that was edited by libanlsilva I am not competent to post those changes here, since I actually have no idea what I am doing. I added a total of 11 references to the formatAmount (a few more than the original) but I have no idea of any unintended consequences . Please Advise.

WillStrohl commented 6 months ago

Hello @gnossosp ... We're taking care of it this time. 😉

gnossosp commented 6 months ago

Thanks. oh and BTW your toot on Example Payment Gateway Project is AWESOME. Even I could do it!