Sha256: 6c0ac9195a17869787f34844cb6ed0962a8ed2920835ae2d6bdfe299b73535b3

Contents?: true

Size: 1.48 KB

Versions: 20

Compression:

Stored size: 1.48 KB

Contents

Spree.ready ($) ->
  Spree.onPayment = () ->
    if ($ '#checkout_form_payment').is('*')

      if ($ '#existing_cards').is('*')
        ($ '#payment-method-fields').hide()
        ($ '#payment-methods').hide()

        ($ '#use_existing_card_yes').click ->
          ($ '#payment-method-fields').hide()
          ($ '#payment-methods').hide()
          ($ '.existing-cc-radio').prop("disabled", false)

        ($ '#use_existing_card_no').click ->
          ($ '#payment-method-fields').show()
          ($ '#payment-methods').show()
          ($ '.existing-cc-radio').prop("disabled", true)


      $(".cardNumber").payment('formatCardNumber')
      $(".cardExpiry").payment('formatCardExpiry')
      $(".cardCode").payment('formatCardCVC')

      $(".cardNumber").change ->
        $(this).parent().siblings(".ccType").val($.payment.cardType(@value))

      ($ 'input[type="radio"][name="order[payments_attributes][][payment_method_id]"]').click(->
        ($ '#payment-methods li').hide()
        ($ '#payment_method_' + @value).show() if @checked
      )

      ($ '#cvv_link').on 'click', (event) ->
        windowName = 'cvv_info'
        windowOptions = 'left=20,top=20,width=500,height=500,toolbar=0,resizable=0,scrollbars=1'
        window.open(($ this).attr('href'), windowName, windowOptions)
        event.preventDefault()

      # Activate already checked payment method if form is re-rendered
      # i.e. if user enters invalid data
      ($ 'input[type="radio"]:checked').click()

  Spree.onPayment()

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
solidus_frontend-2.4.2 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.2.2 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.4.1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.3.1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.1.1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.4.0 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.4.0.rc1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.4.0.beta1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.3.0 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.3.0.rc3 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.3.0.rc2 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.3.0.rc1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.3.0.beta1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.2.1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.2.0 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.2.0.rc1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.2.0.beta1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.1.0 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.1.0.rc1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
solidus_frontend-2.1.0.beta1 app/assets/javascripts/spree/frontend/checkout/payment.js.coffee