26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/ogone-rails/helpers.rb', line 26
def ogone_fields options = {}
@form = Form.new
@hash = StringToHash.new
add_ogone_parameter('PSPID', OgoneRails::pspid)
add_ogone_parameter('currency', OgoneRails::currency)
add_ogone_parameter('language', OgoneRails::language)
options_index = {
:currency => 'currency',
:pspid => 'PSPID',
:language => 'language',
:order_id => 'orderID',
:amount => 'amount',
:customer_name => 'CN',
:customer_email => 'EMAIL',
:customer_address => 'owneraddress',
:customer_zip => 'ownerZIP',
:customer_city => 'ownertown',
:customer_country => 'ownercty',
:customer_phone => 'ownertelno',
:accept_url => 'accepturl',
:decline_url => 'declineurl',
:exception_url => 'exceptionurl',
:cancel_url => 'cancelurl',
:title => 'TITLE',
:bg_color => 'BGCOLOR',
:text_color => 'TXTCOLOR',
:table_bg_color => 'TBLBGCOLOR',
:table_text_color => 'TBLTXTCOLOR',
:button_bg_color => 'BUTTONBGCOLOR',
:button_text_color => 'BUTTONTXTCOLOR',
:font_family => 'FONTTYPE',
:logo => 'LOGO'
}
options.each do |option, value|
if options_index.key?(option)
value = (value.to_f * 100).to_i if option == :amount add_ogone_parameter(options_index[option], value)
else
add_ogone_parameter(option.to_s, value)
end
end
@form.add_input('SHASign', @hash.generate_sha_in)
@form.form_fields
end
|