Skip to content

Commit

Permalink
[FIX] payment_ogone: batch files expect ASCII encoding
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bouvyd committed Feb 9, 2016
1 parent ac73871 commit 0948656
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/payment_ogone/models/ogone.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from openerp.tools.translate import _
from pprint import pformat
import time
from unicodedata import normalize
from urllib import urlencode
import urllib2
import urlparse
Expand Down Expand Up @@ -478,7 +479,7 @@ def ogone_create(self, cr, uid, values, context=None):
'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,
Expand Down

0 comments on commit 0948656

Please sign in to comment.