Example #1
0
 def process_payment_method(self, form):
     payment_method = form.cleaned_data['payment_method']
     payment_forms = get_payment_forms(payment_method, self.payment_forms)
     if len(payment_forms):
         self.form_list.insert(4, 'Payment', payment_forms[0])
     elif 'Payment' in self.form_list:
         del self.form_list['Payment']
Example #2
0
 def test_get_payments_form_custom(self):
     """
     Test that method can return custom payment forms
     """
     custom_forms = [Mock()] * 3
     with patch('django.conf.settings.PAYMENT_MODULES',
                             {'dummy': 'salest.payments.modules.dummy'}):
         forms_from_module = get_payment_forms('dummy', custom_forms)
         self.assertEqual(custom_forms, forms_from_module)
Example #3
0
    def test_get_payment_forms_method(self):
        """
        Test that method can return forms from module
        """
        with patch('django.conf.settings.PAYMENT_MODULES',
                                {'dummy': 'salest.payments.modules.dummy'}):
            forms_from_module = get_payment_forms('dummy')

            self.assertEquals(forms_from_module, dummy_default_forms)
Example #4
0
    def add_paymet_form(self):
        """
        Add payment for to form wizard
        """
        module_name = self.get_payment_method_name_from_request()
        if module_name:
            self.request.session['module_name'] = module_name
            payment_forms = get_payment_forms(module_name, self.payment_forms)
            forms_count = self.steps.count
            forms_list = {}
            for counter, payment_form in enumerate(payment_forms):
                forms_list.update(
                                {unicode(forms_count + counter): payment_form})

            self.form_list.update(forms_list)