Language: JavaScript
Label: safe
CWE: CWE-352 \u2014 Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.

Code:
    isGivenDiscountPermitted: function(selector) {

        var totalAmount = $(".totalAmount").text();
        var orderDiscount = $(selector).val();

        if( get_options("maxDiscount") != "" ) { // If the current biller set a max discount

            var maxDiscountAmount = totalAmount - BMS.FUNCTIONS.calculateDiscount(totalAmount, get_options("maxDiscount"));
            var givenDiscountAmount = totalAmount - BMS.FUNCTIONS.calculateDiscount(totalAmount, orderDiscount);

            // In case of return/ negative value
            // -2 is greater then -4
            // So we are converting all negative value to abs
            return Math.abs(maxDiscountAmount) >= Math.abs(givenDiscountAmount);

        } else {
            return true;
        }

    }