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

Fix Issues 479 INVALID_PARAMETER_SYNTAX PayPal Payments Pro #480

Closed libanlsilva closed 7 months ago

libanlsilva commented 7 months ago

Related to Issue

Fixes # 479 SI: INVALID_PARAMETER_SYNTAX PayPal Payments Pro

Description

To solve the issue, add a method called formatAmount to cleanse (remove comma or space separators from) the order amounts before they are sent to the PayPal API. Since that API doesn't accept values with separators such as commas or spaces.

How Has This Been Tested?

To test that the update fixed the issue, I created a clean DNN solution in version 09.13.00, compiled it, and generated a Hotcakes installer with the applied changes. Then, I conducted the initial store setup. I added a product with an amount greater than 999.00, specifically 1200.00.

Afterwards, I configured the payment methods, choosing PayPal, and updated the Sandbox Mode settings by entering the API Client Id and API Secret. Following that, I placed an order for the product priced above 999.00 (1200.00), and everything went smoothly.

Screenshots (if appropriate):

Types of changes

Checklist:

gnossosp commented 7 months ago

Sorry. Still not working. I've posted a new PR with reference to this, but not sure if that is appropriate. Please delete if necessary. $5,000.00 - Credit Card Charge 12/8/2023 8:28:51 AM FAILED Visa xxxx-xxxx-xxxx-3526 exp: 12/2028 :: HCP_PPP_1001 - Unknown Payment Error: {"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"d0b5bcdf7254f","details":[{"field":"/purchase_units/@reference_id=='default'/amount/value","value":"5,000.00","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='default'/amount/breakdown/item_total/value","value":"5,000.00","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."}],"links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-