Sha256: c9a03495fd734ca6017fd5f4e35d7f57cebf53a71a95bf42632843ce078bbcc9
Contents?: true
Size: 1.52 KB
Versions: 8
Compression:
Stored size: 1.52 KB
Contents
# coding: utf-8 class PaymentsController < ApplicationController before_filter :authenticate_terminal def limits provider = Provider.find_by_keyword params[:provider] render :json => provider.limits.actual. by_terminal_profile_and_agent_ids(@terminal.terminal_profile_id, @terminal.agent_id). by_payment_type(params[:payment_type]). as_json(:only => [:min, :max], :methods => [:weight]) end def create payment = Payment.build!(@terminal, Provider.find_by_keyword(params[:provider]), params[:payment]) if payment payment.check! render :json => { :id => payment.id, :state => payment.state, :requires_print => payment.provider.requires_print, :limits => Limit.for(payment, false).as_json( :only => [:min, :max], :methods => [:weight] ), :commissions => Commission.for(payment, false).as_json( :only => [:min, :max, :percent_fee, :static_fee, :payment_type], :methods => [:weight] ), :receipt_template => ProviderReceiptTemplate.for(payment).compile(payment) } else render :text => nil, :status => 406 end end def pay payment = @terminal.payments.find(params[:id]) payment.enqueue!(params[:payment]) unless payment.queue? render :text => nil, :status => 200 end end
Version data entries
8 entries across 8 versions & 1 rubygems