Sha256: 5f3d6ac5111fee365ad7aaa876c3d7aea8fb9921b35febe5ee84d7ed91ef98ce

Contents?: true

Size: 1.43 KB

Versions: 35

Compression:

Stored size: 1.43 KB

Contents

App.views.Pagarme.addChild('PaymentSlip', _.extend({
  el: '#payment_type_slip_section form',

  events: {
    'click input#build_boleto' : 'onBuildBoletoClick',
    'blur input' : 'checkInput'
  },

  activate: function(options){
    app.userDocumentView.undelegateEvents();
    app._userDocumentView = null;
    app.userDocumentView;
    this.$('#user_bank_account_attributes_owner_name').data('custom-validation', this.validateName);

    this.setupForm();
    this.message = this.$('.payment-error-message');
    this.$('#user_bank_account_attributes_name').brbanks();
  },

  onBuildBoletoClick: function(e){
    var that = this;

    if(!this.validate()){
      return false;
    }

    var parent = this.parent;

    e.preventDefault();
    $(e.currentTarget).hide();
    this.$('#payment-slip-instructions').slideUp('slow');
    that.parent.loader.show();

    $.post('/payment/pagarme/'+that.parent.contributionId+'/pay_slip.json',null, 'json').success(function(response){
      parent.loader.hide();
      if(response.payment_status == 'failed'){
        that.message.find('.message-text').html(response.message);
        that.message.slideDown('slow')

        $(e.currentTarget).show();
      } else if(response.boleto_url) {
        var thank_you = $('#project_review').data('thank-you-path');

        if(thank_you){
          location.href = thank_you;
        } else {
          location.href = '/';
        }
      }
    });
  }

}, Skull.Form));

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
catarse_pagarme-2.9.13 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.12 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.11 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.10 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.9 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.8 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.7 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.6 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.5 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.4 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.3 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.2 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.9.0 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.8.10 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.8.9 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.8.8 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.8.7 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.8.6 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.8.5 app/assets/javascripts/catarse_pagarme/payment_slip.js
catarse_pagarme-2.8.4 app/assets/javascripts/catarse_pagarme/payment_slip.js