Sha256: a0e40d72948caa5d1a41948411880e34c5cf59782078fdf1464d71462d1fb2db

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

Veritrans.setup do
  config.load_config Rails.root.join("config/veritrans.yml"), Rails.env

  # Or set it manually...
  # config.server_key = ""
  # config.client_key = ""
  # config.api_host = ""

  config.server_key = ENV['MIDTRANS_SERVER_KEY'].freeze
  config.client_key = ENV['MIDTRANS_CLIENT_KEY'].freeze

  # Veritrans::Events is rack application to handle http notifications from Veritrans
  # To enable it, add in config/routes.rb
  # mount Veritrans::Events.new => '/vt_events'

  # All possible events:
  #
  # * payment.success     == ['authorize', 'capture', 'settlement']
  # * payment.failed      == ['deny', 'canel', 'expire']
  # * payment.challenge   # when payment.froud_status == 'challenge'
  #
  # * payment.authorize
  # * payment.capture
  # * payment.settlement
  # * payment.deny
  # * payment.canel
  # * payment.expire

  # events.subscribe 'payment.success' do |payment|
  #   payment.mark_paid!
  # end
  # 
  # events.subscribe 'payment.failed' do |payment|
  #   payment.mark_failed!
  # end
  # 
  # events.subscribe 'payment.challenge' do |payment|
  #   payment.mark_challenge!
  # end
  # 
  # events.subscribe /.+/ do |payment, event_name|
  #   p "Event: #{event_name}"
  #   p payment
  # end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritrans-2.3.0 example/rails/cable/config/initializers/veritrans.rb
veritrans-2.2.0 example/rails/cable/config/initializers/veritrans.rb