コード例 #1
0
 def delete(self, request, *args, **kwargs):
     self.logger.info('========== Start deleting Bonus Distribution ==========')
     bonus_distribution_id = kwargs.get('bonus_distribution_id')
     api_path = api_settings.BONUS_SETTINGS_DELETE_PATH.format(
         bonus_distribution_id=bonus_distribution_id
     )
     url = settings.DOMAIN_NAMES + api_path
     response = ajax_functions._delete_method(request, url, "", self.logger)
     self.logger.info('========== Finish deleting Bonus Distribution ==========')
     return response
コード例 #2
0
 def delete_client_by_id(request, client_id):
     if not check_permissions_by_user(request.user, 'CAN_DELETE_CLIENTS'):
         return
     logger = logging.getLogger(__name__)
     correlation_id = get_correlation_id_from_username(request.user)
     logger = setup_logger(request, logger, correlation_id)
     logger.info("========== Start deleting client id ==========")
     url = api_settings.DELETE_CLIENT_URL.format(client_id)
     result = ajax_functions._delete_method(request, url, "", logger)
     logger.info('========== Finish deleting client id ==========')
     return result
コード例 #3
0
def remove(request, token_id):
    logger = logging.getLogger(__name__)
    correlation_id = get_correlation_id_from_username(request.user)
    logger = setup_logger(request, logger, correlation_id)
    logger.info("Checking permission for [{}] username with [{}] permission".format(request.user, 'CAN_REMOVE_TRUST'))
    if not check_permissions_by_user(request.user, 'CAN_REMOVE_TRUST'):
        return {"status": 1, "msg": ''}
    logger.info('========== Start remove trust token ==========')
    url = settings.DOMAIN_NAMES + api_settings.DELETE_TRUST_TOKEN_API.format(token_id)
    result = ajax_functions._delete_method(request, url, "", logger, {})
    logger.info('========== Finish remove trust token ==========')
    return result
コード例 #4
0
    def delete(self, request, *args, **kwargs):
        self.logger.info(
            '========== Start deleting Setting Payment, Fee & Bonus Structure =========='
        )
        balance_distribution_id = kwargs.get('balance_distribution_id')

        url = api_settings.BALANCE_DISTRIBUTION_DETAIL_URL.format(
            balance_distribution_id=balance_distribution_id)
        response = ajax_functions._delete_method(request, url, "", self.logger)
        self.logger.info(
            '========== Finish deleting Setting Payment, Fee & Bonus Structure =========='
        )
        return response
コード例 #5
0
def delete_relationship(request, relationship_id):
    logger = logging.getLogger(__name__)
    correlation_id = get_correlation_id_from_username(request.user)
    logger = setup_logger(request, logger, correlation_id)
    logger.info("Checking permission for [{}] username with [{}] permission".format(request.user, 'CAN_DELETE_AGENT_RELATIONSHIP'))
    if not check_permissions_by_user(request.user, 'CAN_DELETE_AGENT_RELATIONSHIP'):
        return {"status": 1, "msg": ''}
    logger.info('========== Start delete relationship ==========')
    url = settings.DOMAIN_NAMES + api_settings.DELETE_RELATIONSHIP.format(relationship_id)

    result = ajax_functions._delete_method(request, url, "", logger)
    logger.info('========== Finish delete relationship ==========')
    return result
コード例 #6
0
def unblock(request, ticket_id):
    logger = logging.getLogger(__name__)
    correlation_id = get_correlation_id_from_username(request.user)
    logger = setup_logger(request, logger, correlation_id)
    logger.info(
        "Checking permission for [{}] username with [{}] permission".format(
            request.user, 'CAN_DELETE_FRAUD_TICKET'))
    if not check_permissions_by_user(request.user, 'CAN_DELETE_FRAUD_TICKET'):
        return JsonResponse({"status": 0, "msg": ''})
    logger.info('========== Start unblocking device ==========')
    url = api_settings.DELETE_FRAUD_TICKET.format(ticket_id=ticket_id)
    result = ajax_functions._delete_method(request, url, "", logger)
    logger.info('========== Finish unblocking device ==========')
    return result
コード例 #7
0
def delete(request, categoryId):
    if not check_permissions_by_user(request.user, 'CAN_DELETE_CATEGORY'):
        return
    logger = logging.getLogger(__name__)
    correlation_id = get_correlation_id_from_username(request.user)
    logger = setup_logger(request, logger, correlation_id)

    logger.info('========== Start deleting category ==========')
    url = settings.DOMAIN_NAMES + DELETE_CATEGORY.format(
        category_id=categoryId)

    result = ajax_functions._delete_method(request, url, "", logger)
    logger.info('========== Finish deleting category ==========')
    return result
コード例 #8
0
    def delete(self, request, *args, **kwargs):
        agent_fee_distribution_id = kwargs.get('agent_fee_distribution_id')

        self.logger.info(
            '========== Start deleting Agent Hirarchy Distribution - Fee =========='
        )

        url = api_settings.AGENT_FEE_DISTRIBUTION_DETAIL_URL.format(
            agent_fee_distribution_id=agent_fee_distribution_id)

        response = ajax_functions._delete_method(request, url, "", self.logger)
        self.logger.info(
            '========== Finish deleting Agent Hirarchy Distribution - Fee =========='
        )
        return response
コード例 #9
0
def unbind_device(request, device_id):
    logger = logging.getLogger(__name__)
    correlation_id = get_correlation_id_from_username(request.user)
    logger = setup_logger(request, logger, correlation_id)
    logger.info(
        "Checking permission for [{}] username with [{}] permission".format(
            request.user, 'CAN_UNBIND_AGENT_DEVICE'))
    if not check_permissions_by_user(request.user, 'CAN_UNBIND_AGENT_DEVICE'):
        return {"status": 1, "msg": ''}
    logger.info('========== Start delete device ==========')
    url = settings.DOMAIN_NAMES + api_settings.DELETE_AGENT_DEVICE.format(
        device_id=device_id)

    result = ajax_functions._delete_method(request, url, "", logger)
    logger.info('========== Finish delete device ==========')
    return result
コード例 #10
0
def delete_amount_limit(request, rule_id, rule_limit_id):
    logger = logging.getLogger(__name__)
    correlation_id = get_correlation_id_from_username(request.user)
    logger = setup_logger(request, logger, correlation_id)
    logger.info('========== Start delete campaign amount limit ==========')

    if request.method == 'POST':
        url = settings.DOMAIN_NAMES + api_settings.DELETE_RULE_AMOUNT_LIMIT.format(
            rule_id=rule_id, rule_limit_id=rule_limit_id)
        result = ajax_functions._delete_method(request=request,
                                               api_path=url,
                                               func_description="",
                                               logger=logger)
        logger.info(
            '========== Finish delete campaign amount limit ==========')
        return result
コード例 #11
0
def delete_customer(request, customer_id):
    logger = logging.getLogger(__name__)
    correlation_id = get_correlation_id_from_username(request.user)
    logger = setup_logger(request, logger, correlation_id)
    logger.info('========== Start delete customer ==========')

    if request.method == 'POST':
        logger.info('Sending request to backend service')
        url = settings.DOMAIN_NAMES + api_settings.ADMIN_DELETE_CUSTOMER_URL.format(
            customer_id)

        result = ajax_functions._delete_method(request=request,
                                               api_path=url,
                                               func_description="",
                                               logger=logger)
        logger.info('========== Finish activating customer ==========')
        return result
コード例 #12
0
    def post(self, request, *args, **kwargs):
        if not self.check_membership(["CAN_DELETE_FRAUD_TICKET"]):
            return JsonResponse({"status": 0, "msg": ""})

        self.logger.info('========== Start delete freeze card ==========')
        context = super(CardFreezeList, self).get_context_data(**kwargs)
        freeze_card_id = context['id']
        url = api_settings.DELETE_FREEZE_CARD_PATH.format(
            ticket_id=freeze_card_id)

        result = ajax_functions._delete_method(
            request=request,
            api_path=url,
            func_description="Delete freeze card",
            logger=self.logger,
            params=None,
            timeout=None)

        self.logger.info('========== End delete freeze card ==========')
        return result