flexpay 0.1.0
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/lib/flexpay.rb +107 -0
 - data/lib/flexpay/api_module.rb +18 -0
 - data/lib/flexpay/cobranding_api/v2009_01_09.rb +9 -0
 - data/lib/flexpay/cobranding_api/v2009_01_09/pipelines.rb +19 -0
 - data/lib/flexpay/exceptions.rb +3 -0
 - data/lib/flexpay/fps_api/v2008_09_17.rb +10 -0
 - data/lib/flexpay/fps_api/v2008_09_17/pay.rb +21 -0
 - data/lib/flexpay/fps_api/v2008_09_17/verify_signature.rb +20 -0
 - data/lib/flexpay/request.rb +100 -0
 - data/lib/flexpay/util.rb +26 -0
 - data/spec/integrations/integrations_helper.rb +8 -0
 - data/spec/spec_helper.rb +4 -0
 - data/spec/units/api_spec.rb +23 -0
 - data/spec/units/pay_spec.rb +36 -0
 - data/spec/units/recurring_pipeline_spec.rb +33 -0
 - data/spec/units/signature_spec.rb +20 -0
 - data/spec/units/units_helper.rb +5 -0
 - data/spec/units/verify_signature_spec.rb +32 -0
 - metadata +101 -0
 
    
        data/lib/flexpay.rb
    ADDED
    
    | 
         @@ -0,0 +1,107 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'openssl'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'net/https'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'date'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'base64'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            require 'flexpay/request'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'flexpay/api_module'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            require 'flexpay/cobranding_api/v2009_01_09'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'flexpay/fps_api/v2008_09_17'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            require 'flexpay/util'
         
     | 
| 
      
 16 
     | 
    
         
            +
            require 'flexpay/exceptions'
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            module Flexpay
         
     | 
| 
      
 19 
     | 
    
         
            +
              class API
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                API_ENDPOINT = 'https://fps.amazonaws.com/'.freeze
         
     | 
| 
      
 22 
     | 
    
         
            +
                API_SANDBOX_ENDPOINT = 'https://fps.sandbox.amazonaws.com/'.freeze
         
     | 
| 
      
 23 
     | 
    
         
            +
                PIPELINE_URL = 'https://authorize.payments.amazon.com/cobranded-ui/actions/start'.freeze
         
     | 
| 
      
 24 
     | 
    
         
            +
                PIPELINE_SANDBOX_URL = 'https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start'.freeze
         
     | 
| 
      
 25 
     | 
    
         
            +
                API_VERSION = Date.new(2008, 9, 17).to_s.freeze
         
     | 
| 
      
 26 
     | 
    
         
            +
                SIGNATURE_VERSION = 2.freeze
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                attr_reader :access_key
         
     | 
| 
      
 29 
     | 
    
         
            +
                attr_reader :secret_key
         
     | 
| 
      
 30 
     | 
    
         
            +
                attr_reader :fps_url
         
     | 
| 
      
 31 
     | 
    
         
            +
                attr_reader :pipeline_url
         
     | 
| 
      
 32 
     | 
    
         
            +
                attr_reader :cobranding_version
         
     | 
| 
      
 33 
     | 
    
         
            +
                attr_reader :fps_version
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                def initialize(params)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  @access_key = params[:access_key]
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @secret_key = params[:secret_key]
         
     | 
| 
      
 38 
     | 
    
         
            +
                  @cobranding_version = params[:cobranding_version] || "2009-01-09"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  @fps_version = params[:fps_version] || "2008-09-17"
         
     | 
| 
      
 40 
     | 
    
         
            +
                  
         
     | 
| 
      
 41 
     | 
    
         
            +
                  if params[:sandbox].nil? or params[:sandbox] == true
         
     | 
| 
      
 42 
     | 
    
         
            +
                    @pipeline_url = PIPELINE_SANDBOX_URL
         
     | 
| 
      
 43 
     | 
    
         
            +
                    @fps_url = API_SANDBOX_ENDPOINT
         
     | 
| 
      
 44 
     | 
    
         
            +
                  else
         
     | 
| 
      
 45 
     | 
    
         
            +
                    @pipeline_url = PIPELINE_URL
         
     | 
| 
      
 46 
     | 
    
         
            +
                    @fps_url = API_ENDPOINT
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
                
         
     | 
| 
      
 51 
     | 
    
         
            +
                def get_recurring_pipeline
         
     | 
| 
      
 52 
     | 
    
         
            +
                  obj = cobranding_constant_lookup(:RecurringPipeline).new
         
     | 
| 
      
 53 
     | 
    
         
            +
                  supply_defaults_for_pipeline_and_return(obj)
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
                
         
     | 
| 
      
 56 
     | 
    
         
            +
                def get_verify_signature
         
     | 
| 
      
 57 
     | 
    
         
            +
                  obj = fps_constant_lookup(:VerifySignature).new
         
     | 
| 
      
 58 
     | 
    
         
            +
                  supply_defaults_for_fps_and_return(obj)
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
                
         
     | 
| 
      
 61 
     | 
    
         
            +
                def get_pay
         
     | 
| 
      
 62 
     | 
    
         
            +
                  obj = fps_constant_lookup(:Pay).new
         
     | 
| 
      
 63 
     | 
    
         
            +
                  supply_defaults_for_fps_and_return(obj)
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
                
         
     | 
| 
      
 66 
     | 
    
         
            +
                # def version
         
     | 
| 
      
 67 
     | 
    
         
            +
                #   raise APINotConfigured if @version.nil? || @version.empty?
         
     | 
| 
      
 68 
     | 
    
         
            +
                #   @version
         
     | 
| 
      
 69 
     | 
    
         
            +
                # end
         
     | 
| 
      
 70 
     | 
    
         
            +
                
         
     | 
| 
      
 71 
     | 
    
         
            +
                def access_key
         
     | 
| 
      
 72 
     | 
    
         
            +
                  raise APINotConfigured if @access_key.nil? || @access_key.empty?
         
     | 
| 
      
 73 
     | 
    
         
            +
                  @access_key
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
      
 75 
     | 
    
         
            +
                
         
     | 
| 
      
 76 
     | 
    
         
            +
                def secret_key
         
     | 
| 
      
 77 
     | 
    
         
            +
                  raise APINotConfigured if @secret_key.nil? || @secret_key.empty?
         
     | 
| 
      
 78 
     | 
    
         
            +
                  @secret_key
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
                
         
     | 
| 
      
 81 
     | 
    
         
            +
                private
         
     | 
| 
      
 82 
     | 
    
         
            +
                
         
     | 
| 
      
 83 
     | 
    
         
            +
                def cobranding_constant_lookup(sym)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  Flexpay::CobrandingAPI.const_get("V#{@cobranding_version.gsub(/-/,'_')}".to_sym).specific_class(sym)
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
                
         
     | 
| 
      
 87 
     | 
    
         
            +
                def fps_constant_lookup(sym)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  Flexpay::FpsAPI.const_get("V#{@fps_version.gsub(/-/,'_')}".to_sym).specific_class(sym)
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
                
         
     | 
| 
      
 91 
     | 
    
         
            +
                def supply_defaults_for_pipeline_and_return(obj)
         
     | 
| 
      
 92 
     | 
    
         
            +
                  obj.access_key = @access_key
         
     | 
| 
      
 93 
     | 
    
         
            +
                  obj.secret_key = @secret_key
         
     | 
| 
      
 94 
     | 
    
         
            +
                  obj.endpoint = @pipeline_url
         
     | 
| 
      
 95 
     | 
    
         
            +
                  obj.callerKey = @access_key # The pipeline API uses this alias
         
     | 
| 
      
 96 
     | 
    
         
            +
                  obj
         
     | 
| 
      
 97 
     | 
    
         
            +
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
                
         
     | 
| 
      
 99 
     | 
    
         
            +
                def supply_defaults_for_fps_and_return(obj)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  obj.access_key = @access_key
         
     | 
| 
      
 101 
     | 
    
         
            +
                  obj.secret_key = @secret_key
         
     | 
| 
      
 102 
     | 
    
         
            +
                  obj.endpoint = @fps_url
         
     | 
| 
      
 103 
     | 
    
         
            +
                  obj
         
     | 
| 
      
 104 
     | 
    
         
            +
                end
         
     | 
| 
      
 105 
     | 
    
         
            +
                
         
     | 
| 
      
 106 
     | 
    
         
            +
              end
         
     | 
| 
      
 107 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Flexpay
         
     | 
| 
      
 2 
     | 
    
         
            +
              module APIModule
         
     | 
| 
      
 3 
     | 
    
         
            +
                def self.included(mod)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  mod.class_eval do
         
     | 
| 
      
 5 
     | 
    
         
            +
                    self.class_variable_set(:@@included_in, {})
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    def self.included(mod)
         
     | 
| 
      
 8 
     | 
    
         
            +
                      class_variable_get(:@@included_in)[mod.to_s.split('::').last.to_sym] = mod
         
     | 
| 
      
 9 
     | 
    
         
            +
                    end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    def self.specific_class(lookup_sym)
         
     | 
| 
      
 12 
     | 
    
         
            +
                      class_variable_get(:@@included_in)[lookup_sym]
         
     | 
| 
      
 13 
     | 
    
         
            +
                    end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Flexpay
         
     | 
| 
      
 2 
     | 
    
         
            +
              module CobrandingAPI
         
     | 
| 
      
 3 
     | 
    
         
            +
                module V2009_01_09
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class RecurringPipeline
         
     | 
| 
      
 5 
     | 
    
         
            +
                    include Flexpay::CobrandingAPI::V2009_01_09
         
     | 
| 
      
 6 
     | 
    
         
            +
                    include Flexpay::AmazonFPSRequest
         
     | 
| 
      
 7 
     | 
    
         
            +
                  
         
     | 
| 
      
 8 
     | 
    
         
            +
                    required_parameters "pipelineName","callerReference", "recipientToken", "transactionAmount", "recurringPeriod", "returnURL",
         
     | 
| 
      
 9 
     | 
    
         
            +
                        "version", "callerKey"
         
     | 
| 
      
 10 
     | 
    
         
            +
                  
         
     | 
| 
      
 11 
     | 
    
         
            +
                    def initialize
         
     | 
| 
      
 12 
     | 
    
         
            +
                      self.pipelineName = "Recurring"
         
     | 
| 
      
 13 
     | 
    
         
            +
                      self.version = "2009-01-09"
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Flexpay
         
     | 
| 
      
 2 
     | 
    
         
            +
              module FpsAPI
         
     | 
| 
      
 3 
     | 
    
         
            +
                module V2008_09_17
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Pay
         
     | 
| 
      
 5 
     | 
    
         
            +
                    include Flexpay::FpsAPI::V2008_09_17
         
     | 
| 
      
 6 
     | 
    
         
            +
                    include Flexpay::AmazonFPSRequest
         
     | 
| 
      
 7 
     | 
    
         
            +
                  
         
     | 
| 
      
 8 
     | 
    
         
            +
                    required_parameters "CallerReference", "SenderTokenId", "TransactionAmount_Value", "TransactionAmount_CurrencyCode", "Action", "AWSAccessKeyId", "Timestamp", "Version"
         
     | 
| 
      
 9 
     | 
    
         
            +
                  
         
     | 
| 
      
 10 
     | 
    
         
            +
                    response_parameters :TransactionId => "/'PayResponse'/'PayResult'/'TransactionId'",
         
     | 
| 
      
 11 
     | 
    
         
            +
                                        :TransactionStatus => "/'PayResponse'/'PayResult'/'TransactionStatus'"
         
     | 
| 
      
 12 
     | 
    
         
            +
                  
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize
         
     | 
| 
      
 14 
     | 
    
         
            +
                      self.Action = "Pay"
         
     | 
| 
      
 15 
     | 
    
         
            +
                      self.Version = "2008-09-17"
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                  
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Flexpay
         
     | 
| 
      
 2 
     | 
    
         
            +
              module FpsAPI
         
     | 
| 
      
 3 
     | 
    
         
            +
                module V2008_09_17
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class VerifySignature
         
     | 
| 
      
 5 
     | 
    
         
            +
                    include Flexpay::FpsAPI::V2008_09_17
         
     | 
| 
      
 6 
     | 
    
         
            +
                    include Flexpay::AmazonFPSRequest
         
     | 
| 
      
 7 
     | 
    
         
            +
                  
         
     | 
| 
      
 8 
     | 
    
         
            +
                    required_parameters "UrlEndPoint", "HttpParameters", "Action", "Version"
         
     | 
| 
      
 9 
     | 
    
         
            +
                  
         
     | 
| 
      
 10 
     | 
    
         
            +
                    response_parameters :VerificationStatus => "/'VerifySignatureResponse'/'VerifySignatureResult'/'VerificationStatus'"
         
     | 
| 
      
 11 
     | 
    
         
            +
                  
         
     | 
| 
      
 12 
     | 
    
         
            +
                    def initialize
         
     | 
| 
      
 13 
     | 
    
         
            +
                      self.Action = "VerifySignature"
         
     | 
| 
      
 14 
     | 
    
         
            +
                      self.Version = "2008-09-17"
         
     | 
| 
      
 15 
     | 
    
         
            +
                    end
         
     | 
| 
      
 16 
     | 
    
         
            +
                  
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,100 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rest_client'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'cgi'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'hpricot'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module Flexpay
         
     | 
| 
      
 8 
     | 
    
         
            +
              module Flexpay::AmazonFPSRequest
         
     | 
| 
      
 9 
     | 
    
         
            +
                
         
     | 
| 
      
 10 
     | 
    
         
            +
                def self.included(mod)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  mod.class_eval do
         
     | 
| 
      
 12 
     | 
    
         
            +
                    
         
     | 
| 
      
 13 
     | 
    
         
            +
                    @param_list
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @response_parameters
         
     | 
| 
      
 15 
     | 
    
         
            +
                    
         
     | 
| 
      
 16 
     | 
    
         
            +
                    attr_accessor :access_key
         
     | 
| 
      
 17 
     | 
    
         
            +
                    attr_accessor :secret_key
         
     | 
| 
      
 18 
     | 
    
         
            +
                    attr_accessor :endpoint
         
     | 
| 
      
 19 
     | 
    
         
            +
                    
         
     | 
| 
      
 20 
     | 
    
         
            +
                    def self.required_parameters(*params)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      @param_list = params
         
     | 
| 
      
 22 
     | 
    
         
            +
                      params.each do |p|
         
     | 
| 
      
 23 
     | 
    
         
            +
                        attr_accessor p.to_sym
         
     | 
| 
      
 24 
     | 
    
         
            +
                      end
         
     | 
| 
      
 25 
     | 
    
         
            +
                    end
         
     | 
| 
      
 26 
     | 
    
         
            +
                    
         
     | 
| 
      
 27 
     | 
    
         
            +
                    def self.response_parameters(params)
         
     | 
| 
      
 28 
     | 
    
         
            +
                      @response_parameters = {}
         
     | 
| 
      
 29 
     | 
    
         
            +
                      params.each do |k,v|
         
     | 
| 
      
 30 
     | 
    
         
            +
                        @response_parameters[k] = v
         
     | 
| 
      
 31 
     | 
    
         
            +
                      end
         
     | 
| 
      
 32 
     | 
    
         
            +
                    end
         
     | 
| 
      
 33 
     | 
    
         
            +
                    
         
     | 
| 
      
 34 
     | 
    
         
            +
                    def self.get_required_parameters
         
     | 
| 
      
 35 
     | 
    
         
            +
                      @param_list
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                    
         
     | 
| 
      
 38 
     | 
    
         
            +
                    def self.get_response_parameters
         
     | 
| 
      
 39 
     | 
    
         
            +
                      @response_parameters
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
                
         
     | 
| 
      
 44 
     | 
    
         
            +
                def generate_url(signed_request=true)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  params = generate_parameters
         
     | 
| 
      
 46 
     | 
    
         
            +
                  params = sign_parameters(params) if signed_request == true
         
     | 
| 
      
 47 
     | 
    
         
            +
                  
         
     | 
| 
      
 48 
     | 
    
         
            +
                  "#{@endpoint}?#{build_query_string(params)}"
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
                
         
     | 
| 
      
 51 
     | 
    
         
            +
                def go!(signed=true)
         
     | 
| 
      
 52 
     | 
    
         
            +
                  url = generate_url(signed)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  
         
     | 
| 
      
 54 
     | 
    
         
            +
                  RestClient.log = "stdout"
         
     | 
| 
      
 55 
     | 
    
         
            +
                  response = RestClient.get url
         
     | 
| 
      
 56 
     | 
    
         
            +
                  
         
     | 
| 
      
 57 
     | 
    
         
            +
                  doc = Hpricot.XML(response)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  
         
     | 
| 
      
 59 
     | 
    
         
            +
                  result = {}
         
     | 
| 
      
 60 
     | 
    
         
            +
                  self.class.get_response_parameters.each do |k,v|
         
     | 
| 
      
 61 
     | 
    
         
            +
                    result[k] = eval("(doc#{v}).innerHTML")
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
                  result
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
                
         
     | 
| 
      
 66 
     | 
    
         
            +
                private
         
     | 
| 
      
 67 
     | 
    
         
            +
                
         
     | 
| 
      
 68 
     | 
    
         
            +
                def build_query_string(params)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  params.sort.collect {|i| i.join("=") }.join("&")
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
                
         
     | 
| 
      
 72 
     | 
    
         
            +
                def sign_parameters(params)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  ###  Horrible kludge.  TODO Remove
         
     | 
| 
      
 74 
     | 
    
         
            +
                  if params.has_key?("Action")
         
     | 
| 
      
 75 
     | 
    
         
            +
                    params.merge!({"SignatureVersion" => 2.to_s, "SignatureMethod" => "HmacSHA256"})
         
     | 
| 
      
 76 
     | 
    
         
            +
                  else
         
     | 
| 
      
 77 
     | 
    
         
            +
                    params.merge!({"signatureVersion" => 2.to_s, "signatureMethod" => "HmacSHA256"})
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
                  
         
     | 
| 
      
 80 
     | 
    
         
            +
                  u = URI.parse(URI.escape("#{@endpoint}?#{build_query_string(params)}"))
         
     | 
| 
      
 81 
     | 
    
         
            +
                  sig = Flexpay::Signature.generate_signature('GET',u.host,u.path,params, @secret_key)
         
     | 
| 
      
 82 
     | 
    
         
            +
                    
         
     | 
| 
      
 83 
     | 
    
         
            +
                  if params.has_key?("Action") 
         
     | 
| 
      
 84 
     | 
    
         
            +
                    params.merge({"Signature" => CGI.escape(sig)})
         
     | 
| 
      
 85 
     | 
    
         
            +
                  else
         
     | 
| 
      
 86 
     | 
    
         
            +
                    params.merge({"signature" => CGI.escape(sig)})
         
     | 
| 
      
 87 
     | 
    
         
            +
                  end
         
     | 
| 
      
 88 
     | 
    
         
            +
                end
         
     | 
| 
      
 89 
     | 
    
         
            +
                
         
     | 
| 
      
 90 
     | 
    
         
            +
                def generate_parameters
         
     | 
| 
      
 91 
     | 
    
         
            +
                  params = {}
         
     | 
| 
      
 92 
     | 
    
         
            +
                  self.class.get_required_parameters.each do |p|
         
     | 
| 
      
 93 
     | 
    
         
            +
                    val = self.send(p)
         
     | 
| 
      
 94 
     | 
    
         
            +
                    params[p.gsub('_','.')] = val unless val.nil? || val.empty?
         
     | 
| 
      
 95 
     | 
    
         
            +
                  end
         
     | 
| 
      
 96 
     | 
    
         
            +
                  params
         
     | 
| 
      
 97 
     | 
    
         
            +
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
                
         
     | 
| 
      
 99 
     | 
    
         
            +
              end
         
     | 
| 
      
 100 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/flexpay/util.rb
    ADDED
    
    | 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'openssl'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'base64'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Flexpay
         
     | 
| 
      
 6 
     | 
    
         
            +
              class Signature
         
     | 
| 
      
 7 
     | 
    
         
            +
                def self.generate_signature(http_method, host, request_uri, params, secret_key)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  method = http_method.to_s.upcase
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  #Place in canonical order and URI encode
         
     | 
| 
      
 11 
     | 
    
         
            +
                  encoded_data = params.sort.collect {|i| i.join("=") }.join("&")
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  data = "#{http_method}\n#{host}\n#{request_uri}\n#{modified_URL_encoding(encoded_data)}"
         
     | 
| 
      
 14 
     | 
    
         
            +
                  digest = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, secret_key, data)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  Base64.encode64(digest).strip
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
                
         
     | 
| 
      
 18 
     | 
    
         
            +
                private
         
     | 
| 
      
 19 
     | 
    
         
            +
                
         
     | 
| 
      
 20 
     | 
    
         
            +
                ## These are the modified encoding rules proposed by Amazon. Not quite URL encoding
         
     | 
| 
      
 21 
     | 
    
         
            +
                def self.modified_URL_encoding(string)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  URI.escape(string).gsub(/\+/, '%20').gsub(/\*/, '%2A').gsub("%7E","~").gsub(/:/,'%3A').gsub(/\//,'%2F')
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
                
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ACCESS_KEY = ENV['AWS_ACCESS_KEY'] || ENV['AMAZON_ACCESS_KEY_ID']
         
     | 
| 
      
 2 
     | 
    
         
            +
            SECRET_KEY = ENV['AWS_SECRET_KEY'] || ENV['AMAZON_SECRET_ACCESS_KEY']
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            unless ACCESS_KEY and SECRET_KEY
         
     | 
| 
      
 5 
     | 
    
         
            +
              raise RuntimeError, "You must set your AWS_ACCESS_KEY and AWS_SECRET_KEY environment variables to run integration tests"
         
     | 
| 
      
 6 
     | 
    
         
            +
            end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../spec_helper'
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/units_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Flexpay::Signature do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @api = Flexpay::API.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY)
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              it "should complain if key values aren't specified" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                @api = Flexpay::API.new(:secret_key => SECRET_KEY)
         
     | 
| 
      
 10 
     | 
    
         
            +
                lambda { @api.access_key }.should raise_error(APINotConfigured)
         
     | 
| 
      
 11 
     | 
    
         
            +
                @api = Flexpay::API.new(:access_key => ACCESS_KEY)
         
     | 
| 
      
 12 
     | 
    
         
            +
                lambda { @api.secret_key }.should raise_error(APINotConfigured)
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
              
         
     | 
| 
      
 15 
     | 
    
         
            +
              it "should return a recurring pipeline based on API version" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                @api.get_recurring_pipeline.should be_a(Flexpay::CobrandingAPI::V2009_01_09::RecurringPipeline)
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
              
         
     | 
| 
      
 19 
     | 
    
         
            +
              it "should return a verify signature based on API version" do
         
     | 
| 
      
 20 
     | 
    
         
            +
                @api.get_verify_signature.should be_a(Flexpay::FpsAPI::V2008_09_17::VerifySignature)
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/units_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe 'Pay' do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 5 
     | 
    
         
            +
              end
         
     | 
| 
      
 6 
     | 
    
         
            +
              
         
     | 
| 
      
 7 
     | 
    
         
            +
              it "should correctly build a request" do
         
     | 
| 
      
 8 
     | 
    
         
            +
                pay = Flexpay::API.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY).get_pay
         
     | 
| 
      
 9 
     | 
    
         
            +
                
         
     | 
| 
      
 10 
     | 
    
         
            +
                body =<<HEREDOC 
         
     | 
| 
      
 11 
     | 
    
         
            +
                <PayResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
         
     | 
| 
      
 12 
     | 
    
         
            +
                   <PayResult>
         
     | 
| 
      
 13 
     | 
    
         
            +
                      <TransactionId>14GK6BGKA7U6OU6SUTNLBI5SBBV9PGDJ6UL</TransactionId>
         
     | 
| 
      
 14 
     | 
    
         
            +
                      <TransactionStatus>Pending</TransactionStatus>
         
     | 
| 
      
 15 
     | 
    
         
            +
                   </PayResult>
         
     | 
| 
      
 16 
     | 
    
         
            +
                   <ResponseMetadata>
         
     | 
| 
      
 17 
     | 
    
         
            +
                      <RequestId>c21e7735-9c08-4cd8-99bf-535a848c79b4:0</RequestId>
         
     | 
| 
      
 18 
     | 
    
         
            +
                   </ResponseMetadata>
         
     | 
| 
      
 19 
     | 
    
         
            +
                </PayResponse>
         
     | 
| 
      
 20 
     | 
    
         
            +
            HEREDOC
         
     | 
| 
      
 21 
     | 
    
         
            +
                
         
     | 
| 
      
 22 
     | 
    
         
            +
                RestClient.stub!(:get).and_return(body)
         
     | 
| 
      
 23 
     | 
    
         
            +
                
         
     | 
| 
      
 24 
     | 
    
         
            +
                pay.CallerReference = Time.now.to_i.to_s
         
     | 
| 
      
 25 
     | 
    
         
            +
                pay.SenderTokenId = "U65I5X19A9HS8DD8MEIH7ASGRQMVTCPNCPKG4ML8Z8NDGGCLU265KXSILUF8SXIA"
         
     | 
| 
      
 26 
     | 
    
         
            +
                pay.TransactionAmount_Value = "10"
         
     | 
| 
      
 27 
     | 
    
         
            +
                pay.TransactionAmount_CurrencyCode = "USD"
         
     | 
| 
      
 28 
     | 
    
         
            +
                pay.AWSAccessKeyId = ACCESS_KEY
         
     | 
| 
      
 29 
     | 
    
         
            +
                pay.Timestamp = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
         
     | 
| 
      
 30 
     | 
    
         
            +
                
         
     | 
| 
      
 31 
     | 
    
         
            +
                result = pay.go!
         
     | 
| 
      
 32 
     | 
    
         
            +
                result.should have_key(:TransactionId)
         
     | 
| 
      
 33 
     | 
    
         
            +
                result.should have_key(:TransactionStatus)
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
              
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/units_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe "Recurring pipeline" do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 5 
     | 
    
         
            +
              end
         
     | 
| 
      
 6 
     | 
    
         
            +
              
         
     | 
| 
      
 7 
     | 
    
         
            +
              it "should generate a pipeline" do
         
     | 
| 
      
 8 
     | 
    
         
            +
                pipeline = Flexpay::API.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY).get_recurring_pipeline
         
     | 
| 
      
 9 
     | 
    
         
            +
                pipeline.should_not be_nil
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
              
         
     | 
| 
      
 12 
     | 
    
         
            +
              it "should respond to all required parameters" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                pipeline = Flexpay::API.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY).get_recurring_pipeline
         
     | 
| 
      
 14 
     | 
    
         
            +
                
         
     | 
| 
      
 15 
     | 
    
         
            +
                Flexpay::CobrandingAPI::V2009_01_09::RecurringPipeline::get_required_parameters.each do |p|
         
     | 
| 
      
 16 
     | 
    
         
            +
                  pipeline.should respond_to(p)
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
              
         
     | 
| 
      
 20 
     | 
    
         
            +
              it "should correctly build a parameter hash" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                pipeline = Flexpay::API.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY).get_recurring_pipeline
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
      
 23 
     | 
    
         
            +
                pipeline.callerReference = Time.now.to_i.to_s
         
     | 
| 
      
 24 
     | 
    
         
            +
                pipeline.transactionAmount = "10"
         
     | 
| 
      
 25 
     | 
    
         
            +
                pipeline.recurringPeriod = "1 month"
         
     | 
| 
      
 26 
     | 
    
         
            +
                pipeline.returnURL = "http://127.0.0.1:3000"
         
     | 
| 
      
 27 
     | 
    
         
            +
                # pipeline.callerKey = "AKIAICO3MHOOXACSG2VQ"
         
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
                url = pipeline.generate_url
         
     | 
| 
      
 30 
     | 
    
         
            +
                url.should_not be_empty
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
              
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/units_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Flexpay::Signature do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 5 
     | 
    
         
            +
                
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              it "calculate signatures" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                
         
     | 
| 
      
 10 
     | 
    
         
            +
                params = {"Action" => "Pay", "AWSAccessKeyId" => "AKIAIIFXJCFIHITREP4Q", "CallerDescription" => "MyWish",
         
     | 
| 
      
 11 
     | 
    
         
            +
                  "CallerReference" => "CallerReference02", "SenderTokenId" => "553ILMLCG6Z8J431H7BX3UMN3FFQU8VSNTSRNCTAASDJNX66LNZLKSZU3PI7TXIH",
         
     | 
| 
      
 12 
     | 
    
         
            +
                  "SignatureMethod" => "HmacSHA256", "SignatureVersion" => 2, "Timestamp" => "2009-10-06T05%3A49%3A52.843Z",
         
     | 
| 
      
 13 
     | 
    
         
            +
                  "TransactionAmount.CurrencyCode" => "USD", "TransActionAmount.Value" => 1, "Version" => "2008-09-17",}
         
     | 
| 
      
 14 
     | 
    
         
            +
                
         
     | 
| 
      
 15 
     | 
    
         
            +
                sig = Flexpay::Signature.generate_signature('GET','fps.sandbox.amazonaws.com',
         
     | 
| 
      
 16 
     | 
    
         
            +
                  'https://fps.sandbox.amazonaws.com',params, SECRET_KEY)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  
         
     | 
| 
      
 18 
     | 
    
         
            +
                sig.should_not be_empty
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/units_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe 'VerifySignature' do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 5 
     | 
    
         
            +
              end
         
     | 
| 
      
 6 
     | 
    
         
            +
              
         
     | 
| 
      
 7 
     | 
    
         
            +
              it "should correctly build a request" do
         
     | 
| 
      
 8 
     | 
    
         
            +
                verify = Flexpay::API.new(:access_key => ACCESS_KEY, :secret_key => SECRET_KEY).get_verify_signature
         
     | 
| 
      
 9 
     | 
    
         
            +
                
         
     | 
| 
      
 10 
     | 
    
         
            +
                body =<<HEREDOC 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    <VerifySignatureResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
         
     | 
| 
      
 12 
     | 
    
         
            +
                      <VerifySignatureResult>
         
     | 
| 
      
 13 
     | 
    
         
            +
                        <VerificationStatus>Success</VerificationStatus>
         
     | 
| 
      
 14 
     | 
    
         
            +
                      </VerifySignatureResult>
         
     | 
| 
      
 15 
     | 
    
         
            +
                      <ResponseMetadata>
         
     | 
| 
      
 16 
     | 
    
         
            +
                        <RequestId>197e2085-1ed7-47a2-93d8-d76b452acc74:0</RequestId>
         
     | 
| 
      
 17 
     | 
    
         
            +
                      </ResponseMetadata>
         
     | 
| 
      
 18 
     | 
    
         
            +
                    </VerifySignatureResponse>
         
     | 
| 
      
 19 
     | 
    
         
            +
            HEREDOC
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                RestClient.stub!(:get).and_return(body)
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
      
 23 
     | 
    
         
            +
                verify.UrlEndPoint = "http%3A%2F%2Fvamsik.desktop.amazon.com%3A8080%2Fipn.jsp"
         
     | 
| 
      
 24 
     | 
    
         
            +
                timestamp = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
         
     | 
| 
      
 25 
     | 
    
         
            +
                verify.HttpParameters = "expiry%3D08%252F2015%26signature%3DynDukZ9%252FG77uSJVb5YM0cadwHVwYKPMKOO3PNvgADbv6VtymgBxeOWEhED6KGHsGSvSJnMWDN%252FZl639AkRe9Ry%252F7zmn9CmiM%252FZkp1XtshERGTqi2YL10GwQpaH17MQqOX3u1cW4LlyFoLy4celUFBPq1WM2ZJnaNZRJIEY%252FvpeVnCVK8VIPdY3HMxPAkNi5zeF2BbqH%252BL2vAWef6vfHkNcJPlOuOl6jP4E%252B58F24ni%252B9ek%252FQH18O4kw%252FUJ7ZfKwjCCI13%252BcFybpofcKqddq8CuUJj5Ii7Pdw1fje7ktzHeeNhF0r9siWcYmd4JaxTP3NmLJdHFRq2T%252FgsF3vK9m3gw%253D%253D%26signatureVersion%3D2%26signatureMethod%3DRSA-SHA1%26certificateUrl%3Dhttps%253A%252F%252Ffps.sandbox.amazonaws.com%252Fcerts%252F090909%252FPKICert.pem%26tokenID%3DA5BB3HUNAZFJ5CRXIPH72LIODZUNAUZIVP7UB74QNFQDSQ9MN4HPIKISQZWPLJXF%26status%3DSC%26callerReference%3DcallerReferenceMultiUse1&AWSAccessKeyId=AKIAJGC2KB2QP7MVBLYQ&Timestamp=#{timestamp.gsub(':','%3A')}&Version=2008-09-17&SignatureVersion=2&SignatureMethod=HmacSHA256&Signature=fKRGL42K7nduDA47g6bJCyUyF5ZvkBotXE5jVcgyHvE%3D"
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                result = verify.go!(false)
         
     | 
| 
      
 28 
     | 
    
         
            +
                result.should have_key(:VerificationStatus)
         
     | 
| 
      
 29 
     | 
    
         
            +
                result[:VerificationStatus].should == "Success"
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
              
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,101 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: flexpay
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 5 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 6 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 10 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 11 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Chris Chandler
         
     | 
| 
      
 13 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 14 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 15 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2010-03-19 00:00:00 -05:00
         
     | 
| 
      
 18 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 19 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 21 
     | 
    
         
            +
              name: hpricot
         
     | 
| 
      
 22 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 23 
     | 
    
         
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 24 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 25 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 27 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 28 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 30 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 31 
     | 
    
         
            +
              version_requirements: *id001
         
     | 
| 
      
 32 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 33 
     | 
    
         
            +
              name: rest-client
         
     | 
| 
      
 34 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 35 
     | 
    
         
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 36 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 37 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 38 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 39 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 40 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 41 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 42 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 43 
     | 
    
         
            +
              version_requirements: *id002
         
     | 
| 
      
 44 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 45 
     | 
    
         
            +
            email: chris@flatterline.com
         
     | 
| 
      
 46 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 53 
     | 
    
         
            +
            - lib/flexpay.rb
         
     | 
| 
      
 54 
     | 
    
         
            +
            - lib/flexpay/api_module.rb
         
     | 
| 
      
 55 
     | 
    
         
            +
            - lib/flexpay/cobranding_api/v2009_01_09.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/flexpay/cobranding_api/v2009_01_09/pipelines.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/flexpay/exceptions.rb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/flexpay/fps_api/v2008_09_17.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/flexpay/fps_api/v2008_09_17/pay.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - lib/flexpay/fps_api/v2008_09_17/verify_signature.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/flexpay/request.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/flexpay/util.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 64 
     | 
    
         
            +
            homepage: http://github.com/cchandler/flexpay
         
     | 
| 
      
 65 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 68 
     | 
    
         
            +
            rdoc_options: 
         
     | 
| 
      
 69 
     | 
    
         
            +
            - --charset=UTF-8
         
     | 
| 
      
 70 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 71 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 72 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 73 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 74 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 75 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 76 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 77 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 78 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 79 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 80 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 81 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 82 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 83 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 84 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 85 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 86 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 89 
     | 
    
         
            +
            rubygems_version: 1.3.6
         
     | 
| 
      
 90 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 91 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 92 
     | 
    
         
            +
            summary: An API for using the Amazon Flexible Payment Service (FPS).
         
     | 
| 
      
 93 
     | 
    
         
            +
            test_files: 
         
     | 
| 
      
 94 
     | 
    
         
            +
            - spec/units/api_spec.rb
         
     | 
| 
      
 95 
     | 
    
         
            +
            - spec/units/pay_spec.rb
         
     | 
| 
      
 96 
     | 
    
         
            +
            - spec/units/recurring_pipeline_spec.rb
         
     | 
| 
      
 97 
     | 
    
         
            +
            - spec/units/signature_spec.rb
         
     | 
| 
      
 98 
     | 
    
         
            +
            - spec/units/verify_signature_spec.rb
         
     | 
| 
      
 99 
     | 
    
         
            +
            - spec/integrations/integrations_helper.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - spec/units/units_helper.rb
         
     |