Permalink
Browse files

[IMP] payment,account_payment,sale_payment,website_quote,website_sale…

…: added kwargs in _create_payment_transaction and s2s_do_transaction, as cvc code need while creating charge in payment.transaction instead of payment.token

This commit is related to Task ID 1826303
  • Loading branch information...
nla-odoo authored and tivisse committed Jun 6, 2018
1 parent d93c8df commit 73f901cff5f64d687b8cf7ffb27b4692afcc88e4
@@ -38,7 +38,7 @@ def invoice_pay_form(self, acquirer_id, invoice_id, save_token=False, access_tok
if save_token:
vals['type'] = 'form_save'

transaction = invoice_sudo._create_payment_transaction(vals)
transaction = invoice_sudo._create_payment_transaction(vals, **kwargs)
PaymentProcessing.add_payment_transaction(transaction)

return transaction.render_invoice_button(
@@ -80,7 +80,7 @@ def invoice_pay_token(self, invoice_id, pm_id=None, **kwargs):
'return_url': _build_url_w_params(success_url, params),
}

tx = invoice_sudo._create_payment_transaction(vals)
tx = invoice_sudo._create_payment_transaction(vals, **kwargs)
PaymentProcessing.add_payment_transaction(tx)

params['success'] = 'pay_invoice'
@@ -24,7 +24,7 @@ def get_portal_last_transaction(self):
return self.transaction_ids.get_last_transaction()

@api.multi
def _create_payment_transaction(self, vals):
def _create_payment_transaction(self, vals, **kwargs):
'''Similar to self.env['payment.transaction'].create(vals) but the values are filled with the
current invoices fields (e.g. the partner or the currency).
:param vals: The values to create a new payment.transaction.
@@ -85,7 +85,7 @@ def _create_payment_transaction(self, vals):

# Process directly if payment_token
if transaction.payment_token_id:
transaction.s2s_do_transaction()
transaction.s2s_do_transaction(**kwargs)

return transaction

@@ -49,7 +49,7 @@ def _prepare_payment_transaction_vals(self):
}

@api.multi
def _create_payment_transaction(self, vals=None):
def _create_payment_transaction(self, vals=None, **kwargs):
for pay in self:
if pay.payment_transaction_id:
raise ValidationError(_('A payment transaction already exists.'))
@@ -284,7 +284,7 @@ def payment_transaction_token(self, acquirer_id, order_id, save_token=False, acc
'return_url': order.get_portal_url(),
}

transaction = order._create_payment_transaction(vals)
transaction = order._create_payment_transaction(vals, **kwargs)
PaymentProcessing.add_payment_transaction(transaction)
return transaction.render_sale_button(
order,
@@ -317,6 +317,6 @@ def payment_token(self, order_id, pm_id=None, **kwargs):
'return_url': order.get_portal_url(),
}

tx = order._create_payment_transaction(vals)
tx = order._create_payment_transaction(vals, **kwargs)
PaymentProcessing.add_payment_transaction(tx)
return request.redirect('/payment/process')
@@ -766,7 +766,7 @@ def _notify_get_groups(self, message, groups):
return groups

@api.multi
def _create_payment_transaction(self, vals):
def _create_payment_transaction(self, vals, **kwargs):
'''Similar to self.env['payment.transaction'].create(vals) but the values are filled with the
current sales orders fields (e.g. the partner or the currency).
:param vals: The values to create a new payment.transaction.
@@ -827,7 +827,7 @@ def _create_payment_transaction(self, vals):

# Process directly if payment_token
if transaction.payment_token_id:
transaction.s2s_do_transaction()
transaction.s2s_do_transaction(**kwargs)

return transaction

@@ -891,7 +891,7 @@ def payment_transaction(self, acquirer_id, save_token=False, so_id=None, access_
if token:
vals['payment_token_id'] = int(token)

transaction = order._create_payment_transaction(vals)
transaction = order._create_payment_transaction(vals, **kwargs)

# store the new transaction into the transaction list and if there's an old one, we remove it
# until the day the ecommerce supports multiple orders at the same time
@@ -928,7 +928,7 @@ def payment_token(self, pm_id=None, **kwargs):
# Create transaction
vals = {'payment_token_id': pm_id, 'return_url': '/shop/payment/validate'}

tx = order._create_payment_transaction(vals)
tx = order._create_payment_transaction(vals, **kwargs)
PaymentProcessing.add_payment_transaction(tx)
return request.redirect('/payment/process')

0 comments on commit 73f901c

Please sign in to comment.