Exemple #1
0
 def test_titleless_salutation_is_stripped(self):
     country = CountryFactory()
     a = ShippingAddress.objects.create(last_name='Barrington',
                                        line1="75 Smith Road",
                                        postcode="N4 8TY",
                                        country=country)
     self.assertEqual("Barrington", a.salutation)
def get_authorizenet_transaction_reponse_xml(transaction_id, basket, data):
    line_item = basket.all_lines()[0]
    line_item_unit_price = line_item.line_price_incl_tax_incl_discounts / line_item.quantity
    transaction_detail_xml = transaction_detail_response_template.format(
        result_code=data.get("result_code"),
        message_code=data.get("message_code"),
        message_text=data.get(" message_text"),
        transaction_id=transaction_id,
        transaction_type="authCaptureTransaction",
        transaction_status="capturedPendingSettlement",
        transaction_response_code=1,
        transaction_response_reason_code=1,
        transaction_response_reason_description="Approval",
        order_invoice_number=basket.order_number,
        auth_amount=unicode(basket.total_incl_tax),
        settle_amount=unicode(basket.total_incl_tax),
        line_item_id=line_item.product.course_id,
        line_item_name=line_item.product.course_id,
        line_item_description=line_item.product.title,
        line_item_quantity=line_item.quantity,
        line_item_unit_price=line_item_unit_price,
        card_number="XXXX1111",
        card_type="Visa",
        first_name="fake_first_name",
        last_name="fake_last_name",
        country=CountryFactory().iso_3166_1_a2)
    return transaction_detail_xml
Exemple #3
0
    def test_needs_country_data(self):
        CountryFactory(iso_3166_1_a2='DE', is_shipping_country=True)

        self.assertFalse(ShippingAddressForm(self.minimal_data).is_valid())

        data = self.minimal_data.copy()
        data['country'] = Country.objects.get(iso_3166_1_a2='GB').pk
        self.assertTrue(ShippingAddressForm(data).is_valid())
    def setUp(self):
        super().setUp()
        self.user = UserFactory()

        LegalEntityAddressFactory(
            legal_entity=LegalEntityFactory(),
            country=CountryFactory(),
        )
Exemple #5
0
    def setUp(self):
        super(TestInvoice, self).setUp()
        self.user = UserFactory()
        self.order = create_order(number='000042', user=self.user)

        LegalEntityAddressFactory(
            legal_entity=LegalEntityFactory(),
            country=CountryFactory(),
        )
 def setUp(self):
     super(TestASignedInUser, self).setUp()
     self.country = CountryFactory(
         name="AUSTRALIA",
         printable_name="Australia",
         iso_3166_1_a2='AU',
         iso_3166_1_a3='AUS',
         iso_3166_1_numeric=36,
     )
Exemple #7
0
 def test_local_phonenumber_invalid_without_country(self):
     # Add another country, so we have two.
     CountryFactory(iso_3166_1_a2='DE', is_shipping_country=True)
     data = self.minimal_data.copy()
     data['phone_number'] = '07 914721389'
     # User hasn't selected a country. Because there are multiple country
     # choices we should not accept the local number.
     form = ShippingAddressForm(data)
     self.assertFalse(form.is_valid())
     self.assertIn('phone_number', form.errors)
Exemple #8
0
    def test_only_accepts_local_phone_number_when_country_matches(self):
        CountryFactory(iso_3166_1_a2='DE', is_shipping_country=True)

        data = self.minimal_data.copy()
        data['phone_number'] = '07 914721389'  # local UK number

        data['country'] = Country.objects.get(iso_3166_1_a2='DE').pk
        self.assertFalse(ShippingAddressForm(data).is_valid())

        data['country'] = Country.objects.get(iso_3166_1_a2='GB').pk
        self.assertTrue(ShippingAddressForm(data).is_valid())
Exemple #9
0
 def test_keeps_country_field(self):
     CountryFactory(iso_3166_1_a2='DE', is_shipping_country=True)
     self.assertTrue('country' in ShippingAddressForm().fields)
Exemple #10
0
 def setUp(self):
     CountryFactory(iso_3166_1_a2='GB', is_shipping_country=True)