当前位置: 首页>>代码示例>>Python>>正文


Python BasketishOrderSource.status方法代码示例

本文整理汇总了Python中shuup_tests.utils.basketish_order_source.BasketishOrderSource.status方法的典型用法代码示例。如果您正苦于以下问题:Python BasketishOrderSource.status方法的具体用法?Python BasketishOrderSource.status怎么用?Python BasketishOrderSource.status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shuup_tests.utils.basketish_order_source.BasketishOrderSource的用法示例。


在下文中一共展示了BasketishOrderSource.status方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: seed_source

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def seed_source(user, shop):
    source = BasketishOrderSource(shop)
    source.status = get_initial_order_status()
    source.customer = get_person_contact(user)
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()
    return source
开发者ID:gurch101,项目名称:shuup,代码行数:9,代码来源:test_order_source.py

示例2: get_order_and_source

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def get_order_and_source(admin_user, product):
    # create original source to tamper with
    source = BasketishOrderSource(get_default_shop())
    source.status = get_initial_order_status()
    source.billing_address = MutableAddress.objects.create(name="Original Billing")
    source.shipping_address = MutableAddress.objects.create(name="Original Shipping")
    source.customer = get_person_contact(admin_user)
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()
    source.add_line(
        type=OrderLineType.PRODUCT,
        product=product,
        supplier=get_default_supplier(),
        quantity=1,
        base_unit_price=source.create_price(10),
    )
    source.add_line(
        type=OrderLineType.OTHER,
        quantity=1,
        base_unit_price=source.create_price(10),
        require_verification=True,
    )
    assert len(source.get_lines()) == 2
    source.creator = admin_user
    creator = OrderCreator()
    order = creator.create_order(source)
    return order, source
开发者ID:NamiStudio,项目名称:shuup,代码行数:29,代码来源:test_order_modifier.py

示例3: _seed_source

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def _seed_source(shop, user):
    source = BasketishOrderSource(shop)
    billing_address = get_address()
    shipping_address = get_address(name="Test street")
    source.status = get_initial_order_status()
    source.billing_address = billing_address
    source.shipping_address = shipping_address
    source.customer = get_person_contact(user)
    return source
开发者ID:gurch101,项目名称:shuup,代码行数:11,代码来源:test_order_total_behavior_component.py

示例4: seed_source

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def seed_source(user):
    source = BasketishOrderSource(get_default_shop())
    billing_address = get_address()
    shipping_address = get_address(name="Shippy Doge")
    source.status = get_initial_order_status()
    source.billing_address = billing_address
    source.shipping_address = shipping_address
    source.customer = get_person_contact(user)
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()
    assert source.payment_method_id == get_default_payment_method().id
    assert source.shipping_method_id == get_default_shipping_method().id
    return source
开发者ID:suutari,项目名称:shoop,代码行数:15,代码来源:test_order_creator.py

示例5: test_order_creator_parent_linkage

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def test_order_creator_parent_linkage():
    """
    Test OrderCreator creates parent links from OrderSource.
    """
    source = BasketishOrderSource(get_default_shop())
    source.status = get_initial_order_status()
    source.add_line(line_id="LINE1", type=OrderLineType.OTHER, quantity=1, sku="parent", text="Parent line")
    source.add_line(
        line_id="LINE1.1",
        parent_line_id="LINE1",
        type=OrderLineType.OTHER,
        quantity=1,
        sku="child1.1",
        text="Child line 1.1",
    )
    source.add_line(
        line_id="LINE1.2",
        parent_line_id="LINE1",
        type=OrderLineType.OTHER,
        quantity=1,
        sku="child1.2",
        text="Child line 1.2",
    )
    source.add_line(
        line_id="LINE1.2.1",
        parent_line_id="LINE1.2",
        type=OrderLineType.OTHER,
        quantity=1,
        sku="child1.2.1",
        text="Child line 1.2.1",
    )
    source.add_line(
        line_id="LINE1.3",
        parent_line_id="LINE1",
        type=OrderLineType.OTHER,
        quantity=1,
        sku="child1.3",
        text="Child line 1.3",
    )
    order = OrderCreator().create_order(source)

    lines = [prettify_order_line(line) for line in order.lines.all()]
    assert lines == [
        "#0 1 x parent",
        "#1   1 x child1.1, child of #0",
        "#2   1 x child1.2, child of #0",
        "#3     1 x child1.2.1, child of #2",
        "#4   1 x child1.3, child of #0",
    ]
开发者ID:shawnadelic,项目名称:shuup,代码行数:51,代码来源:test_product_packages.py

示例6: get_order_source_with_a_package

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def get_order_source_with_a_package():
    package_product = get_package_product()

    source = BasketishOrderSource(get_default_shop())
    source.add_line(
        type=OrderLineType.PRODUCT,
        product=package_product,
        supplier=get_default_supplier(),
        quantity=10,
        base_unit_price=source.create_price(10),
        sku=package_product.sku,
        text=package_product.name,
    )

    source.status = get_initial_order_status()
    return source
开发者ID:ahmadzai,项目名称:shuup,代码行数:18,代码来源:test_product_packages.py

示例7: _get_custom_order

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def _get_custom_order(regular_user, **kwargs):
    prices_include_tax = kwargs.pop("prices_include_tax", False)
    include_basket_campaign = kwargs.pop("include_basket_campaign", False)
    include_catalog_campaign = kwargs.pop("include_catalog_campaign", False)

    shop = get_shop(prices_include_tax=prices_include_tax)
    supplier = get_simple_supplier()

    if include_basket_campaign:
        _add_basket_campaign(shop)

    if include_catalog_campaign:
        _add_catalog_campaign(shop)
    _add_taxes()

    contact = get_person_contact(regular_user)
    source = BasketishOrderSource(shop)
    source.status = get_initial_order_status()
    source.customer = contact

    ctx = get_pricing_module().get_context_from_data(shop, contact)
    for product_data in _get_product_data():
        quantity = product_data.pop("quantity")
        product = create_product(
            sku=product_data.pop("sku"),
            shop=shop,
            supplier=supplier,
            stock_behavior=StockBehavior.STOCKED,
            tax_class=get_default_tax_class(),
            **product_data)
        shop_product = product.get_shop_instance(shop)
        shop_product.categories.add(get_default_category())
        shop_product.save()
        supplier.adjust_stock(product.id, INITIAL_PRODUCT_QUANTITY)
        pi = product.get_price_info(ctx)
        source.add_line(
            type=OrderLineType.PRODUCT,
            product=product,
            supplier=supplier,
            quantity=quantity,
            base_unit_price=pi.base_unit_price,
            discount_amount=pi.discount_amount
        )

    oc = OrderCreator()
    order = oc.create_order(source)
    return order
开发者ID:suutari-ai,项目名称:shuup,代码行数:49,代码来源:test_order_notifications.py

示例8: test_order_creator_parent_linkage

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def test_order_creator_parent_linkage():
    """
    Test OrderCreator creates parent links from OrderSource.
    """
    source = BasketishOrderSource(get_default_shop())
    source.status = get_initial_order_status()
    source.add_line(
        line_id='LINE1',
        type=OrderLineType.OTHER, quantity=1,
        sku='parent', text='Parent line',
    )
    source.add_line(
        line_id='LINE1.1',
        parent_line_id='LINE1',
        type=OrderLineType.OTHER, quantity=1,
        sku='child1.1', text='Child line 1.1',
    )
    source.add_line(
        line_id='LINE1.2',
        parent_line_id='LINE1',
        type=OrderLineType.OTHER, quantity=1,
        sku='child1.2', text='Child line 1.2',
    )
    source.add_line(
        line_id='LINE1.2.1',
        parent_line_id='LINE1.2',
        type=OrderLineType.OTHER, quantity=1,
        sku='child1.2.1', text='Child line 1.2.1',
    )
    source.add_line(
        line_id='LINE1.3',
        parent_line_id='LINE1',
        type=OrderLineType.OTHER, quantity=1,
        sku='child1.3', text='Child line 1.3',
    )
    order = OrderCreator().create_order(source)

    lines = [prettify_order_line(line) for line in order.lines.all()]
    assert lines == [
        '#0 1 x parent',
        '#1   1 x child1.1, child of #0',
        '#2   1 x child1.2, child of #0',
        '#3     1 x child1.2.1, child of #2',
        '#4   1 x child1.3, child of #0',
    ]
开发者ID:ahmadzai,项目名称:shuup,代码行数:47,代码来源:test_product_packages.py

示例9: seed_source

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def seed_source(shipping_method=None, produce_price=10):
    source = BasketishOrderSource(get_default_shop())
    billing_address = get_address()
    shipping_address = get_address(name="Shippy Doge")
    source.status = get_initial_order_status()
    source.billing_address = billing_address
    source.shipping_address = shipping_address
    source.customer = create_random_person()
    source.payment_method = get_default_payment_method()
    source.shipping_method = shipping_method if shipping_method else get_default_shipping_method()
    source.add_line(
        type=OrderLineType.PRODUCT,
        product=get_default_product(),
        supplier=get_default_supplier(),
        quantity=1,
        base_unit_price=source.create_price(produce_price),
    )
    return source
开发者ID:ruqaiya,项目名称:shuup,代码行数:20,代码来源:test_default_reports.py

示例10: _get_order

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def _get_order(prices_include_tax=False, include_basket_campaign=False, include_catalog_campaign=False):
    shop = get_shop(prices_include_tax=prices_include_tax)
    supplier = get_simple_supplier()

    if include_basket_campaign:
        _add_basket_campaign(shop)

    if include_catalog_campaign:
        _add_catalog_campaign(shop)
    _add_taxes()

    source = BasketishOrderSource(shop)
    source.status = get_initial_order_status()
    ctx = get_pricing_module().get_context_from_data(shop, AnonymousContact())
    for product_data in _get_product_data():
        quantity = product_data.pop("quantity")
        product = create_product(
            sku=product_data.pop("sku"),
            shop=shop,
            supplier=supplier,
            stock_behavior=StockBehavior.STOCKED,
            tax_class=get_default_tax_class(),
            **product_data)
        shop_product = product.get_shop_instance(shop)
        shop_product.categories.add(get_default_category())
        shop_product.save()
        supplier.adjust_stock(product.id, INITIAL_PRODUCT_QUANTITY)
        pi = product.get_price_info(ctx)
        source.add_line(
            type=OrderLineType.PRODUCT,
            product=product,
            supplier=supplier,
            quantity=quantity,
            base_unit_price=pi.base_unit_price,
            discount_amount=pi.discount_amount
        )
    oc = OrderCreator()
    order = oc.create_order(source)
    order.create_payment(Money("1", "EUR"))
    assert not order.has_refunds()
    assert order.can_create_refund()
    assert order.shipping_status == ShippingStatus.NOT_SHIPPED
    assert order.payment_status == PaymentStatus.PARTIALLY_PAID
    return order
开发者ID:gurch101,项目名称:shuup,代码行数:46,代码来源:test_refunds.py

示例11: seed_source

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def seed_source(user, extra_addr=True):
    source = BasketishOrderSource(get_default_shop())
    billing_address = get_address()
    shipping_address = get_address(name="Shippy Doge")

    if extra_addr:
        billing_address.extra = ExtraMutableAddress.from_data(EXTRA_MUTABLE_ADDRESS_1)
    if extra_addr:
        shipping_address.extra = ExtraMutableAddress.from_data(EXTRA_MUTABLE_ADDRESS_2)

    source.status = get_initial_order_status()
    source.billing_address = billing_address
    source.shipping_address = shipping_address
    source.customer = get_person_contact(user)
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()
    assert source.payment_method_id == get_default_payment_method().id
    assert source.shipping_method_id == get_default_shipping_method().id
    return source
开发者ID:rockho-team,项目名称:shuup-br,代码行数:21,代码来源:test_order_creator.py

示例12: get_order_and_source

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def get_order_and_source(admin_user, product, language, language_fallback):
    # create original source to tamper with

    contact = get_person_contact(admin_user)
    contact.language = language
    contact.save()

    assert contact.language == language  # contact language is naive

    source = BasketishOrderSource(get_default_shop())
    source.status = get_initial_order_status()
    source.billing_address = MutableAddress.objects.create(name="Original Billing")
    source.shipping_address = MutableAddress.objects.create(name="Original Shipping")
    source.customer = contact
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()
    source.add_line(
        type=OrderLineType.PRODUCT,
        product=product,
        supplier=get_default_supplier(),
        quantity=1,
        base_unit_price=source.create_price(10),
    )
    source.add_line(
        type=OrderLineType.OTHER,
        quantity=1,
        base_unit_price=source.create_price(10),
        require_verification=True,
    )
    assert len(source.get_lines()) == 2
    source.creator = admin_user

    assert not source._language  # is None because it was not directly assigned
    assert source.language == language_fallback

    creator = OrderCreator()
    order = creator.create_order(source)

    assert order.language == source.language

    return order, source
开发者ID:ruqaiya,项目名称:shuup,代码行数:43,代码来源:test_order_languages.py

示例13: test_broken_order

# 需要导入模块: from shuup_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shuup_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def test_broken_order(admin_user):
    """
    """
    quantities = [44, 23, 65]
    expected = sum(quantities) * 50
    expected_based_on = expected / 1.5

    # Shuup is calculating taxes per line so there will be some "errors"
    expected_based_on = ensure_decimal_places(Decimal("%s" % (expected_based_on + 0.01)))

    shop = get_default_shop()

    supplier = get_default_supplier()
    product1 = create_product("simple-test-product1", shop, supplier, 50)
    product2 = create_product("simple-test-product2", shop, supplier, 50)
    product3 = create_product("simple-test-product3", shop, supplier, 50)

    tax = get_default_tax()

    source = BasketishOrderSource(get_default_shop())
    billing_address = get_address(country="US")
    shipping_address = get_address(name="Test street", country="US")
    source.status = get_initial_order_status()
    source.billing_address = billing_address
    source.shipping_address = shipping_address
    source.customer = create_random_person()
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()

    source.add_line(
        type=OrderLineType.PRODUCT,
        product=product1,
        supplier=get_default_supplier(),
        quantity=quantities[0],
        base_unit_price=source.create_price(50),
    )

    source.add_line(
        type=OrderLineType.PRODUCT,
        product=product2,
        supplier=get_default_supplier(),
        quantity=quantities[1],
        base_unit_price=source.create_price(50),
    )

    source.add_line(
        type=OrderLineType.PRODUCT,
        product=product3,
        supplier=get_default_supplier(),
        quantity=quantities[2],
        base_unit_price=source.create_price(50),
    )

    currency = "EUR"
    summary = source.get_tax_summary()


    assert len(summary) == 1
    summary = summary[0]

    assert summary.taxful == Money(expected, "EUR")
    assert summary.based_on == Money(expected_based_on, "EUR")

    # originally non-rounded value
    assert bankers_round(source.get_total_tax_amount()) == summary.tax_amount

    assert source.taxless_total_price.value == expected_based_on
    assert summary.taxful.value == source.taxful_total_price.value

    assert summary.tax_amount == Money(bankers_round(source.taxful_total_price.value - source.taxless_total_price.value), currency)
    assert summary.taxful == summary.raw_based_on + summary.tax_amount

    assert summary.tax_rate == tax.rate
    assert summary.taxful.value == (summary.based_on + summary.tax_amount).value - Decimal("%s" % 0.01)

    # create order from basket
    creator = OrderCreator()
    order = creator.create_order(source)
    assert order.taxless_total_price.value == expected_based_on

    # originally non-rounded value
    assert bankers_round(order.get_total_tax_amount()) == summary.tax_amount
开发者ID:ruqaiya,项目名称:shuup,代码行数:84,代码来源:test_taxes.py


注:本文中的shuup_tests.utils.basketish_order_source.BasketishOrderSource.status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。