Add configurable UPC and RA setup flows
This commit is contained in:
+18
-2
@@ -43,12 +43,28 @@ def get_setup_configs(mode, config=None):
|
||||
for name, product in products.items():
|
||||
if not product.get("enabled", True):
|
||||
continue
|
||||
variants = product.get("session_variants")
|
||||
if variants is not None:
|
||||
resolved = get_product_config(name, config)
|
||||
if not resolved["setup"].get("run_session", True):
|
||||
continue
|
||||
variant_config = deepcopy(config)
|
||||
variant_config["products"] = {}
|
||||
for variant_name, variant in variants.items():
|
||||
settings = deepcopy(product)
|
||||
settings.pop("session_variants")
|
||||
settings.update(variant)
|
||||
settings["session"] = {**product.get("session", {}), **variant.get("session", {})}
|
||||
settings["token"] = {**product.get("token", {}), **variant.get("token", {})}
|
||||
variant_config["products"][f"{name}_{variant_name}"] = settings
|
||||
selected.extend(get_setup_configs(mode, variant_config))
|
||||
continue
|
||||
resolved = get_product_config(name, config)
|
||||
setup = resolved.get("setup", {})
|
||||
session = setup.get("run_session", True)
|
||||
token = setup.get("run_token", True)
|
||||
matches = {
|
||||
"combined": session and token,
|
||||
"combined": session and token or (name.startswith("UPC_") and token),
|
||||
"session": session and not token,
|
||||
"token": token and not session,
|
||||
}
|
||||
@@ -59,7 +75,7 @@ def get_setup_configs(mode, config=None):
|
||||
if token:
|
||||
settings = resolved["token"]
|
||||
if not settings.get("market_code") or not (
|
||||
parse_product_codes(settings.get("product_codes"))
|
||||
parse_product_codes(settings.get("create_product_codes", settings.get("product_codes")))
|
||||
or parse_product_codes(settings.get("product_code"))
|
||||
):
|
||||
raise ValueError(f"products.{name}.token requires market_code and product_code(s)")
|
||||
|
||||
Reference in New Issue
Block a user