Sha256: 59ac92b957dfa2de1417dbd96328d1302617d0d3af77950e92be46a17aa44c41

Contents?: true

Size: 1.05 KB

Versions: 35

Compression:

Stored size: 1.05 KB

Contents

stripeCheckoutHandler = (key, form) ->
  StripeCheckout.configure
    key: key
    token: (token, args) ->
      if token.error
        form.find("input[type='submit']").prop('disabled', false)
        alert("An error ocurred when contacting Stripe.  Your card has not been charged.  Please refresh the page and try again. #{token.error.message}")
      else
        form.find("input[type='submit']").prop('disabled', true)
        form.find('input#effective_stripe_charge_token').val('' + token['id'])
        form.submit()

$(document).on 'click', "#effective-orders-new-charge-form form input[type='submit']", (event) ->
  event.preventDefault()

  obj = $('#effective-orders-new-charge-form')
  form = obj.find('form').first()

  form.find("input[type='submit']").prop('disabled', true)

  stripeCheckoutHandler(obj.data('stripe-publishable-key'), form).open
    name: obj.data('site-title')
    email: obj.data('user-email')
    description: obj.data('description')
    amount: obj.data('amount')
    closed: -> form.find("input[type='submit']").prop('disabled', false)

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
effective_orders-1.4.2 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.4.1 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.4.0 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.13 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.12 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.11 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.10 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.9 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.8 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.7 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.6 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.5 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.4 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.3 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.2 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.1 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.3.0 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.2.13 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.2.12 app/assets/javascripts/effective_orders/stripe_charges.js.coffee
effective_orders-1.2.11 app/assets/javascripts/effective_orders/stripe_charges.js.coffee