Sha256: 1ad62c1b95734060bb4d0bf3e03bf7dd2b47a62d2f860d06b46de67bbf989264
Contents?: true
Size: 989 Bytes
Versions: 2
Compression:
Stored size: 989 Bytes
Contents
# -- encoding : utf-8 -- #include Killbill::Plugin::ActiveMerchant::Sinatra require 'sinatra' configure do end helpers do def state PaymentTest::State.instance end end post '/plugins/killbill-payment-test/configure', :provides => 'json' do begin data = JSON.parse request.body.read rescue JSON::ParserError => e halt 400, {'Content-Type' => 'text/plain'}, "Invalid payload: #{e}" end action = data['CONFIGURE_ACTION'] if action.nil? halt 400, {'Content-Type' => 'text/plain'}, "Invalid json, need to specify one CONFIGURE_ACTION={ACTION_THROW_EXCEPTION|ACTION_RETURN_NIL|ACTION_SLEEP|ACTION_RESET}" end if action == 'ACTION_THROW_EXCEPTION' state.configure_always_throw(data['METHODS']) elsif action == 'ACTION_RETURN_NIL' state.configure_return_nil(data['METHODS']) elsif action == 'ACTION_SLEEP' state.configure_sleep_time(data['SLEEP_TIME_SEC'], data['METHODS']) else state.reset_configuration end status 200 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
killbill-payment-test-3.2.0 | lib/payment_test/application.rb |
killbill-payment-test-3.1.0 | lib/payment_test/application.rb |