Class: OffsitePayments::Integrations::Gestpay::Helper
- Inherits:
-
Helper
- Object
- Helper
- OffsitePayments::Integrations::Gestpay::Helper
show all
- Includes:
- Common
- Defined in:
- lib/offsite_payments/integrations/gestpay.rb
Constant Summary
Constants included
from Common
Common::CURRENCY_MAPPING, Common::DECRYPTION_PATH, Common::DELIMITER, Common::ENCRYPTION_PATH, Common::GestpayEncryptionResponseError, Common::VERSION
Instance Attribute Summary
Attributes inherited from Helper
#fields
Instance Method Summary
collapse
Methods included from Common
#parse_response, #ssl_get
Methods inherited from Helper
#add_field, #add_fields, #add_raw_html_field, #billing_address, #form_method, inherited, mapping, #raw_html_fields, #shipping_address, #test?
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Valid language codes
Italian => 1
English => 2
Spanish => 3
French => 4
Tedesco => 5
66
67
68
69
|
# File 'lib/offsite_payments/integrations/gestpay.rb', line 66
def initialize(order, account, options = {})
super
add_field('PAY1_IDLANGUAGE', 2)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class OffsitePayments::Helper
Instance Method Details
#currency=(currency_code) ⇒ Object
91
92
93
94
95
96
|
# File 'lib/offsite_payments/integrations/gestpay.rb', line 91
def currency=(currency_code)
code = CURRENCY_MAPPING[currency_code]
raise ActionViewHelperError, "Invalid currency code #{currency_code} specified" if code.nil?
add_field(mappings[:currency], code)
end
|
#customer(params = {}) ⇒ Object
86
87
88
89
|
# File 'lib/offsite_payments/integrations/gestpay.rb', line 86
def customer(params = {})
add_field(mappings[:customer][:email], params[:email])
add_field('PAY1_CHNAME', "#{params[:first_name]} #{params[:last_name]}")
end
|
#encryption_query_string ⇒ Object
114
115
116
117
118
119
120
|
# File 'lib/offsite_payments/integrations/gestpay.rb', line 114
def encryption_query_string
fields = ['PAY1_AMOUNT', 'PAY1_SHOPTRANSACTIONID', 'PAY1_UICCODE']
encoded_params = fields.collect{ |field| "#{field}=#{CGI.escape(@fields[field])}" }.join(DELIMITER)
"#{ENCRYPTION_PATH}?a=" + CGI.escape(@fields['ShopLogin']) + "&b=" + encoded_params + "&c=" + CGI.escape(VERSION)
end
|
98
99
100
101
102
103
104
105
|
# File 'lib/offsite_payments/integrations/gestpay.rb', line 98
def form_fields
@encrypted_data ||= get_encrypted_string
{
'a' => @fields['ShopLogin'],
'b' => @encrypted_data
}
end
|
#get_encrypted_string ⇒ Object