module PayPal::Helpers

Public Instance Methods

_call_paypal_method(key, paypal_request) click to toggle source
# File lib/sinatra/paypal.rb, line 33
def _call_paypal_method(key, paypal_request)
        self.send self.class._paypal_method_name(key), paypal_request
end
html_payment_form(item, data = {}) click to toggle source
# File lib/sinatra/paypal.rb, line 15
def html_payment_form(item, data = {})
        # it is valid to send a nil item through - we might be going to set the fields in
        # javascript - but if it isn't null then there are certain fields that need to be
        # set
        if !item.nil?
                raise 'item.code required' if !item.respond_to?(:code) || item.code.nil?
                raise 'item.price required' if !item.respond_to?(:price) || item.price.nil?
                raise 'item.price must be a number above zero' if item.price.to_f <= 0
        end

        raise 'cannot generate a payment form without settings.paypal.email' if settings.paypal.email.nil?

        erb :_payment, :views => File.join(File.dirname(__FILE__), '/paypal'), :locals => {
                :custom_data => data,
                :item => item
        }
end
paypal_form_url() click to toggle source
# File lib/sinatra/paypal.rb, line 11
def paypal_form_url
        PaypalHelper.form_url(settings.paypal.sandbox?)
end