activemerchant_banklink 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/README.rdoc +2 -1
- data/lib/active_merchant/billing/integrations/banklink.rb +80 -67
- data/lib/active_merchant/billing/integrations/banklink/helper.rb +31 -18
- data/lib/active_merchant/billing/integrations/dnb_nord_ltu.rb +57 -0
- data/lib/active_merchant/billing/integrations/dnb_nord_ltu/common.rb +11 -0
- data/lib/active_merchant/billing/integrations/dnb_nord_ltu/helper.rb +24 -0
- data/lib/active_merchant/billing/integrations/dnb_nord_ltu/notification.rb +12 -0
- data/lib/active_merchant/billing/integrations/seb_ltu.rb +57 -0
- data/lib/active_merchant/billing/integrations/seb_ltu/common.rb +65 -0
- data/lib/active_merchant/billing/integrations/seb_ltu/helper.rb +25 -0
- data/lib/active_merchant/billing/integrations/seb_ltu/notification.rb +12 -0
- data/lib/activemerchant_banklink.rb +2 -0
- data/lib/activemerchant_banklink/version.rb +1 -1
- metadata +17 -6
    
        data/.gitignore
    CHANGED
    
    
    
        data/README.rdoc
    CHANGED
    
    
| @@ -27,72 +27,6 @@ module ActiveMerchant #:nodoc: | |
| 27 27 | 
             
                    #  end
         | 
| 28 28 | 
             
                    #end
         | 
| 29 29 |  | 
| 30 | 
            -
                    # Define required fields for each service message.
         | 
| 31 | 
            -
                    # We need to know this in order to calculate VK_MAC
         | 
| 32 | 
            -
                    # from a given hash of parameters.
         | 
| 33 | 
            -
                    # Order of the parameters is important.
         | 
| 34 | 
            -
                    mattr_accessor :required_service_params
         | 
| 35 | 
            -
                    self.required_service_params = {
         | 
| 36 | 
            -
                      1001 => [
         | 
| 37 | 
            -
                        'VK_SERVICE',
         | 
| 38 | 
            -
                        'VK_VERSION',
         | 
| 39 | 
            -
                        'VK_SND_ID',
         | 
| 40 | 
            -
                        'VK_STAMP',
         | 
| 41 | 
            -
                        'VK_AMOUNT',
         | 
| 42 | 
            -
                        'VK_CURR',
         | 
| 43 | 
            -
                        'VK_ACC',
         | 
| 44 | 
            -
                        'VK_NAME',
         | 
| 45 | 
            -
                        'VK_REF',
         | 
| 46 | 
            -
                        'VK_MSG'],
         | 
| 47 | 
            -
                      1002 => [
         | 
| 48 | 
            -
                        'VK_SERVICE',
         | 
| 49 | 
            -
                        'VK_VERSION',
         | 
| 50 | 
            -
                        'VK_SND_ID',
         | 
| 51 | 
            -
                        'VK_STAMP',
         | 
| 52 | 
            -
                        'VK_AMOUNT',
         | 
| 53 | 
            -
                        'VK_CURR',
         | 
| 54 | 
            -
                        'VK_REF',
         | 
| 55 | 
            -
                        'VK_MSG' ],
         | 
| 56 | 
            -
                      1101 => [
         | 
| 57 | 
            -
                        'VK_SERVICE',
         | 
| 58 | 
            -
                        'VK_VERSION',
         | 
| 59 | 
            -
                        'VK_SND_ID',
         | 
| 60 | 
            -
                        'VK_REC_ID',
         | 
| 61 | 
            -
                        'VK_STAMP',
         | 
| 62 | 
            -
                        'VK_T_NO',
         | 
| 63 | 
            -
                        'VK_AMOUNT',
         | 
| 64 | 
            -
                        'VK_CURR',
         | 
| 65 | 
            -
                        'VK_REC_ACC',
         | 
| 66 | 
            -
                        'VK_REC_NAME',
         | 
| 67 | 
            -
                        'VK_SND_ACC',
         | 
| 68 | 
            -
                        'VK_SND_NAME',
         | 
| 69 | 
            -
                        'VK_REF',
         | 
| 70 | 
            -
                        'VK_MSG',
         | 
| 71 | 
            -
                        'VK_T_DATE'],
         | 
| 72 | 
            -
                      1201 => [
         | 
| 73 | 
            -
                        'VK_SERVICE',
         | 
| 74 | 
            -
                        'VK_VERSION',
         | 
| 75 | 
            -
                        'VK_SND_ID',
         | 
| 76 | 
            -
                        'VK_REC_ID',
         | 
| 77 | 
            -
                        'VK_STAMP',
         | 
| 78 | 
            -
                        'VK_AMOUNT',
         | 
| 79 | 
            -
                        'VK_CURR',
         | 
| 80 | 
            -
                        'VK_REC_ACC',
         | 
| 81 | 
            -
                        'VK_REC_NAME',
         | 
| 82 | 
            -
                        'VK_SND_ACC',
         | 
| 83 | 
            -
                        'VK_SND_NAME',
         | 
| 84 | 
            -
                        'VK_REF',
         | 
| 85 | 
            -
                        'VK_MSG'],
         | 
| 86 | 
            -
                      1901 => [
         | 
| 87 | 
            -
                        'VK_SERVICE',
         | 
| 88 | 
            -
                        'VK_VERSION',
         | 
| 89 | 
            -
                        'VK_SND_ID',
         | 
| 90 | 
            -
                        'VK_REC_ID',
         | 
| 91 | 
            -
                        'VK_STAMP',
         | 
| 92 | 
            -
                        'VK_REF',
         | 
| 93 | 
            -
                        'VK_MSG']
         | 
| 94 | 
            -
                    }
         | 
| 95 | 
            -
             | 
| 96 30 | 
             
                    # Calculation using method VK_VERSION=008:
         | 
| 97 31 | 
             
                    # VK_MAC is RSA signature of the request fields coded into BASE64.
         | 
| 98 32 | 
             
                    # VK_MAC will be calculated using secret key of the sender using RSA. Signature will
         | 
| @@ -107,6 +41,85 @@ module ActiveMerchant #:nodoc: | |
| 107 41 | 
             
                    # d is RSA secret exponent
         | 
| 108 42 | 
             
                    # n is RSA modulus
         | 
| 109 43 | 
             
                    module Common
         | 
| 44 | 
            +
                      # Define required fields for each service message.
         | 
| 45 | 
            +
                      # We need to know this in order to calculate VK_MAC
         | 
| 46 | 
            +
                      # from a given hash of parameters.
         | 
| 47 | 
            +
                      # Order of the parameters is important.
         | 
| 48 | 
            +
                      def required_service_params
         | 
| 49 | 
            +
                        {
         | 
| 50 | 
            +
                          1001 => [
         | 
| 51 | 
            +
                            'VK_SERVICE',
         | 
| 52 | 
            +
                            'VK_VERSION',
         | 
| 53 | 
            +
                            'VK_SND_ID',
         | 
| 54 | 
            +
                            'VK_STAMP',
         | 
| 55 | 
            +
                            'VK_AMOUNT',
         | 
| 56 | 
            +
                            'VK_CURR',
         | 
| 57 | 
            +
                            'VK_ACC',
         | 
| 58 | 
            +
                            'VK_NAME',
         | 
| 59 | 
            +
                            'VK_REF',
         | 
| 60 | 
            +
                            'VK_MSG'],
         | 
| 61 | 
            +
                          2001 => [
         | 
| 62 | 
            +
                            'VK_SERVICE',
         | 
| 63 | 
            +
                            'VK_VERSION',
         | 
| 64 | 
            +
                            'VK_SND_ID',
         | 
| 65 | 
            +
                            'VK_STAMP',
         | 
| 66 | 
            +
                            'VK_AMOUNT',
         | 
| 67 | 
            +
                            'VK_CURR',
         | 
| 68 | 
            +
                            'VK_ACC',
         | 
| 69 | 
            +
                            'VK_PANK',
         | 
| 70 | 
            +
                            'VK_NAME',
         | 
| 71 | 
            +
                            'VK_REF',
         | 
| 72 | 
            +
                            'VK_MSG'],
         | 
| 73 | 
            +
                          1002 => [
         | 
| 74 | 
            +
                            'VK_SERVICE',
         | 
| 75 | 
            +
                            'VK_VERSION',
         | 
| 76 | 
            +
                            'VK_SND_ID',
         | 
| 77 | 
            +
                            'VK_STAMP',
         | 
| 78 | 
            +
                            'VK_AMOUNT',
         | 
| 79 | 
            +
                            'VK_CURR',
         | 
| 80 | 
            +
                            'VK_REF',
         | 
| 81 | 
            +
                            'VK_MSG' ],
         | 
| 82 | 
            +
                          1101 => [
         | 
| 83 | 
            +
                            'VK_SERVICE',
         | 
| 84 | 
            +
                            'VK_VERSION',
         | 
| 85 | 
            +
                            'VK_SND_ID',
         | 
| 86 | 
            +
                            'VK_REC_ID',
         | 
| 87 | 
            +
                            'VK_STAMP',
         | 
| 88 | 
            +
                            'VK_T_NO',
         | 
| 89 | 
            +
                            'VK_AMOUNT',
         | 
| 90 | 
            +
                            'VK_CURR',
         | 
| 91 | 
            +
                            'VK_REC_ACC',
         | 
| 92 | 
            +
                            'VK_REC_NAME',
         | 
| 93 | 
            +
                            'VK_SND_ACC',
         | 
| 94 | 
            +
                            'VK_SND_NAME',
         | 
| 95 | 
            +
                            'VK_REF',
         | 
| 96 | 
            +
                            'VK_MSG',
         | 
| 97 | 
            +
                            'VK_T_DATE'],
         | 
| 98 | 
            +
                          1201 => [
         | 
| 99 | 
            +
                            'VK_SERVICE',
         | 
| 100 | 
            +
                            'VK_VERSION',
         | 
| 101 | 
            +
                            'VK_SND_ID',
         | 
| 102 | 
            +
                            'VK_REC_ID',
         | 
| 103 | 
            +
                            'VK_STAMP',
         | 
| 104 | 
            +
                            'VK_AMOUNT',
         | 
| 105 | 
            +
                            'VK_CURR',
         | 
| 106 | 
            +
                            'VK_REC_ACC',
         | 
| 107 | 
            +
                            'VK_REC_NAME',
         | 
| 108 | 
            +
                            'VK_SND_ACC',
         | 
| 109 | 
            +
                            'VK_SND_NAME',
         | 
| 110 | 
            +
                            'VK_REF',
         | 
| 111 | 
            +
                            'VK_MSG'],
         | 
| 112 | 
            +
                          1901 => [
         | 
| 113 | 
            +
                            'VK_SERVICE',
         | 
| 114 | 
            +
                            'VK_VERSION',
         | 
| 115 | 
            +
                            'VK_SND_ID',
         | 
| 116 | 
            +
                            'VK_REC_ID',
         | 
| 117 | 
            +
                            'VK_STAMP',
         | 
| 118 | 
            +
                            'VK_REF',
         | 
| 119 | 
            +
                            'VK_MSG']
         | 
| 120 | 
            +
                        }
         | 
| 121 | 
            +
                      end
         | 
| 122 | 
            +
             | 
| 110 123 | 
             
                      # p(x) is the length of the field x in bytes, represented by three digits
         | 
| 111 124 | 
             
                      def func_p(val)
         | 
| 112 125 | 
             
                        sprintf("%03i", val.bytesize)
         | 
| @@ -120,7 +133,7 @@ module ActiveMerchant #:nodoc: | |
| 120 133 | 
             
                      # '003val1003val2006value3'
         | 
| 121 134 | 
             
                      def generate_data_string(service_msg_number, sigparams)
         | 
| 122 135 | 
             
                        str = ''
         | 
| 123 | 
            -
                         | 
| 136 | 
            +
                        required_service_params[Integer(service_msg_number)].each do |param|
         | 
| 124 137 | 
             
                          val = sigparams[param].to_s # nil goes to ''
         | 
| 125 138 | 
             
                          str << func_p(val) << val
         | 
| 126 139 | 
             
                        end
         | 
| @@ -23,19 +23,9 @@ module ActiveMerchant #:nodoc: | |
| 23 23 | 
             
                      end
         | 
| 24 24 |  | 
| 25 25 | 
             
                      def initialize(order, account, options = {})
         | 
| 26 | 
            -
                        old_valid_keys = [:amount, :currency, :test]
         | 
| 27 | 
            -
                        new_valid_keys = [:description, :reference]
         | 
| 28 | 
            -
                        valid_keys = (old_valid_keys + new_valid_keys + Banklink.required_service_params.values << :service_msg_number).uniq
         | 
| 29 | 
            -
                        options.assert_valid_keys(valid_keys)
         | 
| 30 | 
            -
             | 
| 31 26 | 
             
                        @options = options
         | 
| 32 | 
            -
                        @fields =  | 
| 33 | 
            -
                         | 
| 34 | 
            -
                        self.account = account
         | 
| 35 | 
            -
                        self.amount = options[:amount]
         | 
| 36 | 
            -
                        self.currency = options[:currency]
         | 
| 37 | 
            -
                        self.description = options[:description]
         | 
| 38 | 
            -
                        self.reference = options[:reference]
         | 
| 27 | 
            +
                        @fields = ActiveSupport::OrderedHash.new
         | 
| 28 | 
            +
                        @raw_html_fields = []
         | 
| 39 29 |  | 
| 40 30 | 
             
                        if options[:service_msg_number]
         | 
| 41 31 | 
             
                          @service_msg_number = options.delete(:service_msg_number)
         | 
| @@ -44,23 +34,46 @@ module ActiveMerchant #:nodoc: | |
| 44 34 | 
             
                        end
         | 
| 45 35 |  | 
| 46 36 | 
             
                        add_required_params
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                        self.order = order
         | 
| 39 | 
            +
                        self.account = account
         | 
| 40 | 
            +
                        self.amount = options[:amount]
         | 
| 41 | 
            +
                        self.currency = options[:currency]
         | 
| 42 | 
            +
                        self.description = options[:description]
         | 
| 43 | 
            +
                        self.reference = options[:reference]
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                        old_valid_keys = [:amount, :currency, :test]
         | 
| 46 | 
            +
                        new_valid_keys = [:description, :reference]
         | 
| 47 | 
            +
                        valid_keys = (old_valid_keys + new_valid_keys + required_service_params[@service_msg_number] << :service_msg_number).uniq
         | 
| 48 | 
            +
                        options.assert_valid_keys(valid_keys)
         | 
| 49 | 
            +
             | 
| 47 50 | 
             
                        add_charset_field
         | 
| 48 51 | 
             
                        add_vk_mac
         | 
| 49 52 | 
             
                      end
         | 
| 50 53 |  | 
| 54 | 
            +
                      def add_field(name, value)
         | 
| 55 | 
            +
                        return if name.blank?
         | 
| 56 | 
            +
                        @fields[name.to_s] = value.to_s
         | 
| 57 | 
            +
                      end
         | 
| 58 | 
            +
             | 
| 51 59 | 
             
                      # Amount can be supplied with a optional dot separator for cents.
         | 
| 52 60 | 
             
                      def amount=(amount)
         | 
| 53 61 | 
             
                        # TODO check this, sooner or later someone will get a wrong amount.
         | 
| 54 62 |  | 
| 63 | 
            +
                        amount = Money.new(amount) unless amount.is_a?(Money)
         | 
| 64 | 
            +
                        amount = "%0.2f" % amount
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                        add_field('VK_AMOUNT', amount)
         | 
| 67 | 
            +
             | 
| 55 68 | 
             
                        # If a string is passed to us, don't do anything.
         | 
| 56 69 | 
             
                        # If a Money object is passed to us, don't do anything.
         | 
| 57 70 | 
             
                        # Otherwise delegate the handling to the money object
         | 
| 58 71 | 
             
                        # and free ourself from the responsibility, yay.
         | 
| 59 | 
            -
                        if amount.is_a?(String) || amount.is_a?(Money)
         | 
| 60 | 
            -
             | 
| 61 | 
            -
                        else
         | 
| 62 | 
            -
             | 
| 63 | 
            -
                        end
         | 
| 72 | 
            +
                        #if amount.is_a?(String) || amount.is_a?(Money)
         | 
| 73 | 
            +
                        #  add_field('VK_AMOUNT', amount)
         | 
| 74 | 
            +
                        #else
         | 
| 75 | 
            +
                        #  add_field('VK_AMOUNT', Money.new(amount))
         | 
| 76 | 
            +
                        #end
         | 
| 64 77 | 
             
                      end
         | 
| 65 78 |  | 
| 66 79 | 
             
                      def add_vk_mac
         | 
| @@ -73,7 +86,7 @@ module ActiveMerchant #:nodoc: | |
| 73 86 | 
             
                      end
         | 
| 74 87 |  | 
| 75 88 | 
             
                      def add_required_params
         | 
| 76 | 
            -
                        required_params =  | 
| 89 | 
            +
                        required_params = required_service_params[@service_msg_number]
         | 
| 77 90 | 
             
                        required_params.each do |param|
         | 
| 78 91 | 
             
                          param_value = (@options.delete(param) || send(param.to_s.downcase)).to_s
         | 
| 79 92 | 
             
                          add_field param, iconv.iconv(param_value)
         | 
| @@ -0,0 +1,57 @@ | |
| 1 | 
            +
            require File.dirname(__FILE__) + '/dnb_nord_ltu/common.rb'
         | 
| 2 | 
            +
            require File.dirname(__FILE__) + '/dnb_nord_ltu/helper.rb'
         | 
| 3 | 
            +
            require File.dirname(__FILE__) + '/dnb_nord_ltu/notification.rb'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module ActiveMerchant #:nodoc:
         | 
| 6 | 
            +
              module Billing #:nodoc:
         | 
| 7 | 
            +
                module Integrations #:nodoc:
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  module DnbNordLtu
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    # Raw X509 certificate of the bank, string format.
         | 
| 12 | 
            +
                    mattr_accessor :bank_certificate
         | 
| 13 | 
            +
                    mattr_accessor :test_bank_certificate
         | 
| 14 | 
            +
                    # RSA public key of the bank, taken from the X509 certificate of the bank. OpenSSL container.
         | 
| 15 | 
            +
                    def self.get_bank_public_key
         | 
| 16 | 
            +
                      if ActiveMerchant::Billing::Base.integration_mode == :production
         | 
| 17 | 
            +
                        cert = self.bank_certificate
         | 
| 18 | 
            +
                      else
         | 
| 19 | 
            +
                        cert = self.test_bank_certificate
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
                      OpenSSL::X509::Certificate.new(cert.gsub(/  /, '')).public_key
         | 
| 22 | 
            +
                    end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                    mattr_accessor :private_key
         | 
| 25 | 
            +
                    mattr_accessor :test_private_key
         | 
| 26 | 
            +
                    # Our RSA private key. OpenSSL container.
         | 
| 27 | 
            +
                    def self.get_private_key
         | 
| 28 | 
            +
                      if ActiveMerchant::Billing::Base.integration_mode == :production
         | 
| 29 | 
            +
                        private_key = self.private_key
         | 
| 30 | 
            +
                      else
         | 
| 31 | 
            +
                        private_key = self.test_private_key
         | 
| 32 | 
            +
                      end
         | 
| 33 | 
            +
                      OpenSSL::PKey::RSA.new(private_key.gsub(/  /, ''))
         | 
| 34 | 
            +
                    end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    mattr_accessor :test_url
         | 
| 37 | 
            +
                    mattr_accessor :production_url
         | 
| 38 | 
            +
                    def self.service_url
         | 
| 39 | 
            +
                      mode = ActiveMerchant::Billing::Base.integration_mode
         | 
| 40 | 
            +
                      case mode
         | 
| 41 | 
            +
                      when :production
         | 
| 42 | 
            +
                        self.production_url
         | 
| 43 | 
            +
                      when :test
         | 
| 44 | 
            +
                        self.test_url
         | 
| 45 | 
            +
                      else
         | 
| 46 | 
            +
                        raise StandardError, "Integration mode set to an invalid value: #{mode}"
         | 
| 47 | 
            +
                      end
         | 
| 48 | 
            +
                    end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    def self.notification(post)
         | 
| 51 | 
            +
                      Notification.new(post)
         | 
| 52 | 
            +
                    end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
            end
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            module ActiveMerchant #:nodoc:
         | 
| 2 | 
            +
              module Billing #:nodoc:
         | 
| 3 | 
            +
                module Integrations #:nodoc:
         | 
| 4 | 
            +
                  module DnbNordLtu #:nodoc:
         | 
| 5 | 
            +
                    class Helper < ActiveMerchant::Billing::Integrations::Helper #:nodoc:
         | 
| 6 | 
            +
                      include DnbNordLtu::Common
         | 
| 7 | 
            +
                      include Banklink::Helper
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                      def default_service_msg_number
         | 
| 10 | 
            +
                        2001
         | 
| 11 | 
            +
                      end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                      def vk_charset
         | 
| 14 | 
            +
                        'ISO-8859-13'
         | 
| 15 | 
            +
                      end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                      def add_charset_field
         | 
| 18 | 
            +
                        # skip
         | 
| 19 | 
            +
                      end
         | 
| 20 | 
            +
                    end
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            module ActiveMerchant #:nodoc:
         | 
| 2 | 
            +
              module Billing #:nodoc:
         | 
| 3 | 
            +
                module Integrations #:nodoc:
         | 
| 4 | 
            +
                  module DnbNordLtu #:nodoc:
         | 
| 5 | 
            +
                    class Notification < ActiveMerchant::Billing::Integrations::Notification #:nodoc:
         | 
| 6 | 
            +
                      include DnbNordLtu::Common
         | 
| 7 | 
            +
                      include Banklink::Notification
         | 
| 8 | 
            +
                    end
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
| @@ -0,0 +1,57 @@ | |
| 1 | 
            +
            require File.dirname(__FILE__) + '/seb_ltu/common.rb'
         | 
| 2 | 
            +
            require File.dirname(__FILE__) + '/seb_ltu/helper.rb'
         | 
| 3 | 
            +
            require File.dirname(__FILE__) + '/seb_ltu/notification.rb'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module ActiveMerchant #:nodoc:
         | 
| 6 | 
            +
              module Billing #:nodoc:
         | 
| 7 | 
            +
                module Integrations #:nodoc:
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  module SebLtu
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    # Raw X509 certificate of the bank, string format.
         | 
| 12 | 
            +
                    mattr_accessor :bank_certificate
         | 
| 13 | 
            +
                    mattr_accessor :test_bank_certificate
         | 
| 14 | 
            +
                    # RSA public key of the bank, taken from the X509 certificate of the bank. OpenSSL container.
         | 
| 15 | 
            +
                    def self.get_bank_public_key
         | 
| 16 | 
            +
                      if ActiveMerchant::Billing::Base.integration_mode == :production
         | 
| 17 | 
            +
                        cert = self.bank_certificate
         | 
| 18 | 
            +
                      else
         | 
| 19 | 
            +
                        cert = self.test_bank_certificate
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
                      OpenSSL::X509::Certificate.new(cert.gsub(/  /, '')).public_key
         | 
| 22 | 
            +
                    end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                    mattr_accessor :private_key
         | 
| 25 | 
            +
                    mattr_accessor :test_private_key
         | 
| 26 | 
            +
                    # Our RSA private key. OpenSSL container.
         | 
| 27 | 
            +
                    def self.get_private_key
         | 
| 28 | 
            +
                      if ActiveMerchant::Billing::Base.integration_mode == :production
         | 
| 29 | 
            +
                        private_key = self.private_key
         | 
| 30 | 
            +
                      else
         | 
| 31 | 
            +
                        private_key = self.test_private_key
         | 
| 32 | 
            +
                      end
         | 
| 33 | 
            +
                      OpenSSL::PKey::RSA.new(private_key.gsub(/  /, ''))
         | 
| 34 | 
            +
                    end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    mattr_accessor :test_url
         | 
| 37 | 
            +
                    mattr_accessor :production_url
         | 
| 38 | 
            +
                    def self.service_url
         | 
| 39 | 
            +
                      mode = ActiveMerchant::Billing::Base.integration_mode
         | 
| 40 | 
            +
                      case mode
         | 
| 41 | 
            +
                      when :production
         | 
| 42 | 
            +
                        self.production_url
         | 
| 43 | 
            +
                      when :test
         | 
| 44 | 
            +
                        self.test_url
         | 
| 45 | 
            +
                      else
         | 
| 46 | 
            +
                        raise StandardError, "Integration mode set to an invalid value: #{mode}"
         | 
| 47 | 
            +
                      end
         | 
| 48 | 
            +
                    end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    def self.notification(post)
         | 
| 51 | 
            +
                      Notification.new(post)
         | 
| 52 | 
            +
                    end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
            end
         | 
| @@ -0,0 +1,65 @@ | |
| 1 | 
            +
            module ActiveMerchant #:nodoc:
         | 
| 2 | 
            +
              module Billing #:nodoc:
         | 
| 3 | 
            +
                module Integrations #:nodoc:
         | 
| 4 | 
            +
                  module SebLtu #:nodoc:
         | 
| 5 | 
            +
                    module Common
         | 
| 6 | 
            +
                      include Banklink::Common
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                      def required_service_params
         | 
| 9 | 
            +
                        {
         | 
| 10 | 
            +
                          1001 => [
         | 
| 11 | 
            +
                            'VK_SERVICE',
         | 
| 12 | 
            +
                            'VK_VERSION',
         | 
| 13 | 
            +
                            'VK_SND_ID',
         | 
| 14 | 
            +
                            'VK_STAMP',
         | 
| 15 | 
            +
                            'VK_AMOUNT',
         | 
| 16 | 
            +
                            'VK_CURR',
         | 
| 17 | 
            +
                            'VK_ACC',
         | 
| 18 | 
            +
                            'VK_NAME',
         | 
| 19 | 
            +
                            'VK_REF',
         | 
| 20 | 
            +
                            'VK_MSG'],
         | 
| 21 | 
            +
                          1101 => [
         | 
| 22 | 
            +
                            'VK_SERVICE',
         | 
| 23 | 
            +
                            'VK_VERSION',
         | 
| 24 | 
            +
                            'VK_SND_ID',
         | 
| 25 | 
            +
                            'VK_REC_ID',
         | 
| 26 | 
            +
                            'VK_STAMP',
         | 
| 27 | 
            +
                            'VK_T_NO',
         | 
| 28 | 
            +
                            'VK_AMOUNT',
         | 
| 29 | 
            +
                            'VK_CURR',
         | 
| 30 | 
            +
                            'VK_REC_ACC',
         | 
| 31 | 
            +
                            'VK_REC_NAME',
         | 
| 32 | 
            +
                            'VK_SND_ACC',
         | 
| 33 | 
            +
                            'VK_SND_NAME',
         | 
| 34 | 
            +
                            'VK_REF',
         | 
| 35 | 
            +
                            'VK_MSG',
         | 
| 36 | 
            +
                            'VK_T_DATE'],
         | 
| 37 | 
            +
                          1201 => [
         | 
| 38 | 
            +
                            'VK_SERVICE',
         | 
| 39 | 
            +
                            'VK_VERSION',
         | 
| 40 | 
            +
                            'VK_SND_ID',
         | 
| 41 | 
            +
                            'VK_REC_ID',
         | 
| 42 | 
            +
                            'VK_STAMP',
         | 
| 43 | 
            +
                            'VK_AMOUNT',
         | 
| 44 | 
            +
                            'VK_CURR',
         | 
| 45 | 
            +
                            'VK_ACC',
         | 
| 46 | 
            +
                            'VK_REC_NAME',
         | 
| 47 | 
            +
                            'VK_SND_ACC',
         | 
| 48 | 
            +
                            'VK_SND_NAME',
         | 
| 49 | 
            +
                            'VK_REF',
         | 
| 50 | 
            +
                            'VK_MSG'],
         | 
| 51 | 
            +
                          1901 => [
         | 
| 52 | 
            +
                            'VK_SERVICE',
         | 
| 53 | 
            +
                            'VK_VERSION',
         | 
| 54 | 
            +
                            'VK_SND_ID',
         | 
| 55 | 
            +
                            'VK_REC_ID',
         | 
| 56 | 
            +
                            'VK_STAMP',
         | 
| 57 | 
            +
                            'VK_REF',
         | 
| 58 | 
            +
                            'VK_MSG']
         | 
| 59 | 
            +
                        }
         | 
| 60 | 
            +
                      end
         | 
| 61 | 
            +
                    end
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
            end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            module ActiveMerchant #:nodoc:
         | 
| 2 | 
            +
              module Billing #:nodoc:
         | 
| 3 | 
            +
                module Integrations #:nodoc:
         | 
| 4 | 
            +
                  module SebLtu #:nodoc:
         | 
| 5 | 
            +
                    class Helper < ActiveMerchant::Billing::Integrations::Helper #:nodoc:
         | 
| 6 | 
            +
                      include SebLtu::Common
         | 
| 7 | 
            +
                      include Banklink::Helper
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                      def default_service_msg_number
         | 
| 10 | 
            +
                        1001
         | 
| 11 | 
            +
                      end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                      def vk_charset
         | 
| 14 | 
            +
                        'ISO-8859-13'
         | 
| 15 | 
            +
                      end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                      def add_charset_field
         | 
| 18 | 
            +
                        # skip
         | 
| 19 | 
            +
                      end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                    end
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            module ActiveMerchant #:nodoc:
         | 
| 2 | 
            +
              module Billing #:nodoc:
         | 
| 3 | 
            +
                module Integrations #:nodoc:
         | 
| 4 | 
            +
                  module SebLtu #:nodoc:
         | 
| 5 | 
            +
                    class Notification < ActiveMerchant::Billing::Integrations::Notification #:nodoc:
         | 
| 6 | 
            +
                      include SebLtu::Common
         | 
| 7 | 
            +
                      include Banklink::Notification
         | 
| 8 | 
            +
                    end
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
| @@ -4,3 +4,5 @@ require 'active_merchant/billing/integrations/swedbank_est' | |
| 4 4 | 
             
            require 'active_merchant/billing/integrations/seb_est'
         | 
| 5 5 | 
             
            require 'active_merchant/billing/integrations/sampo_est'
         | 
| 6 6 | 
             
            require 'active_merchant/billing/integrations/swedbank_ltu'
         | 
| 7 | 
            +
            require 'active_merchant/billing/integrations/seb_ltu'
         | 
| 8 | 
            +
            require 'active_merchant/billing/integrations/dnb_nord_ltu'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: activemerchant_banklink
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.6
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -10,8 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date:  | 
| 14 | 
            -
            default_executable: 
         | 
| 13 | 
            +
            date: 2012-12-30 00:00:00.000000000 Z
         | 
| 15 14 | 
             
            dependencies: []
         | 
| 16 15 | 
             
            description: Adds Banklink support to ActiveMerchant library. Banklink is provided
         | 
| 17 16 | 
             
              by major banks in the Baltic states.
         | 
| @@ -31,12 +30,20 @@ files: | |
| 31 30 | 
             
            - lib/active_merchant/billing/integrations/banklink.rb
         | 
| 32 31 | 
             
            - lib/active_merchant/billing/integrations/banklink/helper.rb
         | 
| 33 32 | 
             
            - lib/active_merchant/billing/integrations/banklink/notification.rb
         | 
| 33 | 
            +
            - lib/active_merchant/billing/integrations/dnb_nord_ltu.rb
         | 
| 34 | 
            +
            - lib/active_merchant/billing/integrations/dnb_nord_ltu/common.rb
         | 
| 35 | 
            +
            - lib/active_merchant/billing/integrations/dnb_nord_ltu/helper.rb
         | 
| 36 | 
            +
            - lib/active_merchant/billing/integrations/dnb_nord_ltu/notification.rb
         | 
| 34 37 | 
             
            - lib/active_merchant/billing/integrations/sampo_est.rb
         | 
| 35 38 | 
             
            - lib/active_merchant/billing/integrations/sampo_est/helper.rb
         | 
| 36 39 | 
             
            - lib/active_merchant/billing/integrations/sampo_est/notification.rb
         | 
| 37 40 | 
             
            - lib/active_merchant/billing/integrations/seb_est.rb
         | 
| 38 41 | 
             
            - lib/active_merchant/billing/integrations/seb_est/helper.rb
         | 
| 39 42 | 
             
            - lib/active_merchant/billing/integrations/seb_est/notification.rb
         | 
| 43 | 
            +
            - lib/active_merchant/billing/integrations/seb_ltu.rb
         | 
| 44 | 
            +
            - lib/active_merchant/billing/integrations/seb_ltu/common.rb
         | 
| 45 | 
            +
            - lib/active_merchant/billing/integrations/seb_ltu/helper.rb
         | 
| 46 | 
            +
            - lib/active_merchant/billing/integrations/seb_ltu/notification.rb
         | 
| 40 47 | 
             
            - lib/active_merchant/billing/integrations/swedbank_est.rb
         | 
| 41 48 | 
             
            - lib/active_merchant/billing/integrations/swedbank_est/helper.rb
         | 
| 42 49 | 
             
            - lib/active_merchant/billing/integrations/swedbank_est/notification.rb
         | 
| @@ -50,7 +57,6 @@ files: | |
| 50 57 | 
             
            - test/unit/integrations/sampo_est_module_test.rb
         | 
| 51 58 | 
             
            - test/unit/integrations/seb_est_module_test.rb
         | 
| 52 59 | 
             
            - test/unit/integrations/swedbank_est_module_test.rb
         | 
| 53 | 
            -
            has_rdoc: true
         | 
| 54 60 | 
             
            homepage: http://github.com/laurynas/activemerchant_banklink
         | 
| 55 61 | 
             
            licenses: []
         | 
| 56 62 | 
             
            post_install_message: 
         | 
| @@ -71,8 +77,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 71 77 | 
             
                  version: '0'
         | 
| 72 78 | 
             
            requirements: []
         | 
| 73 79 | 
             
            rubyforge_project: activemerchant_banklink
         | 
| 74 | 
            -
            rubygems_version: 1. | 
| 80 | 
            +
            rubygems_version: 1.8.24
         | 
| 75 81 | 
             
            signing_key: 
         | 
| 76 82 | 
             
            specification_version: 3
         | 
| 77 83 | 
             
            summary: ActiveMerchant Banklink add-on (alpha version)
         | 
| 78 | 
            -
            test_files: | 
| 84 | 
            +
            test_files:
         | 
| 85 | 
            +
            - test/test_helper.rb
         | 
| 86 | 
            +
            - test/unit/integrations/notifications/seb_est_notification_test.rb
         | 
| 87 | 
            +
            - test/unit/integrations/sampo_est_module_test.rb
         | 
| 88 | 
            +
            - test/unit/integrations/seb_est_module_test.rb
         | 
| 89 | 
            +
            - test/unit/integrations/swedbank_est_module_test.rb
         |