3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/tinypass/ui/html_widget.rb', line 3
def create_button_html(request)
options = request.options.dup || {}
rid = request.primary_offer.resource.rid
builder = ClientBuilder.new
rdata = builder.build_purchase_request(request).gsub('"', '\"')
html = "<tp:request type=\"purchase\" rid=\"#{ rid }\"" <<
" url=\"#{ Config.endpoint + Config::CONTEXT }\"" <<
" rdata=\"#{ rdata }\" aid=\"#{ Tinypass.aid }\"" <<
" cn=\"#{ Config.token_cookie_name }\" v=\"#{ Config::VERSION }\""
html << " oncheckaccess=\"#{ request.callback }\"" if request.callback
if options['button.html']
custom = options['button.html'].gsub('"', '"')
html << " custom=\"#{ custom }\""
elsif options['button.link']
link = options['button.link'].gsub('"', '"')
html << " link=\"#{ link }\""
end
html << "></tp:request>"
html
end
|