Exemplo n.º 1
0
def attr_type_value(key):
    k, v = utils.find_element_by_key_in_tuples(key, Constants.ATTRIBUTE_TYPE)
    if v is None:
        logger.info(
            f"attr_type_value : Could not found value  for key \"{key}\"")
        return key
    return _(v)
Exemplo n.º 2
0
def category_page_title(key):
    k, v = utils.find_element_by_key_in_tuples(key, Constants.CATEGORIES)
    if v is None:
        logger.info(
            f"category_page_title : Could not found value  for key \"{key}\"")
        return key
    return v
Exemplo n.º 3
0
def pay_status_value(key):
    k, v = utils.find_element_by_key_in_tuples(key, Constants.PAYMENT_STATUS)
    if v is None:
        logger.info(
            f"pay_status_value: Could not found value  for key \"{key}\"")
        return key
    return v
Exemplo n.º 4
0
def refund_declined_value(key):
    k, v = utils.find_element_by_key_in_tuples(
        key, Constants.REFUND_DECLINED_REASON)
    if v is None:
        logger.info(
            f"refund_declined_value: Could not found value  for key \"{key}\"")
        return key
    return v
Exemplo n.º 5
0
def pay_mode_value(key):
    k, v = utils.find_element_by_key_in_tuples(key,
                                               Constants.ORDER_PAYMENT_MODE)
    if v is None:
        logger.info(
            f"pay_mode_value: Could not found value  for key \"{key}\"")
        return key
    return v
Exemplo n.º 6
0
def set_address_type(address, address_type):
    if not isinstance(address, Address):
        return False

    if not isinstance(address_type, int):
        return False

    k, v = utils.find_element_by_key_in_tuples(
        address_type, Addressbook_Constants.ADDRESS_TYPES)
    if v is None:
        return False

    Address.objects.filter(pk=address.pk).update(address_type=address_type)
    return True
Exemplo n.º 7
0
def get_payment_option_name(option=None):
    key, value = utils.find_element_by_key_in_tuples(option,
                                                     ORDER_PAYMENT_OPTIONS)
    return key, value
Exemplo n.º 8
0
def get_order_status_name(order_status=None):
    key, value = utils.find_element_by_key_in_tuples(order_status,
                                                     ORDER_STATUS)
    return key, value
Exemplo n.º 9
0
def address_type_value(key):
    k,v = utils.find_element_by_key_in_tuples(key, Constants.ADDRESS_TYPES)
    if v is None:
        logger.info(f"address_type_value : Could not found value  for key \"{key}\"")
        return key
    return v
Exemplo n.º 10
0
def get_gender_value(key):
    return utils.find_element_by_key_in_tuples(key, GENDER)
Exemplo n.º 11
0
def get_payment_date_value(key):
    k, v = utils.find_element_by_key_in_tuples(key, PAYMENT_DATE)
    return k, v
Exemplo n.º 12
0
def get_payment_mode_value(key):
    k, v = utils.find_element_by_key_in_tuples(key, PAYMENT_MODE)
    return k, v
Exemplo n.º 13
0
def get_payment_status_value(key):
    k, v = utils.find_element_by_key_in_tuples(key, PAYMENT_STATUS)
    return k, v
Exemplo n.º 14
0
def get_declined_reason_value(key):
    k, v = utils.find_element_by_key_in_tuples(key, DECLINED_REASON)
    return k, v
Exemplo n.º 15
0
def ship_mode_value(key):
    k,v = utils.find_element_by_key_in_tuples(key, Constants.SHIP_MODE)
    if v is None:
        logger.info(f"ship_mode_value : Could not found value for key \"{key}\"")
        return key
    return v
Exemplo n.º 16
0
def get_category_page_title(key):
    return utils.find_element_by_key_in_tuples(key, CATEGORIES)
Exemplo n.º 17
0
def account_type_value(key):
    k,v = utils.find_element_by_key_in_tuples(key, ACCOUNT_CONSTANTS.ACCOUNT_TYPE)
    if v is None:
        logger.info(f"account_type_value: Could not found value  for key \"{key}\"")
        return key
    return v
Exemplo n.º 18
0
def get_attribute_type_value(key):
    return utils.find_element_by_key_in_tuples(key, ATTRIBUTE_TYPE)