Skip to content
Snippets Groups Projects
Commit a5e8f227 authored by Damien Bouvy's avatar Damien Bouvy
Browse files

[FIX] payment_ogone: s2s response should generate payment method

Ogone responses comes from direct s2s calls or form feedback;
not necessarily in that order. The behaviour of the system should
be the same in both cases. This commit add payment_methode creation
when a s2s response contains the necessary information, juste like
the form feedback methods.

Ideally these methods should be merged to share the same code,
this will be done in master (v10).
parent 36e681cb
No related branches found
No related tags found
No related merge requests found
......@@ -264,7 +264,7 @@ class PaymentTxOgone(osv.Model):
'acquirer_id': tx.acquirer_id.id,
'acquirer_ref': alias
})
tx.partner_reference = alias
tx.write({'payment_method_id': ref})
return tx
......@@ -294,7 +294,7 @@ class PaymentTxOgone(osv.Model):
'date_validate': datetime.datetime.strptime(data['TRXDATE'], '%m/%d/%y').strftime(DEFAULT_SERVER_DATE_FORMAT),
'acquirer_reference': data['PAYID'],
}
if data.get('ALIAS') and tx.partner_id and tx.type == 'form_save':
if data.get('ALIAS') and tx.partner_id and tx.type == 'form_save' and not tx.payment_method_id:
pm_id = self.pool['payment.method'].create(cr, uid, {
'partner_id': tx.partner_id.id,
'acquirer_id': tx.acquirer_id.id,
......@@ -399,6 +399,14 @@ class PaymentTxOgone(osv.Model):
'date_validate': datetime.date.today().strftime(DEFAULT_SERVER_DATE_FORMAT),
'acquirer_reference': tree.get('PAYID'),
})
if tree.get('ALIAS') and tx.partner_id and tx.type == 'form_save' and not tx.payment_method_id:
pm = tx.env['payment.method'].create({
'partner_id': tx.partner_id.id,
'acquirer_id': tx.acquirer_id.id,
'acquirer_ref': tree.get('ALIAS'),
'name': tree.get('CARDNO'),
})
tx.write({'payment_method_id': pm.id})
if tx.callback_eval:
safe_eval(tx.callback_eval, {'self': tx})
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment