Beispiel #1
0
 def create_test_transaction(items, variants):
     item = {
         "first_name":
         "Donald",
         "last_name":
         "Duck",
         "company":
         "None",
         "email":
         "*****@*****.**",
         "telephone":
         "991234567",
         "mobile":
         "+358991234567",
         "street":
         "1313 Webfoot Walk",
         "postal_code":
         "00000",
         "city":
         "Duckburg",
         "country":
         "US",
         "information":
         "Quack, damn you!",
         "items": [{
             "item_id": items[0].id,
             "variant_id": variants[0][4].id,
             "amount": 1
         }, {
             "item_id": items[2].id,
             "variant_id": variants[2][3].id,
             "amount": 5
         }]
     }
     return create_store_transaction(item)
Beispiel #2
0
 def create_test_transaction(items, variants):
     item = {
         "first_name": "Donald",
         "last_name": "Duck",
         "company": "None",
         "email": "*****@*****.**",
         "telephone": "991234567",
         "mobile": "+358991234567",
         "street": "1313 Webfoot Walk",
         "postal_code": "00000",
         "city": "Duckburg",
         "country": "US",
         "information": "Quack, damn you!",
         "items": [
             {
                 "item_id": items[0].id,
                 "variant_id": variants[0][4].id,
                 "amount": 1
             },
             {
                 "item_id": items[2].id,
                 "variant_id": variants[2][3].id,
                 "amount": 5
             }
         ]
     }
     return create_store_transaction(item)
Beispiel #3
0
    def create_full_started_transaction():
        event = KompomaattiTestData.create_test_event(fake.words(3))
        test_items = []
        for i in range(15 + random.randint(0, 10)):
            item = StoreTestData.create_test_item(fake.words(3), event)
            variants = StoreTestData.create_test_variants(
                item, random.randint(0, 5))
            for variant in variants:
                test_items.append({
                    "item_id": item.id,
                    "variant_id": variant.id,
                    "amount": random.randint(1, 10)
                })
            test_items.append({
                "item_id": item.id,
                "variant_id": None,
                "amount": random.randint(1, 10)
            })

        item = {
            "first_name": fake.first_name(),
            "last_name": fake.last_name(),
            "company": fake.company(),
            "email": fake.email(),
            "telephone": fake.phone_number(),
            "mobile": fake.phone_number(),
            "street": fake.street_address(),
            "postal_code": fake.postcode(),
            "city": fake.city(),
            "country": fake.country_code(),
            "information": fake.sentences(1),
            "items": test_items
        }
        ta = create_store_transaction(item)
        ta.token = uuid.uuid4().hex
        ta.payment_method_name = fake.words(1)
        ta.save()
        return ta
Beispiel #4
0
    def create_full_started_transaction():
        event = KompomaattiTestData.create_test_event(fake.words(3))
        test_items = []
        for i in range(15 + random.randint(0, 10)):
            item = StoreTestData.create_test_item(fake.words(3), event)
            variants = StoreTestData.create_test_variants(item, random.randint(0, 5))
            for variant in variants:
                test_items.append({
                    "item_id": item.id,
                    "variant_id": variant.id,
                    "amount": random.randint(1, 10)
                })
            test_items.append({
                "item_id": item.id,
                "variant_id": None,
                "amount": random.randint(1, 10)
            })

        item = {
            "first_name": fake.first_name(),
            "last_name": fake.last_name(),
            "company": fake.company(),
            "email": fake.email(),
            "telephone": fake.phone_number(),
            "mobile": fake.phone_number(),
            "street": fake.street_address(),
            "postal_code": fake.postcode(),
            "city": fake.city(),
            "country": fake.country_code(),
            "information": fake.sentences(1),
            "items": test_items
        }
        ta = create_store_transaction(item)
        ta.token = uuid.uuid4().hex
        ta.payment_method_name = fake.words(1)
        ta.save()
        return ta
Beispiel #5
0
 def create(self, validated_data):
     return create_store_transaction(validated_data)
Beispiel #6
0
 def create(self, validated_data):
     return create_store_transaction(validated_data)