module ActiveMerchant #:nodoc: module Billing #:nodoc: module Integrations #:nodoc: module Liqpay class Helper < ActiveMerchant::Billing::Integrations::Helper def initialize(order, account, options = {}) @secret = options.delete(:secret) super add_field 'version', '1.2' end def form_fields xml = " 1.2 #{@fields["result_url"]} #{@fields["server_url"]} #{@fields["merchant_id"]} #{@fields["order_id"]} #{@fields["amount"]} #{@fields["currency"]} #{@fields["description"]} #{@fields["default_phone"]} card ".strip sign = Base64.encode64(Digest::SHA1.digest("#{@secret}#{xml}#{@secret}")).strip {"operation_xml" => Base64.encode64(xml), "signature" => sign} end mapping :account, 'merchant_id' mapping :amount, 'amount' mapping :currency, 'currency' mapping :order, 'order_id' mapping :description, 'description' mapping :phone, 'default_phone' mapping :notify_url, 'server_url' mapping :return_url, 'result_url' end end end end end