diff --git a/app/mercadopago.py b/app/mercadopago.py index 15b46a7..0bfb84a 100644 --- a/app/mercadopago.py +++ b/app/mercadopago.py @@ -85,8 +85,9 @@ class MercadoPagoPayment: body.update(token=method['token'], payment_method_id=method['payment_method_id'], installments=int(method.get('installments', 1)), three_d_secure_mode='optional') - if method.get('issuer_id'): - body['issuer_id'] = method['issuer_id'] + # No issuer_id: Mercado Pago takes the issuer from the card number. + # The form's suggestion was refused for its own test cards + # (10111, "the issuer does not have the BIN configured"). else: raise ValueError('Unsupported payment method') # A PIX retry must return the same code; a new one, after the last diff --git a/tests/test_mercadopago.py b/tests/test_mercadopago.py index 5f749f6..bb4854f 100644 --- a/tests/test_mercadopago.py +++ b/tests/test_mercadopago.py @@ -140,6 +140,9 @@ class MercadoPagoTests(unittest.TestCase): self.assertNotEqual(self.requests[-1].headers['x-idempotency-key'], first_key) self.assertTrue(first_key.startswith('dtf-quote-q-card-')) self.assertEqual(body['three_d_secure_mode'], 'optional') + self.mp.create('q', 1000, {'mail': 'a@example.test', 'cnpj': '11222333000181'}, + {'type': 'card', 'token': 'tok_iss', 'payment_method_id': 'master', 'issuer_id': '24'}) + self.assertNotIn('issuer_id', json.loads(self.requests[-1].content)) self.assertIsNone(self.mp.create('q', 1000, {'mail': 'a@example.test', 'cnpj': '11222333000181'}, {'type': 'card', 'token': 'tok_ghi', 'payment_method_id': 'visa'})['challenge'])