Sha256: 062b821c82bda081d6f13998699b27db47d90dcc8b2709df9b48ec0bf1433cd7
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
require 'paypalhttp' require "base64" module PayPal SANDBOXAPI = 'https://api.sandbox.paypal.com' LIVEAPI = 'https://api.paypal.com' SANDBOXWEB = 'https://sandbox.paypal.com' LIVEWEB = 'https://paypal.com' class PayPalEnvironment < PayPalHttp::Environment attr_accessor :client_id, :client_secret, :web_url def initialize(client_id, client_secret, base_url, web_url) super(base_url) @client_id = client_id @client_secret = client_secret @web_url = web_url end def authorizationString encoded = Base64.strict_encode64("#{@client_id}:#{@client_secret}") return "Basic #{encoded}" end end class SandboxEnvironment < PayPal::PayPalEnvironment def initialize(client_id, client_secret) super(client_id, client_secret, PayPal::SANDBOXAPI, PayPal::SANDBOXWEB) end end class LiveEnvironment < PayPal::PayPalEnvironment def initialize(client_id, client_secret) super(client_id, client_secret, PayPal::LIVEAPI, PayPal::LIVEWEB) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
paypal-payouts-sdk-2.0.1 | lib/core/paypal_environment.rb |
paypal-payouts-sdk-1.0.1 | lib/core/paypal_environment.rb |
paypal-payouts-sdk-1.0.0 | lib/core/paypal_environment.rb |