Sha256: cc8c544ab0310ff44b2852c954b3ae00732e8ebeec6e7022f85efff30fd8288c

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

class 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

4 entries across 4 versions & 1 rubygems

Version Path
veritrans-2.1.3 lib/generators/veritrans/payment_form_generator.rb
veritrans-2.1.2 lib/generators/veritrans/payment_form_generator.rb
veritrans-2.1.1 lib/generators/veritrans/payment_form_generator.rb
veritrans-2.1.0 lib/generators/veritrans/payment_form_generator.rb