from actions import mb_context
from bustoken import TK_REMOTE_ORDER_GET_DELIVERY_FEE_CODE
from msgbus import TK_SYS_ACK

delivery_fee_code = None


def get_delivery_fee_code():
    global delivery_fee_code

    if delivery_fee_code:
        return delivery_fee_code

    msg = mb_context.MB_EasySendMessage("RemoteOrder", TK_REMOTE_ORDER_GET_DELIVERY_FEE_CODE, timeout=3000000)
    if msg.token == TK_SYS_ACK:
        delivery_fee_code = msg.data

    return delivery_fee_code
