Sha256: 3a3be1276102525de8a0e4664a540f4dd96ce8166849c599cc3fff45b9c452b7
Contents?: true
Size: 1.92 KB
Versions: 4
Compression:
Stored size: 1.92 KB
Contents
configure do # Usage: rackup -Ilib -E test if development? or test? Killbill::Litle.initialize! unless Killbill::Litle.initialized end end helpers do def plugin Killbill::Litle::PrivatePaymentPlugin.instance end end # http://127.0.0.1:9292/plugins/killbill-litle get '/plugins/killbill-litle' do locals = { :secure_page_url => Killbill::Litle.config[:litle][:secure_page_url], :paypage_id => Killbill::Litle.config[:litle][:paypage_id], :kb_account_id => request.GET['kb_account_id'] || '1', :merchant_txn_id => request.GET['merchant_txn_id'] || '1', :order_id => request.GET['order_id'] || '1', :report_group => request.GET['report_group'] || 'Default Report Group', :success_page => params[:successPage] || '/plugins/killbill-litle/checkout', :failure_page => params[:failurePage] } erb :paypage, :views => File.expand_path(File.dirname(__FILE__) + '/../views'), :locals => locals end post '/plugins/killbill-litle/checkout' do kb_account_id = request.POST['kb_account_id'] response_paypage_registration_id = request.POST['response_paypage_registration_id'] halt 400, "kb_account_id and response_paypage_registration_id must be specified!" if kb_account_id.blank? or response_paypage_registration_id.blank? pm = plugin.register_token! kb_account_id, response_paypage_registration_id redirect "/plugins/killbill-litle/1.0/pms/#{pm.id}" end # curl -v http://127.0.0.1:9292/plugins/killbill-litle/1.0/pms/1 get '/plugins/killbill-litle/1.0/pms/:id', :provides => 'json' do if pm = Killbill::Litle::LitlePaymentMethod.find_by_id(params[:id].to_i) pm.to_json else status 404 end end # curl -v http://127.0.0.1:9292/plugins/killbill-litle/1.0/transactions/1 get '/plugins/killbill-litle/1.0/transactions/:id', :provides => 'json' do if transaction = Killbill::Litle::LitleTransaction.find_by_id(params[:id].to_i) transaction.to_json else status 404 end end
Version data entries
4 entries across 4 versions & 1 rubygems