How to use the format.formatMoney function in format

To help you get started, we’ve selected a few format examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github airbrite / diy-checkout / src / js / app.js View on Github external
coupon.validate(code, $.proxy(function(valid) {
        var discount;

        this.updateTaxes();
        this.updateTotal();

        // TODO: Move coupon live validation to form
        form._setCouponValidationClass(valid);

        if (!valid || code === '') {
          $(groupSelector).hide();
          return;
        }

        // TODO: Discount logic instead of assuming single flat amount
        discount = formatMoney(this._getDiscount());

        $(priceSelector).text(discount);
        $(groupSelector).show();
      }, this));
    },
github airbrite / diy-checkout / src / js / app.js View on Github external
updateTaxes: function() {
      var countryCode = this._getCountry();
      var zip = this._getZip();

      // Cache hit
      if (this._taxes[countryCode + zip] !== undefined) {
        var taxRate = this._taxes[countryCode + zip];
        var tax = taxRate * this._getSubtotal();

        tax = formatMoney(tax);
        this.$form.find('.Celery-OrderSummary-price--taxes').text(tax);
        this.updateTotal();

        return;
      }

      celeryClient.fetchTaxes({
        shipping_country: countryCode,
        shipping_zip: zip
      }, $.proxy(function(err, data) {
        if (err || !data || !data.data || data.data.base === undefined) {
          return;
        }

        this._taxes[countryCode + zip] = data.data.base;
github airbrite / diy-checkout / src / js / app.js View on Github external
updateOrderSummary: function() {
      var shopData = shop.data;

      if (!shopData) return;

      var quantity = this._getQuantity();
      var price = formatMoney(this._getPrice());
      var shipping = formatMoney(this._getShipping());

      var $form = this.$form;

      if (config.features.taxes && celeryClient.config.userId) {
        this.updateTaxes();
      }

      if (config.features.coupons && celeryClient.config.userId) {
        this.updateDiscount();
      }

      this.updateTotal();

      $form.find('.Celery-OrderSummary-price--price').text(price);
      $form.find('.Celery-OrderSummary-price--shipping').text(shipping);
github airbrite / diy-checkout / src / js / app.js View on Github external
updateTotal: function() {
      var total = formatMoney(this._getTotal());

      this.$form.find('.Celery-OrderSummary-price--total').text(total);
    },
github airbrite / diy-checkout / src / js / app.js View on Github external
updateOrderSummary: function() {
      var shopData = shop.data;

      if (!shopData) return;

      var quantity = this._getQuantity();
      var price = formatMoney(this._getPrice());
      var shipping = formatMoney(this._getShipping());

      var $form = this.$form;

      if (config.features.taxes && celeryClient.config.userId) {
        this.updateTaxes();
      }

      if (config.features.coupons && celeryClient.config.userId) {
        this.updateDiscount();
      }

      this.updateTotal();

      $form.find('.Celery-OrderSummary-price--price').text(price);
      $form.find('.Celery-OrderSummary-price--shipping').text(shipping);
      $form.find('.Celery-OrderSummary-number--quantity').text(quantity);