Class: ODDB::View::PayPal::Redirect

Inherits:
HtmlGrid::Component show all
Defined in:
src/view/paypal/redirect.rb

Instance Method Summary (collapse)

Methods inherited from HtmlGrid::Component

#additional_javascripts, #dynamic_html

Instance Method Details

- (Object) http_headers



10
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 'src/view/paypal/redirect.rb', line 10

def http_headers 
  invoice = @model.oid
  names = @model.items.values.collect { |item| 
    txt = item.text
    case txt
    when 'unlimited access'
      'Unlimited Access to ch.oddb.org for %i days' % item.quantity
    else
      txt
    end
  }.join(' ,')
  ret_url = @lookandfeel._event_url(:paypal_return, 
    {:invoice => invoice})
  url = 'https://' << PAYPAL_SERVER << '/cgi-bin/webscr?' \
    << "business=#{PAYPAL_RECEIVER}&" \
    << "item_name=#{names}&item_number=#{invoice}&" \
    << "invoice=#{invoice}&custom=ch.oddb.org&" \
    << "amount=#{sprintf('%3.2f', model.total_brutto)}&" \
    << 'no_shipping=1&no_note=1&currency_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?(YusUser))
    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

- (Object) to_html(context)



44
45
46
# File 'src/view/paypal/redirect.rb', line 44

def to_html(context)
  ''
end