[FIX] payment_payulatam: use "Round half to even" method in signature
Steps: - Install l10n_ar, website_sale - Go to Website / Configuration / eCommerce / Payment Acquirers - Install PayUlatam - Edit PayUlatam: - Argentinian credentials: http://developers.payulatam.com/en/web_checkout/sandbox.html - Go to Website / Configuration / Settings - Check Multi-Currencies - Save - Click Currencies - Edit all currencies: - Rates: - Edit or create the current rate: - Rate: 1.000000 - Go to Website / Products / Pricelists - Create an ARS pricelist and make it selectable - Go to Website / Products / Products - Create a product (1): - Sales Price: 15.75 - No taxes - Click "Published On Website" - Select your new ARS pricelist - Add (1) to Cart - Process Checkout - Select PayUlatam - Pay Now - Use this info to process the checkout: http://developers.payulatam.com/en/web_checkout/sandbox.html - Pagar (Pay) - Regresar al sitio de la tienda (Back to the store website) Bug: 500: PayUlatam: invalid sign Explanation: From PayU's documentation: > 2. Response page > Signature validation > In order to get the new value new_value you always should approximate > the TX_VALUE to a decimal, using the rounding method "Round half to > even" http://developers.payulatam.com/en/web_checkout/integration.html opw:2457240 closes odoo/odoo#68816 X-original-commit: 5f703cd92293daa1049cbeced9515b251d69bd02 Signed-off-by: backspac <backspac@users.noreply.github.com>
This commit is contained in:
@@ -50,9 +50,11 @@ class PaymentAcquirer(models.Model):
|
||||
self.payulatam_api_key,
|
||||
self.payulatam_merchant_id,
|
||||
values['referenceCode'],
|
||||
# Observation from the sandbox: PayU Latam is using a rounded value to generate
|
||||
# their signature despite saying otherwise in the doc:
|
||||
# http://developers.payulatam.com/en/web_checkout/integration.html
|
||||
# Section: 2. Response page > Signature validation
|
||||
# PayU Latam use the "Round half to even" rounding method
|
||||
# to generate their signature. This happens to be Python 3's
|
||||
# default rounding method.
|
||||
float_repr(float(values.get('TX_VALUE')), 1),
|
||||
values['currency'],
|
||||
values.get('transactionState'),
|
||||
|
||||
Reference in New Issue
Block a user