sisow 0.9.5 → 0.9.9

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sisow (0.9.4)
4
+ sisow (0.9.5)
5
5
  hashie
6
6
  httparty
7
7
 
@@ -47,7 +47,7 @@ module Sisow
47
47
  private
48
48
 
49
49
  def transaction_params
50
- {
50
+ params = {
51
51
  :payment => payment.payment_method,
52
52
  :purchaseid => payment.purchase_id,
53
53
  :amount => payment.amount,
@@ -61,6 +61,25 @@ module Sisow
61
61
  :shop_id => payment.shop_id,
62
62
  :sha1 => sha1
63
63
  }
64
+
65
+ # Only iDEAL payments need an actual issuerid
66
+ #
67
+ # In test mode, the other payment types need an issuerid
68
+ # that is '99' (otherwise you will always get a
69
+ # production payment URL, regardless of 'test=true'
70
+ # in the request.
71
+ #
72
+ # In production mode, the other payment types do
73
+ # not need an issuerid at all, so we just delete it.
74
+ unless payment.ideal?
75
+ if Sisow.configuration.test_mode_enabled?
76
+ params[:issuerid] = '99'
77
+ else
78
+ params.delete(:issuerid)
79
+ end
80
+ end
81
+
82
+ params
64
83
  end
65
84
 
66
85
  def payment
data/lib/sisow/payment.rb CHANGED
@@ -35,6 +35,10 @@ module Sisow
35
35
  (!amount.nil? && amount != '')
36
36
  end
37
37
 
38
+ def ideal?
39
+ payment_method == 'ideal'
40
+ end
41
+
38
42
  def payment_method; raise 'Implement me in a subclass'; end
39
43
 
40
44
  private
data/lib/sisow/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sisow
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.9"
3
3
  end
@@ -21,4 +21,41 @@ describe Sisow::Api::TransactionRequest do
21
21
 
22
22
  end
23
23
 
24
+ it "should not remove issuerid when it is an iDEAL payment" do
25
+ payment = Sisow::IdealPayment.new
26
+ request = Sisow::Api::TransactionRequest.new(payment)
27
+
28
+ request.params.keys.should include(:issuerid)
29
+ end
30
+
31
+ it "should remove issuerid from params for Bancontact" do
32
+ Sisow.configuration.stub!(:test_mode_enabled?).and_return(false)
33
+ payment = Sisow::BancontactPayment.new
34
+ request = Sisow::Api::TransactionRequest.new(payment)
35
+
36
+ request.params.keys.should_not include(:issuerid)
37
+ end
38
+
39
+ it "should force issuerid to '99' for Bancontact in test mode" do
40
+ payment = Sisow::BancontactPayment.new
41
+ request = Sisow::Api::TransactionRequest.new(payment)
42
+
43
+ request.params[:issuerid].should == '99'
44
+ end
45
+
46
+ it "should remove issuerid from params for Sofort" do
47
+ Sisow.configuration.stub!(:test_mode_enabled?).and_return(false)
48
+ payment = Sisow::SofortPayment.new
49
+ request = Sisow::Api::TransactionRequest.new(payment)
50
+
51
+ request.params.keys.should_not include(:issuerid)
52
+ end
53
+
54
+ it "should force issuerid to '99' for Sofort in test mode" do
55
+ payment = Sisow::SofortPayment.new
56
+ request = Sisow::Api::TransactionRequest.new(payment)
57
+
58
+ request.params[:issuerid].should == '99'
59
+ end
60
+
24
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sisow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-12 00:00:00.000000000 Z
12
+ date: 2012-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty