示例#1
0
def get_price(product, shop_id):
    """Launch price gen with config parameters

    Args:
        product ([Product]): Product at DB
        shop_id (int): shop identifier

    Returns:
        [float]: Finish price
    """
    mom_selector = Configuration.get_value(shop_id, "MOM_SELECTOR",
                                           product.category_path)
    margin_percent = Configuration.get_value(shop_id, "MARGIN_PERCENT",
                                             product.category_path)
    if mom_selector:
        round_to = Configuration.get_value(shop_id, "ROUND_TO",
                                           product.category_path)
        mom_price = get_mom_price(product.sku)
        if mom_price is not None:
            return price_generator(
                purchase_price=product.price,
                margin=margin_percent,
                mom_price=mom_price,
                mom=True,
                round_to=round_to,
            )
    return price_generator(
        product.price,
        margin=margin_percent,
    )
示例#2
0
 def add_parameters(node, path):
     for name in PARAMETERS:
         node[name] = Configuration.get_value(shop_id, name, path)
示例#3
0
def get_csv_url() -> str:
    return Configuration.get_value(shop_id=1, name="CSV_URL")