11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/oddb/html/view/paypal/redirect.rb', line 11
def
invoice = @model.id
names = @model.items.collect { |item|
txt = item.text
case txt
when 'unlimited access'
'Unlimited Access to de.oddb.org for %i days' % item.quantity
else
txt
end
}.join(' ,')
ret_url = @lookandfeel._event_url(:collect, :invoice => invoice)
url = 'https://' << ODDB.config.paypal_server << '/cgi-bin/webscr?' \
<< "business=#{ODDB.config.paypal_receiver}&" \
<< "item_name=#{names}&item_number=#{invoice}&" \
<< "invoice=#{invoice}&custom=de.oddb.org&" \
<< "amount=#{sprintf('%3.2f', model.total_brutto)}&" \
<< 'no_shipping=1&no_note=1¤cy_code=EUR&' \
<< "return=#{ret_url}&" \
<< "cancel_return=#{@lookandfeel.base_url}&" \
<< "image_url=https://www.generika.cc/images/oddb_paypal.jpg"
if((user = @session.user).is_a?(Util::KnownUser))
url << "&email=#{user.email}&first_name=#{user.name_first}" \
<< "&last_name=#{user.name_last}&address1=#{user.address}" \
<< "&city=#{user.city}&zip=#{user.plz}" \
<< "&redirect_cmd=_xclick&cmd=_ext-enter"
else
url << '&cmd=_xclick'
end
{
'Location' => url,
}
end
|