summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerghei Mihai <smihai@entrouvert.com>2020-11-17 15:39:27 (GMT)
committerSerghei Mihai <smihai@entrouvert.com>2020-11-18 08:16:55 (GMT)
commitb35d048030b0e165c3261601121c4c9bdddf2f03 (patch)
tree320b0076c7b60d876ec297a413d127edc1d51375
parenteea999db67bc6c07693a52872e6f2c5e6a2b6dc1 (diff)
downloadeopayment-b35d048030b0e165c3261601121c4c9bdddf2f03.zip
eopayment-b35d048030b0e165c3261601121c4c9bdddf2f03.tar.gz
eopayment-b35d048030b0e165c3261601121c4c9bdddf2f03.tar.bz2
paybox: accept 3 digits in rang number(#48619)wip/48619-paybox-rang-accept-3-digits
-rw-r--r--eopayment/paybox.py4
-rw-r--r--tests/test_paybox.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/eopayment/paybox.py b/eopayment/paybox.py
index fdb7322..a9f921d 100644
--- a/eopayment/paybox.py
+++ b/eopayment/paybox.py
@@ -240,7 +240,7 @@ class Payment(PaymentCommon):
'caption': _('Numéro de rang'),
'required': True,
'validation': lambda x: isinstance(x, six.string_types)
- and x.isdigit() and len(x) == 2,
+ and x.isdigit() and len(x) == 3,
},
{
'name': 'identifiant',
@@ -312,7 +312,7 @@ class Payment(PaymentCommon):
def request(self, amount, email, name=None, orderid=None, manual_validation=None, **kwargs):
d = OrderedDict()
d['PBX_SITE'] = force_text(self.site)
- d['PBX_RANG'] = force_text(self.rang).strip()[-2:]
+ d['PBX_RANG'] = force_text(self.rang).strip()[-3:]
d['PBX_IDENTIFIANT'] = force_text(self.identifiant)
d['PBX_TOTAL'] = self.clean_amount(amount)
d['PBX_DEVISE'] = force_text(self.devise)
diff --git a/tests/test_paybox.py b/tests/test_paybox.py
index 750dc37..7beb3f9 100644
--- a/tests/test_paybox.py
+++ b/tests/test_paybox.py
@@ -93,7 +93,7 @@ class PayboxTests(TestCase):
self.assertEqual(root.attrib['method'], 'POST')
self.assertEqual(root.attrib['action'], paybox.URLS['test'])
expected_form_values = {
- 'PBX_RANG': '01',
+ 'PBX_RANG': '001',
'PBX_SITE': '12345678',
'PBX_IDENTIFIANT': '12345678',
'PBX_RETOUR': (
@@ -108,9 +108,9 @@ class PayboxTests(TestCase):
'PBX_DEVISE': '978',
'PBX_HASH': 'SHA512',
'PBX_HMAC': (
- '300CFBDFF0454403BE7FEA11B9714C6B134294313E'
- '7A052580F517BFCB117FB6A175C2E0DC81F6137D95'
- '8FCA3CC4F8F1883A479C474C3A7B871CCA2DB8D033D9'
+ 'A9F561A6EA79390F1741A6B72872470BC1A1688E4581'
+ 'F097EC80B99D2038413AB350F2F5429FFA4F8D426D99'
+ 'B72E038164642F6F9BA10D46837EE486EEB944A2'
),
'PBX_ARCHIVAGE': '20160216',
'PBX_REPONDRE_A': 'http://example.com/callback',