Sha256: 6255a659d1ea1539fa5d1359ef821d25432ba535ecdb02b6f2cc8434cb62e2da

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module Versapay
  module Helpers
    # Provides a debit agreement link
    def debit_agreement_link_to(anchor, message = "Debit agreement", opts = {})
      link = debit_agreement_link(message, opts)
      "<a href=\"#{link}\">#{anchor}</a>"
    end

    def payment_checkout_link_to(anchor, message = "Credit Card payment", opts = {})
      link = payment_checkout_link(message, opts)
      "<a href=\"#{link}\">#{anchor}</a>"
    end

    def debit_agreement_link(message = "Debit agreement", opts = {})
      link = "https://" + Versapay::site + "/authorize?api_token=#{Versapay.token}&message=#{html_escape(message).gsub(/ /, "+")}"
      opts.each do |k, v|
        link += "&#{k}=#{html_escape(v)}"
      end

      link
    end

    def payment_checkout_link(message = "Credit Card payment", opts = {})
      link = "https://" + Versapay::site + "/send_money?api_token=#{Versapay.token}&message=#{html_escape(message).gsub(/ /, "+")}"
      opts.each do |k, v|
        link += "&#{k}=#{html_escape(v)}"
      end

      link
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
versapay-0.1.5 lib/versapay/rails_helpers.rb
versapay-0.1.4 lib/versapay/rails_helpers.rb
versapay-0.1.3 lib/versapay/rails_helpers.rb