sisow 1.7 → 2.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.
- checksums.yaml +4 -4
- data/.env.example +2 -0
- data/.gitignore +2 -1
- data/.ruby-version +1 -0
- data/.travis.yml +1 -5
- data/Gemfile +1 -1
- data/README.rdoc +10 -2
- data/lib/sisow/api/callback.rb +12 -1
- data/lib/sisow/api/request.rb +18 -4
- data/lib/sisow/api/request/transaction_request.rb +4 -10
- data/lib/sisow/issuer.rb +4 -4
- data/lib/sisow/payment.rb +7 -2
- data/lib/sisow/version.rb +1 -1
- data/script/ci +0 -2
- data/sisow.gemspec +9 -8
- data/spec/models/callback_spec.rb +13 -0
- data/spec/models/issuer_spec.rb +14 -0
- data/spec/models/payment_spec.rb +13 -1
- data/spec/models/ping_spec.rb +1 -1
- data/spec/models/request_spec.rb +46 -6
- data/spec/models/transaction_request_spec.rb +2 -2
- data/spec/spec_helper.rb +6 -7
- data/spec/vcr_setup.rb +1 -1
- metadata +52 -40
- data/.rvmrc +0 -1
- data/Gemfile.lock +0 -54
- data/spec/sisow.yml.example +0 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2b0a0154aa1fe2d8de8181ba40519469cf315184
         | 
| 4 | 
            +
              data.tar.gz: 8f8a255b65f11858396fd9f47f414494bd4956ea
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1907a618e429b620a382b89fa56b607c4d6f278a92e9c9035b1ecbaf0eda15ed335bfe2d82d37c12629d3e5e7fe20dece9d8f2936a8cdc37e07681b1bf7f4d9d
         | 
| 7 | 
            +
              data.tar.gz: 949f9ae85c16df4d0db50c9ca04939d984e2d104ae6c638e4fc124ba5100f6d3914b73d78a1254980cf16f61f5a1cb3c6d7a49937c21af608e5067adfa29edfe
         | 
    
        data/.env.example
    ADDED
    
    
    
        data/.gitignore
    CHANGED
    
    
    
        data/.ruby-version
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            2.2.3
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.rdoc
    CHANGED
    
    | @@ -44,6 +44,10 @@ To set up a payment, your user needs to choose an issuer (a bank) that will fulf | |
| 44 44 | 
             
            This will return a list of <tt>Sisow::Issuer</tt> objects that have an <tt>id</tt> and a <tt>name</tt>. The <tt>id</tt> is needed
         | 
| 45 45 | 
             
            to set up the payment in the following step.
         | 
| 46 46 |  | 
| 47 | 
            +
            Optionally you can also retrieve a list of issuers by supplying the merchant_id and merchant_key directly to the method.
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              Sisow::Issuer.list(merchant_id: 1, merchant_key: 'abcd')
         | 
| 50 | 
            +
             | 
| 47 51 | 
             
            === Setting up a payment
         | 
| 48 52 |  | 
| 49 53 | 
             
            After choosing an issuer, your user must be redirected to the payment page for that issuer. For that to happen, you'll have to
         | 
| @@ -52,6 +56,8 @@ set up a payment through the Sisow API, after which you'll be given a URL to red | |
| 52 56 | 
             
            Setting up a payment looks like this:
         | 
| 53 57 |  | 
| 54 58 | 
             
              payment_attributes = {
         | 
| 59 | 
            +
                :merchant_id    => 1,                       # optional: set if you don't want to use a global configuration
         | 
| 60 | 
            +
                :merchant_key   => 'abcd',                  # optional: set if you don't want to use a global configuration
         | 
| 55 61 | 
             
                :purchase_id    => '2012-01-28-33558',      # for your own reference
         | 
| 56 62 | 
             
                :issuer_id      => '99',                    # the issuer id from the previous step
         | 
| 57 63 | 
             
                :description    => 'Acme Inc. payment',     # description of this payment
         | 
| @@ -61,7 +67,7 @@ Setting up a payment looks like this: | |
| 61 67 | 
             
                :cancel_url     => 'http://example.com',    # where the user is sent when he cancels the payment
         | 
| 62 68 | 
             
                :callback_url   => 'http://example.com',    # where a failed (not cancelled) payment will be reported
         | 
| 63 69 | 
             
                :notify_url     => 'http://example.com',    # where the payment status will be reported
         | 
| 64 | 
            -
                :locale         => 'GB'                     # for Paypal payments. Only GB and US are currently valid. | 
| 70 | 
            +
                :locale         => 'GB'                     # for Paypal payments. Only GB and US are currently valid.
         | 
| 65 71 | 
             
                                                            # Any other option (or leaving it out entirely) will default
         | 
| 66 72 | 
             
                                                            # to a Dutch payment page
         | 
| 67 73 | 
             
              }
         | 
| @@ -89,6 +95,8 @@ As documented in the Sisow API documentation, four callbacks are available. When | |
| 89 95 | 
             
            The <tt>Sisow::Api::Callback</tt> can handle these callbacks for you. To initialize such an instance you should provide the following query parameters (which are given by Sisow in the request):
         | 
| 90 96 |  | 
| 91 97 | 
             
              callback = Sisow::Api::Callback.new(
         | 
| 98 | 
            +
                :merchant_id    => 1,                       # optional: set if you don't want to use a global configuration
         | 
| 99 | 
            +
                :merchant_key   => 'abcd',                  # optional: set if you don't want to use a global configuration
         | 
| 92 100 | 
             
                :transaction_id => params[:trxid],
         | 
| 93 101 | 
             
                :entrance_code  => params[:ec],
         | 
| 94 102 | 
             
                :status         => params[:status],
         | 
| @@ -111,7 +119,7 @@ Your contributions are more than welcome. To contribute to this gem, follow thes | |
| 111 119 | 
             
            1. Fork the repository from Github
         | 
| 112 120 | 
             
            2. Clone your fork on your development machine
         | 
| 113 121 | 
             
            3. Install the dependencies with <tt>bundle install</tt>
         | 
| 114 | 
            -
            4. Copy <tt | 
| 122 | 
            +
            4. Copy <tt>.env.example</tt> to <tt>.env</tt> and enter your own Sisow credentials
         | 
| 115 123 | 
             
            5. Verify your clone is working by running <tt>rspec</tt>
         | 
| 116 124 | 
             
            6. Hack away
         | 
| 117 125 | 
             
            7. Run the specs with <tt>rspec</tt>
         | 
    
        data/lib/sisow/api/callback.rb
    CHANGED
    
    | @@ -2,6 +2,9 @@ module Sisow | |
| 2 2 | 
             
              module Api
         | 
| 3 3 | 
             
                class Callback
         | 
| 4 4 |  | 
| 5 | 
            +
                  attr_writer :merchant_key,
         | 
| 6 | 
            +
                              :merchant_id
         | 
| 7 | 
            +
             | 
| 5 8 | 
             
                  attr_accessor :transaction_id,
         | 
| 6 9 | 
             
                                :entrance_code,
         | 
| 7 10 | 
             
                                :status,
         | 
| @@ -46,10 +49,18 @@ module Sisow | |
| 46 49 | 
             
                    @status == 'Reversed'
         | 
| 47 50 | 
             
                  end
         | 
| 48 51 |  | 
| 52 | 
            +
                  def merchant_id
         | 
| 53 | 
            +
                    @merchant_id || Sisow.configuration.merchant_id
         | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                  def merchant_key
         | 
| 57 | 
            +
                    @merchant_key || Sisow.configuration.merchant_key
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
             | 
| 49 60 | 
             
                  private
         | 
| 50 61 |  | 
| 51 62 | 
             
                    def valid_callback
         | 
| 52 | 
            -
                      string = [ @transaction_id, @entrance_code, @status,  | 
| 63 | 
            +
                      string = [ @transaction_id, @entrance_code, @status, merchant_id, merchant_key ].join
         | 
| 53 64 | 
             
                      calculated_sha1 = Digest::SHA1.hexdigest(string)
         | 
| 54 65 |  | 
| 55 66 | 
             
                      calculated_sha1 == @sha1
         | 
    
        data/lib/sisow/api/request.rb
    CHANGED
    
    | @@ -6,8 +6,22 @@ module Sisow | |
| 6 6 |  | 
| 7 7 | 
             
                  BASE_URI = "http://www.sisow.nl/Sisow/iDeal/RestHandler.ashx"
         | 
| 8 8 |  | 
| 9 | 
            -
                   | 
| 10 | 
            -
             | 
| 9 | 
            +
                  attr_writer :merchant_id,
         | 
| 10 | 
            +
                              :merchant_key
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  def merchant_id
         | 
| 13 | 
            +
                    @merchant_id || Sisow.configuration.merchant_id
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  def merchant_key
         | 
| 17 | 
            +
                    @merchant_key || Sisow.configuration.merchant_key
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  def self.perform(merchant_id: nil, merchant_key: nil)
         | 
| 21 | 
            +
                    new.tap do |r|
         | 
| 22 | 
            +
                      r.merchant_id = merchant_id if merchant_id
         | 
| 23 | 
            +
                      r.merchant_key = merchant_key if merchant_key
         | 
| 24 | 
            +
                    end.perform
         | 
| 11 25 | 
             
                  end
         | 
| 12 26 |  | 
| 13 27 | 
             
                  def perform
         | 
| @@ -26,7 +40,7 @@ module Sisow | |
| 26 40 |  | 
| 27 41 | 
             
                  def default_params
         | 
| 28 42 | 
             
                    {
         | 
| 29 | 
            -
                      :merchantid  =>  | 
| 43 | 
            +
                      :merchantid  => merchant_id,
         | 
| 30 44 | 
             
                      :test        => Sisow.configuration.test_mode_enabled?? test_mode_param : nil
         | 
| 31 45 | 
             
                    }
         | 
| 32 46 | 
             
                  end
         | 
| @@ -39,7 +53,7 @@ module Sisow | |
| 39 53 | 
             
                  private
         | 
| 40 54 |  | 
| 41 55 | 
             
                    def can_perform?
         | 
| 42 | 
            -
                      !( | 
| 56 | 
            +
                      !(merchant_id.nil? || merchant_id.empty?) && !(merchant_key.nil? || merchant_key.empty?)
         | 
| 43 57 | 
             
                    end
         | 
| 44 58 |  | 
| 45 59 | 
             
                    def uri
         | 
| @@ -2,12 +2,6 @@ module Sisow | |
| 2 2 | 
             
              module Api
         | 
| 3 3 | 
             
                class TransactionRequest < Request
         | 
| 4 4 |  | 
| 5 | 
            -
                  attr_accessor :purchase_id,
         | 
| 6 | 
            -
                                :issuer_id,
         | 
| 7 | 
            -
                                :description,
         | 
| 8 | 
            -
                                :amount,
         | 
| 9 | 
            -
                                :payment
         | 
| 10 | 
            -
             | 
| 11 5 | 
             
                  def initialize(payment)
         | 
| 12 6 | 
             
                    @payment = payment
         | 
| 13 7 | 
             
                  end
         | 
| @@ -37,8 +31,8 @@ module Sisow | |
| 37 31 | 
             
                      payment.purchase_id,
         | 
| 38 32 | 
             
                      payment.entrance_code,
         | 
| 39 33 | 
             
                      payment.amount,
         | 
| 40 | 
            -
                       | 
| 41 | 
            -
                       | 
| 34 | 
            +
                      merchant_id,
         | 
| 35 | 
            +
                      merchant_key
         | 
| 42 36 | 
             
                    ].join
         | 
| 43 37 |  | 
| 44 38 | 
             
                    Digest::SHA1.hexdigest(string)
         | 
| @@ -94,8 +88,8 @@ module Sisow | |
| 94 88 | 
             
                      string = [
         | 
| 95 89 | 
             
                        response.transactionrequest.transaction.trxid,
         | 
| 96 90 | 
             
                        response.transactionrequest.transaction.issuerurl,
         | 
| 97 | 
            -
                         | 
| 98 | 
            -
                         | 
| 91 | 
            +
                        merchant_id,
         | 
| 92 | 
            +
                        merchant_key
         | 
| 99 93 | 
             
                      ].join
         | 
| 100 94 |  | 
| 101 95 | 
             
                      calculated_sha1 = Digest::SHA1.hexdigest(string)
         | 
    
        data/lib/sisow/issuer.rb
    CHANGED
    
    | @@ -2,8 +2,8 @@ module Sisow | |
| 2 2 | 
             
              class Issuer
         | 
| 3 3 | 
             
                attr_accessor :id, :name
         | 
| 4 4 |  | 
| 5 | 
            -
                def self.list
         | 
| 6 | 
            -
                  @list ||= find_all_from_api
         | 
| 5 | 
            +
                def self.list(merchant_id: nil, merchant_key: nil)
         | 
| 6 | 
            +
                  @list ||= find_all_from_api(merchant_id, merchant_key)
         | 
| 7 7 | 
             
                end
         | 
| 8 8 |  | 
| 9 9 | 
             
                def self.find(issuer_id)
         | 
| @@ -17,8 +17,8 @@ module Sisow | |
| 17 17 |  | 
| 18 18 | 
             
                private
         | 
| 19 19 |  | 
| 20 | 
            -
                def self.find_all_from_api
         | 
| 21 | 
            -
                  hash = Sisow::Api::DirectoryRequest.perform
         | 
| 20 | 
            +
                def self.find_all_from_api(merchant_id = nil, merchant_key = nil)
         | 
| 21 | 
            +
                  hash = Sisow::Api::DirectoryRequest.perform(merchant_id: merchant_id, merchant_key: merchant_key)
         | 
| 22 22 |  | 
| 23 23 | 
             
                  hash.issuer = [ hash.issuer ] unless hash.issuer.is_a?(Array)
         | 
| 24 24 |  | 
    
        data/lib/sisow/payment.rb
    CHANGED
    
    | @@ -1,7 +1,9 @@ | |
| 1 1 | 
             
            module Sisow
         | 
| 2 2 | 
             
              class Payment
         | 
| 3 3 |  | 
| 4 | 
            -
                attr_accessor : | 
| 4 | 
            +
                attr_accessor :merchant_id,
         | 
| 5 | 
            +
                              :merchant_key,
         | 
| 6 | 
            +
                              :purchase_id,
         | 
| 5 7 | 
             
                              :issuer_id,
         | 
| 6 8 | 
             
                              :description,
         | 
| 7 9 | 
             
                              :amount,
         | 
| @@ -48,7 +50,10 @@ module Sisow | |
| 48 50 | 
             
                  end
         | 
| 49 51 |  | 
| 50 52 | 
             
                  def request
         | 
| 51 | 
            -
                    @request ||= Sisow::Api::TransactionRequest.new(self)
         | 
| 53 | 
            +
                    @request ||= Sisow::Api::TransactionRequest.new(self).tap do |r|
         | 
| 54 | 
            +
                      r.merchant_id = merchant_id if merchant_id
         | 
| 55 | 
            +
                      r.merchant_key = merchant_key if merchant_key
         | 
| 56 | 
            +
                    end
         | 
| 52 57 | 
             
                  end
         | 
| 53 58 |  | 
| 54 59 | 
             
              end
         | 
    
        data/lib/sisow/version.rb
    CHANGED
    
    
    
        data/script/ci
    CHANGED
    
    
    
        data/sisow.gemspec
    CHANGED
    
    | @@ -19,14 +19,15 @@ Gem::Specification.new do |s| | |
| 19 19 | 
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
| 20 20 | 
             
              s.require_paths = ["lib"]
         | 
| 21 21 |  | 
| 22 | 
            -
              s.add_dependency 'httpi'
         | 
| 23 | 
            -
              s.add_dependency 'hashie'
         | 
| 24 | 
            -
              s.add_dependency 'crack'
         | 
| 22 | 
            +
              s.add_dependency 'httpi', '~> 2'
         | 
| 23 | 
            +
              s.add_dependency 'hashie', '~> 3'
         | 
| 24 | 
            +
              s.add_dependency 'crack', '~> 0.4'
         | 
| 25 25 |  | 
| 26 | 
            -
              s.add_development_dependency 'rspec'
         | 
| 27 | 
            -
              s.add_development_dependency 'vcr'
         | 
| 28 | 
            -
              s.add_development_dependency ' | 
| 29 | 
            -
              s.add_development_dependency 'simplecov'
         | 
| 30 | 
            -
              s.add_development_dependency 'simplecov-rcov'
         | 
| 26 | 
            +
              s.add_development_dependency 'rspec', '~> 3'
         | 
| 27 | 
            +
              s.add_development_dependency 'vcr', '~> 4'
         | 
| 28 | 
            +
              s.add_development_dependency 'webmock', '~> 3'
         | 
| 29 | 
            +
              s.add_development_dependency 'simplecov', '~> 0.16'
         | 
| 30 | 
            +
              s.add_development_dependency 'simplecov-rcov', '~> 0.2'
         | 
| 31 | 
            +
              s.add_development_dependency 'dotenv', '~> 2'
         | 
| 31 32 |  | 
| 32 33 | 
             
            end
         | 
| @@ -25,7 +25,20 @@ describe Sisow::Api::Callback do | |
| 25 25 | 
             
              end
         | 
| 26 26 |  | 
| 27 27 | 
             
              it "should be valid" do
         | 
| 28 | 
            +
                @callback.valid?.should == true
         | 
| 29 | 
            +
                lambda { @callback.validate! }.should_not raise_error
         | 
| 30 | 
            +
                @callback.validate!.should == true
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
              it "should be valid with instance configuration" do
         | 
| 34 | 
            +
                Sisow.configure do |config|
         | 
| 35 | 
            +
                  config.merchant_id  = "invalid"
         | 
| 36 | 
            +
                  config.merchant_key = "invalid"
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 28 39 | 
             
                @callback = Sisow::Api::Callback.new(
         | 
| 40 | 
            +
                  :merchant_id => ENV.fetch('MERCHANT_ID'),
         | 
| 41 | 
            +
                  :merchant_key => ENV.fetch('MERCHANT_KEY'),
         | 
| 29 42 | 
             
                  :transaction_id => @transaction_id,
         | 
| 30 43 | 
             
                  :entrance_code  => @entrance_code,
         | 
| 31 44 | 
             
                  :status => @status,
         | 
    
        data/spec/models/issuer_spec.rb
    CHANGED
    
    | @@ -11,6 +11,20 @@ describe Sisow::Issuer do | |
| 11 11 | 
             
                end
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 | 
            +
              it "should list all available issuers with instance configuration" do
         | 
| 15 | 
            +
                Sisow.configure do |config|
         | 
| 16 | 
            +
                  config.merchant_id  = "invalid"
         | 
| 17 | 
            +
                  config.merchant_key = "invalid"
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                VCR.use_cassette('issuer') do
         | 
| 21 | 
            +
                  list = Sisow::Issuer.list(merchant_id: ENV.fetch('MERCHANT_ID'), merchant_key: ENV.fetch('MERCHANT_KEY'))
         | 
| 22 | 
            +
                  list.size.should == 1
         | 
| 23 | 
            +
                  list.first.name.should =~ /Sisow Bank/
         | 
| 24 | 
            +
                  list.first.id.should_not be_nil
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 14 28 | 
             
              it "should find an issuer by ID" do
         | 
| 15 29 | 
             
                VCR.use_cassette('issuer') do
         | 
| 16 30 | 
             
                  issuer = Sisow::Issuer.find(99)
         | 
    
        data/spec/models/payment_spec.rb
    CHANGED
    
    | @@ -46,7 +46,7 @@ describe Sisow::Payment do | |
| 46 46 | 
             
              end
         | 
| 47 47 |  | 
| 48 48 | 
             
              it "should raise an error when calling payment_method" do
         | 
| 49 | 
            -
                lambda{ @payment.payment_method }.should raise_error
         | 
| 49 | 
            +
                lambda{ @payment.payment_method }.should raise_error(RuntimeError, "Implement me in a subclass")
         | 
| 50 50 | 
             
              end
         | 
| 51 51 |  | 
| 52 52 | 
             
              it "should raise an error if amount is missing" do
         | 
| @@ -54,4 +54,16 @@ describe Sisow::Payment do | |
| 54 54 | 
             
                lambda{ @payment.payment_url }.should raise_error(Sisow::Exception, "One of your payment parameters is missing or invalid")
         | 
| 55 55 | 
             
              end
         | 
| 56 56 |  | 
| 57 | 
            +
              describe "with instance configuration" do
         | 
| 58 | 
            +
                it "should set merchant_id and merchant_key from attributes" do
         | 
| 59 | 
            +
                  @payment.stub(:payment_method).and_return('ideal')
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                  @payment.merchant_id = "1234"
         | 
| 62 | 
            +
                  @payment.merchant_key = "4321"
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  @payment.send(:request).merchant_id.should == "1234"
         | 
| 65 | 
            +
                  @payment.send(:request).merchant_key.should == "4321"
         | 
| 66 | 
            +
                end
         | 
| 67 | 
            +
              end
         | 
| 68 | 
            +
             | 
| 57 69 | 
             
            end
         | 
    
        data/spec/models/ping_spec.rb
    CHANGED
    
    
    
        data/spec/models/request_spec.rb
    CHANGED
    
    | @@ -4,11 +4,11 @@ describe Sisow::Api::Request do | |
| 4 4 |  | 
| 5 5 | 
             
              before :each do
         | 
| 6 6 | 
             
                @request = Sisow::Api::Request.new
         | 
| 7 | 
            -
                @request.stub | 
| 8 | 
            -
                @request.stub | 
| 9 | 
            -
                @request.stub | 
| 10 | 
            -
                @request.stub | 
| 11 | 
            -
                Sisow::Api::Request.stub | 
| 7 | 
            +
                @request.stub(:params).and_return(@request.default_params)
         | 
| 8 | 
            +
                @request.stub(:method).and_return("CheckMerchantRequest")
         | 
| 9 | 
            +
                @request.stub(:clean).and_return(['ideal'])
         | 
| 10 | 
            +
                @request.stub(:validate!).and_return(true)
         | 
| 11 | 
            +
                Sisow::Api::Request.stub(:new).and_return(@request)
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 14 | 
             
              it "should point to the base URI of the Sisow API" do
         | 
| @@ -25,7 +25,7 @@ describe Sisow::Api::Request do | |
| 25 25 | 
             
                )
         | 
| 26 26 |  | 
| 27 27 | 
             
                params = @request.params.merge!(:sha1 => sha1)
         | 
| 28 | 
            -
                @request.stub | 
| 28 | 
            +
                @request.stub(:params).and_return(params)
         | 
| 29 29 |  | 
| 30 30 | 
             
                VCR.use_cassette('request') do
         | 
| 31 31 | 
             
                  @request.perform
         | 
| @@ -38,4 +38,44 @@ describe Sisow::Api::Request do | |
| 38 38 | 
             
                end
         | 
| 39 39 | 
             
              end
         | 
| 40 40 |  | 
| 41 | 
            +
              describe "with instance configuration" do
         | 
| 42 | 
            +
                it "should perform properly" do
         | 
| 43 | 
            +
                  Sisow.configure do |config|
         | 
| 44 | 
            +
                    config.merchant_id  = "invalid"
         | 
| 45 | 
            +
                    config.merchant_key = "invalid"
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                  @request = Sisow::Api::Request.new
         | 
| 49 | 
            +
                  @request.merchant_id = ENV.fetch('MERCHANT_ID')
         | 
| 50 | 
            +
                  @request.merchant_key = ENV.fetch('MERCHANT_KEY')
         | 
| 51 | 
            +
                  @request.stub(:params).and_return(@request.default_params)
         | 
| 52 | 
            +
                  @request.stub(:method).and_return("CheckMerchantRequest")
         | 
| 53 | 
            +
                  @request.stub(:clean).and_return(['ideal'])
         | 
| 54 | 
            +
                  @request.stub(:validate!).and_return(true)
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                  sha1 = Digest::SHA1.hexdigest(
         | 
| 57 | 
            +
                    [
         | 
| 58 | 
            +
                      ENV.fetch('MERCHANT_ID'),
         | 
| 59 | 
            +
                      ENV.fetch('MERCHANT_KEY')
         | 
| 60 | 
            +
                    ].join
         | 
| 61 | 
            +
                  )
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                  params = @request.params.merge!(:sha1 => sha1)
         | 
| 64 | 
            +
                  @request.stub(:params).and_return(params)
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                  VCR.use_cassette('request') do
         | 
| 67 | 
            +
                    @request.perform
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
                end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                it "should set merchant_id and merchant_key using class method" do
         | 
| 72 | 
            +
                  subject.stub(:perform).and_return(subject)
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  obj = subject.class.perform(merchant_id: "1234", merchant_key: "4321")
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                  obj.merchant_id.should == "1234"
         | 
| 77 | 
            +
                  obj.merchant_key.should == "4321"
         | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
              end
         | 
| 80 | 
            +
             | 
| 41 81 | 
             
            end
         | 
| @@ -29,7 +29,7 @@ describe Sisow::Api::TransactionRequest do | |
| 29 29 | 
             
              end
         | 
| 30 30 |  | 
| 31 31 | 
             
              it "should remove issuerid from params for Bancontact" do
         | 
| 32 | 
            -
                Sisow.configuration.stub | 
| 32 | 
            +
                Sisow.configuration.stub(:test_mode_enabled?).and_return(false)
         | 
| 33 33 | 
             
                payment = Sisow::BancontactPayment.new
         | 
| 34 34 | 
             
                request = Sisow::Api::TransactionRequest.new(payment)
         | 
| 35 35 |  | 
| @@ -44,7 +44,7 @@ describe Sisow::Api::TransactionRequest do | |
| 44 44 | 
             
              end
         | 
| 45 45 |  | 
| 46 46 | 
             
              it "should remove issuerid from params for Sofort" do
         | 
| 47 | 
            -
                Sisow.configuration.stub | 
| 47 | 
            +
                Sisow.configuration.stub(:test_mode_enabled?).and_return(false)
         | 
| 48 48 | 
             
                payment = Sisow::SofortPayment.new
         | 
| 49 49 | 
             
                request = Sisow::Api::TransactionRequest.new(payment)
         | 
| 50 50 |  | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            require 'dotenv/load'
         | 
| 1 2 | 
             
            require 'bundler/setup'
         | 
| 2 3 | 
             
            require 'simplecov'
         | 
| 3 4 | 
             
            require 'simplecov-rcov'
         | 
| @@ -12,21 +13,19 @@ end | |
| 12 13 |  | 
| 13 14 | 
             
            require 'vcr_setup'
         | 
| 14 15 |  | 
| 15 | 
            -
            require 'rspec/autorun'
         | 
| 16 16 | 
             
            require 'sisow'
         | 
| 17 17 |  | 
| 18 18 | 
             
            RSpec.configure do |config|
         | 
| 19 | 
            -
              config.mock_with : | 
| 20 | 
            -
              config. | 
| 19 | 
            +
              config.mock_with(:rspec) { |c| c.syntax = :should }
         | 
| 20 | 
            +
              config.color = true
         | 
| 21 21 | 
             
              config.tty = true
         | 
| 22 22 | 
             
              config.formatter = :progress
         | 
| 23 | 
            +
              config.expect_with(:rspec) { |c| c.syntax = :should }
         | 
| 23 24 |  | 
| 24 25 | 
             
              config.before(:each) do
         | 
| 25 | 
            -
                hash = YAML.load(File.open('./spec/sisow.yml'))
         | 
| 26 | 
            -
             | 
| 27 26 | 
             
                Sisow.configure do |config|
         | 
| 28 | 
            -
                  config.merchant_id  =  | 
| 29 | 
            -
                  config.merchant_key =  | 
| 27 | 
            +
                  config.merchant_id  = ENV.fetch('MERCHANT_ID')
         | 
| 28 | 
            +
                  config.merchant_key = ENV.fetch('MERCHANT_KEY')
         | 
| 30 29 | 
             
                  config.test_mode    = true
         | 
| 31 30 | 
             
                  config.debug_mode   = false
         | 
| 32 31 | 
             
                end
         | 
    
        data/spec/vcr_setup.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,127 +1,141 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sisow
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: ' | 
| 4 | 
            +
              version: '2.0'
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Marcel de Graaf
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2018-05-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: httpi
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - - " | 
| 17 | 
            +
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: ' | 
| 19 | 
            +
                    version: '2'
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - - " | 
| 24 | 
            +
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: ' | 
| 26 | 
            +
                    version: '2'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: hashie
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 | 
            -
                - - " | 
| 31 | 
            +
                - - "~>"
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: ' | 
| 33 | 
            +
                    version: '3'
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 | 
            -
                - - " | 
| 38 | 
            +
                - - "~>"
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: ' | 
| 40 | 
            +
                    version: '3'
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: crack
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 | 
            -
                - - " | 
| 45 | 
            +
                - - "~>"
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: '0'
         | 
| 47 | 
            +
                    version: '0.4'
         | 
| 48 48 | 
             
              type: :runtime
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 | 
            -
                - - " | 
| 52 | 
            +
                - - "~>"
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '0'
         | 
| 54 | 
            +
                    version: '0.4'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: rspec
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 | 
            -
                - - " | 
| 59 | 
            +
                - - "~>"
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: ' | 
| 61 | 
            +
                    version: '3'
         | 
| 62 62 | 
             
              type: :development
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 | 
            -
                - - " | 
| 66 | 
            +
                - - "~>"
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: ' | 
| 68 | 
            +
                    version: '3'
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: vcr
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 72 | 
             
                requirements:
         | 
| 73 | 
            -
                - - " | 
| 73 | 
            +
                - - "~>"
         | 
| 74 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version: ' | 
| 75 | 
            +
                    version: '4'
         | 
| 76 76 | 
             
              type: :development
         | 
| 77 77 | 
             
              prerelease: false
         | 
| 78 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 79 | 
             
                requirements:
         | 
| 80 | 
            -
                - - " | 
| 80 | 
            +
                - - "~>"
         | 
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: ' | 
| 82 | 
            +
                    version: '4'
         | 
| 83 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            -
              name:  | 
| 84 | 
            +
              name: webmock
         | 
| 85 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 86 | 
             
                requirements:
         | 
| 87 | 
            -
                - - " | 
| 87 | 
            +
                - - "~>"
         | 
| 88 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            -
                    version: ' | 
| 89 | 
            +
                    version: '3'
         | 
| 90 90 | 
             
              type: :development
         | 
| 91 91 | 
             
              prerelease: false
         | 
| 92 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 93 | 
             
                requirements:
         | 
| 94 | 
            -
                - - " | 
| 94 | 
            +
                - - "~>"
         | 
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            -
                    version: ' | 
| 96 | 
            +
                    version: '3'
         | 
| 97 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 98 98 | 
             
              name: simplecov
         | 
| 99 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 100 | 
             
                requirements:
         | 
| 101 | 
            -
                - - " | 
| 101 | 
            +
                - - "~>"
         | 
| 102 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version: '0'
         | 
| 103 | 
            +
                    version: '0.16'
         | 
| 104 104 | 
             
              type: :development
         | 
| 105 105 | 
             
              prerelease: false
         | 
| 106 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 107 | 
             
                requirements:
         | 
| 108 | 
            -
                - - " | 
| 108 | 
            +
                - - "~>"
         | 
| 109 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version: '0'
         | 
| 110 | 
            +
                    version: '0.16'
         | 
| 111 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 112 112 | 
             
              name: simplecov-rcov
         | 
| 113 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 114 | 
             
                requirements:
         | 
| 115 | 
            -
                - - " | 
| 115 | 
            +
                - - "~>"
         | 
| 116 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: '0'
         | 
| 117 | 
            +
                    version: '0.2'
         | 
| 118 118 | 
             
              type: :development
         | 
| 119 119 | 
             
              prerelease: false
         | 
| 120 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 121 | 
             
                requirements:
         | 
| 122 | 
            -
                - - " | 
| 122 | 
            +
                - - "~>"
         | 
| 123 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version: '0'
         | 
| 124 | 
            +
                    version: '0.2'
         | 
| 125 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            +
              name: dotenv
         | 
| 127 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 | 
            +
                requirements:
         | 
| 129 | 
            +
                - - "~>"
         | 
| 130 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            +
                    version: '2'
         | 
| 132 | 
            +
              type: :development
         | 
| 133 | 
            +
              prerelease: false
         | 
| 134 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 | 
            +
                requirements:
         | 
| 136 | 
            +
                - - "~>"
         | 
| 137 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            +
                    version: '2'
         | 
| 125 139 | 
             
            description: This gem implements the REST API of the Sisow payment provider.
         | 
| 126 140 | 
             
            email:
         | 
| 127 141 | 
             
            - mail@marceldegraaf.net
         | 
| @@ -129,11 +143,11 @@ executables: [] | |
| 129 143 | 
             
            extensions: []
         | 
| 130 144 | 
             
            extra_rdoc_files: []
         | 
| 131 145 | 
             
            files:
         | 
| 146 | 
            +
            - ".env.example"
         | 
| 132 147 | 
             
            - ".gitignore"
         | 
| 133 | 
            -
            - ". | 
| 148 | 
            +
            - ".ruby-version"
         | 
| 134 149 | 
             
            - ".travis.yml"
         | 
| 135 150 | 
             
            - Gemfile
         | 
| 136 | 
            -
            - Gemfile.lock
         | 
| 137 151 | 
             
            - README.rdoc
         | 
| 138 152 | 
             
            - Rakefile
         | 
| 139 153 | 
             
            - lib/sisow.rb
         | 
| @@ -173,7 +187,6 @@ files: | |
| 173 187 | 
             
            - spec/models/sisow_spec.rb
         | 
| 174 188 | 
             
            - spec/models/sofort_payment_spec.rb
         | 
| 175 189 | 
             
            - spec/models/transaction_request_spec.rb
         | 
| 176 | 
            -
            - spec/sisow.yml.example
         | 
| 177 190 | 
             
            - spec/spec_helper.rb
         | 
| 178 191 | 
             
            - spec/vcr_setup.rb
         | 
| 179 192 | 
             
            homepage: http://github.com/marceldegraaf/sisow
         | 
| @@ -195,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 195 208 | 
             
                  version: '0'
         | 
| 196 209 | 
             
            requirements: []
         | 
| 197 210 | 
             
            rubyforge_project: sisow
         | 
| 198 | 
            -
            rubygems_version: 2.5.1
         | 
| 211 | 
            +
            rubygems_version: 2.4.5.1
         | 
| 199 212 | 
             
            signing_key: 
         | 
| 200 213 | 
             
            specification_version: 4
         | 
| 201 214 | 
             
            summary: Rails gem for payments through Sisow.
         | 
| @@ -214,6 +227,5 @@ test_files: | |
| 214 227 | 
             
            - spec/models/sisow_spec.rb
         | 
| 215 228 | 
             
            - spec/models/sofort_payment_spec.rb
         | 
| 216 229 | 
             
            - spec/models/transaction_request_spec.rb
         | 
| 217 | 
            -
            - spec/sisow.yml.example
         | 
| 218 230 | 
             
            - spec/spec_helper.rb
         | 
| 219 231 | 
             
            - spec/vcr_setup.rb
         | 
    
        data/.rvmrc
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            rvm 1.9.3-p194@sisow
         | 
    
        data/Gemfile.lock
    DELETED
    
    | @@ -1,54 +0,0 @@ | |
| 1 | 
            -
            PATH
         | 
| 2 | 
            -
              remote: .
         | 
| 3 | 
            -
              specs:
         | 
| 4 | 
            -
                sisow (1.6)
         | 
| 5 | 
            -
                  crack
         | 
| 6 | 
            -
                  hashie
         | 
| 7 | 
            -
                  httpi
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            GEM
         | 
| 10 | 
            -
              remote: http://rubygems.org/
         | 
| 11 | 
            -
              specs:
         | 
| 12 | 
            -
                crack (0.4.3)
         | 
| 13 | 
            -
                  safe_yaml (~> 1.0.0)
         | 
| 14 | 
            -
                diff-lcs (1.1.3)
         | 
| 15 | 
            -
                fakeweb (1.3.0)
         | 
| 16 | 
            -
                hashie (3.4.6)
         | 
| 17 | 
            -
                httpi (2.4.2)
         | 
| 18 | 
            -
                  rack
         | 
| 19 | 
            -
                  socksify
         | 
| 20 | 
            -
                multi_json (1.3.5)
         | 
| 21 | 
            -
                rack (2.0.1)
         | 
| 22 | 
            -
                rake (0.9.2.2)
         | 
| 23 | 
            -
                rspec (2.10.0)
         | 
| 24 | 
            -
                  rspec-core (~> 2.10.0)
         | 
| 25 | 
            -
                  rspec-expectations (~> 2.10.0)
         | 
| 26 | 
            -
                  rspec-mocks (~> 2.10.0)
         | 
| 27 | 
            -
                rspec-core (2.10.0)
         | 
| 28 | 
            -
                rspec-expectations (2.10.0)
         | 
| 29 | 
            -
                  diff-lcs (~> 1.1.3)
         | 
| 30 | 
            -
                rspec-mocks (2.10.1)
         | 
| 31 | 
            -
                safe_yaml (1.0.4)
         | 
| 32 | 
            -
                simplecov (0.6.4)
         | 
| 33 | 
            -
                  multi_json (~> 1.0)
         | 
| 34 | 
            -
                  simplecov-html (~> 0.5.3)
         | 
| 35 | 
            -
                simplecov-html (0.5.3)
         | 
| 36 | 
            -
                simplecov-rcov (0.2.3)
         | 
| 37 | 
            -
                  simplecov (>= 0.4.1)
         | 
| 38 | 
            -
                socksify (1.7.0)
         | 
| 39 | 
            -
                vcr (2.1.1)
         | 
| 40 | 
            -
             | 
| 41 | 
            -
            PLATFORMS
         | 
| 42 | 
            -
              ruby
         | 
| 43 | 
            -
             | 
| 44 | 
            -
            DEPENDENCIES
         | 
| 45 | 
            -
              fakeweb
         | 
| 46 | 
            -
              rake
         | 
| 47 | 
            -
              rspec
         | 
| 48 | 
            -
              simplecov
         | 
| 49 | 
            -
              simplecov-rcov
         | 
| 50 | 
            -
              sisow!
         | 
| 51 | 
            -
              vcr
         | 
| 52 | 
            -
             | 
| 53 | 
            -
            BUNDLED WITH
         | 
| 54 | 
            -
               1.13.1
         |