Beispiel #1
0
    def test_get_devices(self):
        self.clean_domain([CardPaymentDevice])
        self.assertEqual(CardPaymentDevice.get_devices(self.store).count(), 0)
        device = self.create_card_device(u'Cielo')

        devices = list(CardPaymentDevice.get_devices(self.store))
        self.assertEqual(len(devices), 1)
        self.assertEqual(devices[0], device)
Beispiel #2
0
    def test_get_devices(self):
        self.clean_domain([CardPaymentDevice])
        self.assertEquals(CardPaymentDevice.get_devices(self.store).count(), 0)
        device = self.create_card_device(u'Cielo')

        devices = list(CardPaymentDevice.get_devices(self.store))
        self.assertEquals(len(devices), 1)
        self.assertEquals(devices[0], device)
Beispiel #3
0
 def _get_device_values(self):
     devices = CardPaymentDevice.get_devices(self.store).order_by(
         CardPaymentDevice.description)
     # This is used in a int filter, so we must use the id
     values = [(d.description, d.id) for d in devices]
     values.insert(0, (_("Any"), None))
     return values
Beispiel #4
0
 def _get_device_values(self):
     devices = CardPaymentDevice.get_devices(self.store).order_by(
         CardPaymentDevice.description)
     # This is used in a int filter, so we must use the id
     values = [(d.description, d.id) for d in devices]
     values.insert(0, (_("Any"), None))
     return values
Beispiel #5
0
 def _setup_widgets(self):
     """Populate device widgets and set some properties"""
     # Let the user edit provider_id when creating a new one
     self.provider_id.set_property('sensitive', not self.edit_mode)
     self.provider_id.set_property('editable', not self.edit_mode)
     devices = CardPaymentDevice.get_devices(self.store)
     self.default_device.prefill(
         api.for_combo(devices, empty=_(u"No device")))
 def _setup_widgets(self):
     """Populate device widgets and set some properties"""
     # Let the user edit provider_id when creating a new one
     self.provider_id.set_property('sensitive', not self.edit_mode)
     self.provider_id.set_property('editable', not self.edit_mode)
     devices = CardPaymentDevice.get_devices(self.store)
     self.default_device.prefill(api.for_combo(devices,
                                               empty=_(u"No device")))
Beispiel #7
0
    def _setup_widgets(self):
        devices = CardPaymentDevice.get_devices(self.method.store)
        self.card_device.prefill(api.for_combo(devices))

        providers = CreditProvider.get_card_providers(
            self.method.store)
        self.credit_provider.prefill(api.for_combo(providers))

        self._radio_group = None

        for ptype, name in CreditCardData.types.items():
            self._add_card_type(name, ptype)
    def fields(self):
        device_values = api.for_combo(
            CardPaymentDevice.get_devices(self.store))
        provider_values = api.for_combo(
            CreditProvider.get_card_providers(self.store))

        return collections.OrderedDict(
            device=ChoiceField(_('Device'), proxy=True, mandatory=True,
                               values=device_values),
            provider=ChoiceField(_('Provider'), proxy=True, mandatory=True,
                                 values=provider_values),
            auth=TextField(_('Authorization'), proxy=True, mandatory=True)
        )
Beispiel #9
0
    def fields(self):
        device_values = api.for_combo(
            CardPaymentDevice.get_devices(self.store))
        provider_values = api.for_combo(
            CreditProvider.get_card_providers(self.store))

        return collections.OrderedDict(
            device=ChoiceField(_('Device'), proxy=True, mandatory=True,
                               values=device_values),
            provider=ChoiceField(_('Provider'), proxy=True, mandatory=True,
                                 values=provider_values),
            auth=IntegerField(_('Authorization'), proxy=True, mandatory=True)
        )
Beispiel #10
0
 def populate(self):
     devices = CardPaymentDevice.get_devices(self.store)
     return devices.order_by(CardPaymentDevice.description)
 def populate(self):
     devices = CardPaymentDevice.get_devices(self.store)
     return devices.order_by(CardPaymentDevice.description)
 def _setup_widgets(self):
     """ Populate device widgets
     """
     devices = CardPaymentDevice.get_devices(self.store)
     self.default_device.prefill(
         api.for_combo(devices, empty=_(u"No device")))
Beispiel #13
0
 def __init__(self, store, model, visual_mode=None):
     self.fields['device'].values = api.for_combo(
         CardPaymentDevice.get_devices(store))
     self.fields['provider'].values = api.for_combo(
         CreditProvider.get_card_providers(store))
     BaseEditor.__init__(self, store, model)
Beispiel #14
0
 def _setup_widgets(self):
     """ Populate device widgets
     """
     devices = CardPaymentDevice.get_devices(self.store)
     self.default_device.prefill(api.for_combo(devices,
                                               empty=_(u"No device")))
Beispiel #15
0
 def __init__(self, store, model, visual_mode=None):
     self.fields['device'].values = api.for_combo(
         CardPaymentDevice.get_devices(store))
     self.fields['provider'].values = api.for_combo(
         CreditProvider.get_card_providers(store))
     BaseEditor.__init__(self, store, model)