Sha256: f5893b5bd13d569fe87f3612186472efd58eb4bebebb5a4c76a2af4aa019defd

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 KB

Contents

module Veritrans
  class PaymentFormGenerator < ::Rails::Generators::Base
    source_root File.expand_path("../../templates", __FILE__)

desc %{
Description:
    Copies Veritrans payment form example to your rails application.
}

    def copy_shared_views
      copy_file "views/_veritrans_include.erb", "app/views/shared/_veritrans_include.erb"
      copy_file "views/_credit_card_form.erb", "app/views/shared/_credit_card_form.erb"
    end

    def copy_controller
      copy_file "payments_controller.rb", "app/controllers/payments_controller.rb"

      route "resources :payments do\n" +
          "    collection do\n" +
          "      post :receive_webhook\n" +
          "    end\n" +
          "  end"

      copy_file "views/payments/new.erb", "app/views/payments/new.erb"
      copy_file "views/payments/create.erb", "app/views/payments/create.erb"
    end

    def append_javascript_file
      copy_file "assets/credit_card_form.js", "app/assets/javascripts/credit_card_form.js"
      insert_into_file "app/assets/javascripts/application.js", :after => %r{//= require +['"]?jquery['"]?$} do
        "\n//= require credit_card_form"
      end

say_status "", %{

Sample form installed in you app!
It contains example for VT-Web and VT-Direct

Now open http://localhost:3000/payments/new

}

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
veritrans-2.0.4 lib/generators/veritrans/payment_form_generator.rb
veritrans-2.0.3 lib/generators/veritrans/payment_form_generator.rb
veritrans-2.0.2 lib/generators/veritrans/payment_form_generator.rb
veritrans-2.0.0 lib/generators/veritrans/payment_form_generator.rb
veritrans-2.0.0beta lib/generators/veritrans/payment_form_generator.rb