def processor(self): if self._processor is None: try: processor_class = utils.get_processor(self.method) except: raise ImportError('You have to specify method for Payment instance') self._processor = processor_class(self) return self._processor
def processor(self): if self._processor is None: try: processor_class = utils.get_processor(self.method) except: raise ImportError( 'You have to specify method for Payment instance') self._processor = processor_class(self) return self._processor
def test_utils(self): self.assertTrue(utils.card_types) self.assertIsNone(utils.get_cardtype('42')) self.assertEqual('VISA', utils.get_cardtype('4444333322221111')) self.assertEqual('VISA', utils.get_cardtype('4111111111111111')) self.assertEqual('MASTERCARD', utils.get_cardtype('5555555555554444')) self.assertEqual('MASTERCARD', utils.get_cardtype('5454545454545454')) self.assertEqual('SWITCH', utils.get_cardtype('6333333333333333336')) self.assertEqual('AMEX', utils.get_cardtype('343434343434343')) self.assertEqual('DC', utils.get_cardtype('36700102000000')) self.assertEqual('MAESTRO', utils.get_cardtype('6304900017740292441')) self.assertEqual('UNIONPAY', utils.get_cardtype('6225880120625588')) self.assertEqual('UNIONPAY', utils.get_cardtype('6222000200116010778')) gateway = bursar_settings.ACTIVE_GATEWAYS[0][0] self.assertIsInstance(utils.get_processor(gateway)(None), base.BasePaymentProcessor) self.assertIsInstance(utils.get_form(gateway)(), forms.Form)