Class: ActiveMerchant::Billing::Integrations::Liqpay::Helper
- Defined in:
- lib/active_merchant/billing/integrations/liqpay/helper.rb
Instance Attribute Summary
Attributes inherited from Helper
Instance Method Summary collapse
- #form_fields ⇒ Object
-
#initialize(order, account, options = {}) ⇒ Helper
constructor
A new instance of Helper.
Methods inherited from Helper
#add_field, #add_fields, #add_raw_html_field, #billing_address, #form_method, mapping, #raw_html_fields, #shipping_address, #test?
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
6 7 8 9 10 11 |
# File 'lib/active_merchant/billing/integrations/liqpay/helper.rb', line 6 def initialize(order, account, = {}) @secret = .delete(:secret) super add_field 'version', '1.2' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveMerchant::Billing::Integrations::Helper
Instance Method Details
#form_fields ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/active_merchant/billing/integrations/liqpay/helper.rb', line 13 def form_fields xml = "<request> <version>1.2</version> <result_url>#{@fields["result_url"]}</result_url> <server_url>#{@fields["server_url"]}</server_url> <merchant_id>#{@fields["merchant_id"]}</merchant_id> <order_id>#{@fields["order_id"]}</order_id> <amount>#{@fields["amount"]}</amount> <currency>#{@fields["currency"]}</currency> <description>#{@fields["description"]}</description> <default_phone>#{@fields["default_phone"]}</default_phone> <pay_way>card</pay_way> </request>".strip sign = Base64.encode64(Digest::SHA1.digest("#{@secret}#{xml}#{@secret}")).strip {"operation_xml" => Base64.encode64(xml), "signature" => sign} end |