Skip to content

Commit 0ea052d

Browse files
author
ePayco
authored
Merge pull request #6 from epayco/12.0-transaction-in-extra-parameter
[FIX] payment_epayco: send the name of sale order as "invoice".
2 parents 82aff57 + 10652f2 commit 0ea052d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

payment_epayco/models/payment_acquirer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ def epayco_form_generate_values(self, values):
8181
partner_vat = values.get('partner') and values['partner'].vat
8282
base_url = self.env['ir.config_parameter'].get_param('web.base.url')
8383
epayco_tx_values = dict(values)
84+
split_reference = epayco_tx_values.get('reference').split('-')
85+
order = ''
86+
if split_reference:
87+
order = split_reference[0]
8488
epayco_tx_values.update({
8589
'currency_code': values.get('currency') and values[
8690
'currency'].name.lower(),
@@ -96,5 +100,6 @@ def epayco_form_generate_values(self, values):
96100
base_url, EpaycoController._response_url),
97101
'confirmation_url': urls.url_join(
98102
base_url, EpaycoController._confirmation_url),
103+
'order': order,
99104
})
100105
return epayco_tx_values

payment_epayco/models/payment_transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _epayco_form_get_tx_from_data(self, data):
4545
""" Given a data dict coming from ePayco, verify it and
4646
find the related transaction record. """
4747
tx_signature = data.get('x_signature')
48-
tx_reference = data.get('x_id_invoice')
48+
tx_reference = data.get('x_extra1')
4949
if not tx_reference or not tx_signature:
5050
error_msg = 'ePayco: received data with missing reference' \
5151
' (%s) or signature (%s)' % (tx_reference, tx_signature)

payment_epayco/views/payment_epayco_templates.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<input type="hidden" name="country_code" t-att-value="country_code"/>
1616
<input type="hidden" name="epayco_env_test" t-att-value="epayco_env_test"/>
1717
<input type="hidden" name="reference" t-att-value="reference"/>
18+
<input type="hidden" name="order" t-att-value="order"/>
1819
<input type="hidden" name="epayco_lang" t-att-value="epayco_lang"/>
1920
<input type="hidden" name="response_url" t-att-value="response_url"/>
2021
<input type="hidden" name="confirmation_url" t-att-value="confirmation_url"/>
@@ -59,7 +60,8 @@
5960
t-att-data-epayco-amount="amount"
6061
t-att-data-epayco-name="reference"
6162
t-att-data-epayco-description="reference"
62-
t-att-data-epayco-invoice="reference"
63+
t-att-data-epayco-invoice="order"
64+
t-att-data-epayco-extra1="reference"
6365
t-att-data-epayco-currency="currency_code"
6466
t-att-data-epayco-country="country_code"
6567
t-att-data-epayco-external="epayco_checkout_external"
@@ -86,7 +88,8 @@
8688
t-att-data-epayco-tax-base="amount_untaxed"
8789
t-att-data-epayco-name="reference"
8890
t-att-data-epayco-description="reference"
89-
t-att-data-epayco-invoice="reference"
91+
t-att-data-epayco-invoice="order"
92+
t-att-data-epayco-extra1="reference"
9093
t-att-data-epayco-currency="currency_code"
9194
t-att-data-epayco-country="country_code"
9295
t-att-data-epayco-external="epayco_checkout_external"

0 commit comments

Comments
 (0)