Class: Tipalti::Iframe

Inherits:
Object
  • Object
show all
Defined in:
lib/tipalti/iframe.rb

Constant Summary collapse

PAGES =
{
  home: "Home",
  invoices: "Invoices",
  payments: "PaymentsHistory"
}

Class Method Summary collapse

Class Method Details

.url(params = {}) ⇒ Object



11
12
13
14
15
16
# File 'lib/tipalti/iframe.rb', line 11

def self.url(params = {})
  page = (params.delete(:page) || "home").to_sym
  param_str = params.merge(payer: params[:payer] || Tipalti.configuration.payer, ts: Time.now.to_i).to_query
  hashkey = OpenSSL::HMAC.hexdigest('sha256', Tipalti.configuration.master_key, param_str)
  "#{Tipalti.configuration.url}/PayeeDashboard/#{PAGES[page]}?#{param_str}&hashkey=#{hashkey}"
end