Odoo Help

0

Cart still have products after payment

By
Vincent Gagnon-Coll
on 4/18/16, 4:38 PM 906 views

Hi, 


I am creating a new payment acquirer module for Beanstream Payment Solutions. For reference, I refered to the payment_ogone to have the same strucutre. Everything is working fine exept that the shopping cart do not clear itself and the system still thinks I am editing the same Sale orde because I am getting this error: It is forbidden to modify a sale order which is not in draft status. After the payment, my quote is set to done.

What am I doing wrong ?


def _beanstream_form_validate(self, cr, uid, tx, data, context=None):   
 status = data.get('trnApproved')
 res = {
    'acquirer_reference': data.get('trnId'),
    'beanstream_txn_type': data.get('trnType'),
}
if status == '1':
    _logger.info('Validated Beanstream payment for tx %s: set as done' % (tx.reference))
    res.update(state='done', date_validate=data.get('trnDate', fields.datetime.now()))
    return tx.write(res)
else:
    error = 'Received unrecognized status for Beanstream payment %s: %s, set as error' % (tx.reference, status)
    _logger.info(error)
    res.update(state='error', state_message=error)
    return tx.write(res)



0
Vincent Gagnon-Coll
On 5/25/16, 1:45 PM

Yes, but my problem was in fact related to the route it goes after the gateway processed my payment.


I used a different route and it worked. 


@http.route([    
    '/payment/beanstream/accept', '/payment/beanstream/test/accept',
], type='http', auth='none')

def beanstream_form_feedback(self, **post):
    """ Beanstream contacts using GET, at least for accept """
    _logger.info('Beanstream: entering form_feedback with post data %s', pprint.pformat(post)) # debug
    cr, uid, context = request.cr, SUPERUSER_ID, request.context
    request.registry['payment.transaction'].form_feedback(cr, uid, post, 'beanstream', context=context)
    order = request.registry['sale.order'].search(cr, uid, [('name', '=', post['trnOrderNumber'])])
    order = request.registry['sale.order'].browse(cr, uid, order)
    order.with_context(dict(context, send_email=True)).action_confirm()
    return werkzeug.utils.redirect(post.pop('return_url', '/shop/payment/validate'))
0
Jon Knowles
On 5/25/16, 1:38 PM


I would be extremely interested in using this bean stream payment module, and would gladly pay for it.


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 4/18/16, 4:38 PM
Seen: 906 times
Last updated: 5/26/16, 8:24 AM