[FIX] payment_ogone: batch files expect ASCII encoding

When registering a payment method using batch, ogone
expects an ascii file. To avoid stipping characters
like they do on Friday the 13th, let's use a normalize
function to strip diacritics more or less properly.

See https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/batch
This commit is contained in:
Damien Bouvy
2016-02-09 09:26:41 +01:00
parent ac73871ee2
commit 0948656a67
+2 -1
View File
@@ -7,6 +7,7 @@ from lxml import etree, objectify
from openerp.tools.translate import _
from pprint import pformat
import time
from unicodedata import normalize
from urllib import urlencode
import urllib2
import urlparse
@@ -478,7 +479,7 @@ class PaymentMethod(osv.Model):
'TRANSACTION_CODE': 'ATR',
'OPERATION': 'SAL',
'NB_PAYMENTS': 1, # even if we do not actually have any payment, ogone want it to not be 0
'FILE': line,
'FILE': normalize('NFKD', line).encode('ascii','ignore'), # Ogone Batch must be ASCII only
'REPLY_TYPE': 'XML',
'PSPID': acquirer.ogone_pspid,
'USERID': acquirer.ogone_userid,