Sha256: 77acc67cb1ceca367d9d5061ca4de1663c710c880978725001875731dd8aa4ce

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

module ActiveMerchant
  module Billing
    module StripeGatewayDecorator
      def self.prepended(base)
        base.class_eval do
          alias_method :original_headers, :headers
          alias_method :original_add_customer_data, :add_customer_data

          private

          def headers(options = {})
            headers = original_headers(options)
            headers['User-Agent'] = headers['X-Stripe-Client-User-Agent']
            headers
          end

          def add_customer_data(post, options)
            original_add_customer_data(post, options)
            post[:payment_user_agent] = "SpreeGateway/#{SpreeGateway.version}"
          end
        end
      end
    end
  end
end

ActiveMerchant::Billing::StripeGateway.prepend(ActiveMerchant::Billing::StripeGatewayDecorator)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_gateway-3.6.5 lib/active_merchant/billing/stripe_gateway_decorator.rb
spree_gateway-3.6.4 lib/active_merchant/billing/stripe_gateway_decorator.rb