Module: ActiveMerchant::Billing::StripeGatewayDecorator

Defined in:
lib/active_merchant/billing/stripe_gateway_decorator.rb

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/active_merchant/billing/stripe_gateway_decorator.rb', line 4

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