debitech_soap 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -2
- data/lib/debitech_soap/api.rb +18 -1
- data/lib/debitech_soap/version.rb +1 -1
- data/spec/debitech_soap_spec.rb +13 -7
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27d41ad832b2eba41d08b3aa17b750a104fe92d9
|
4
|
+
data.tar.gz: e55ad817106d4bf04ffd0c84b9a3926aebc9119f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e05d146e4c3f7ded0a9fc6fe19edfa3ce6c838368db5b1b58cca9b1600cec63d3510440f9064bfacdbb8d75d947ff4622ef0c805da924c82b53cec570f4b991
|
7
|
+
data.tar.gz: fcf23bc8f637d58d2d42bbd17c7f43576d462b5c888a3cf54beab2e92f6e91c5f2b4496526d56d6f3792cb829c1d44f976db7703fb9e94fccde2d97c1772065b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
debitech_soap (1.
|
4
|
+
debitech_soap (1.1.1)
|
5
5
|
httpclient (>= 2.4.0)
|
6
6
|
mumboe-soap4r (~> 1.5.8.4)
|
7
7
|
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
thor (~> 0.14.6)
|
14
14
|
guard-rspec (0.5.0)
|
15
15
|
guard (>= 0.8.4)
|
16
|
-
httpclient (2.
|
16
|
+
httpclient (2.8.3)
|
17
17
|
mumboe-soap4r (1.5.8.7)
|
18
18
|
httpclient (>= 2.1.1)
|
19
19
|
rake (0.9.2)
|
@@ -36,3 +36,6 @@ DEPENDENCIES
|
|
36
36
|
guard-rspec
|
37
37
|
rake
|
38
38
|
rspec
|
39
|
+
|
40
|
+
BUNDLED WITH
|
41
|
+
1.15.4
|
data/lib/debitech_soap/api.rb
CHANGED
@@ -40,6 +40,9 @@ module DebitechSoap
|
|
40
40
|
@client = SOAP::WSDLDriverFactory.new(File.join(File.dirname(__FILE__), "../service.wsdl")).create_rpc_driver
|
41
41
|
end
|
42
42
|
|
43
|
+
# Uncomment this line if you want to see the request and response printed to STDERR.
|
44
|
+
#@client.wiredump_dev = STDERR
|
45
|
+
|
43
46
|
# Enable changing supported ciphers, for deprecation situations like http://tech.dibspayment.com/nodeaddpage/listofapprovedciphersuites.
|
44
47
|
# This lets us easily experiment in development, and to do quick changes in production if we must.
|
45
48
|
dibs_httpclient_ciphers = ENV["DIBS_HTTPCLIENT_CIPHERS"]
|
@@ -53,7 +56,21 @@ module DebitechSoap
|
|
53
56
|
|
54
57
|
def valid_credentials?
|
55
58
|
disable_stderr do
|
56
|
-
|
59
|
+
# We make a "refund" request, but we make sure to set the amount to 0 and to enter a verify ID that will never match a real one.
|
60
|
+
# Previously, we'd confirm credentials with the safer checkSwedishPersNo call, but that seems broken now (always returns false).
|
61
|
+
response_value = return_value(@client.refund(@api_credentials.merge({ :verifyID => -1, :amount => 0 })))
|
62
|
+
result_text = response_value.resultText
|
63
|
+
|
64
|
+
case result_text
|
65
|
+
when "error_transID_or_verifyID"
|
66
|
+
# The auth succeeded, but the refund (thankfully and intentionally) did not.
|
67
|
+
true
|
68
|
+
when "336 web_service_login_failed"
|
69
|
+
# The auth is wrong.
|
70
|
+
false
|
71
|
+
else
|
72
|
+
raise "Unexpected result text: #{result_text.inspect}"
|
73
|
+
end
|
57
74
|
end
|
58
75
|
end
|
59
76
|
|
data/spec/debitech_soap_spec.rb
CHANGED
@@ -35,23 +35,29 @@ describe DebitechSoap::API, "valid_credentials?" do
|
|
35
35
|
SOAP::WSDLDriverFactory.stub!(:new).and_return(mock(Object, :create_rpc_driver => @client))
|
36
36
|
end
|
37
37
|
|
38
|
-
it "should call
|
39
|
-
@client.should_receive(:
|
40
|
-
:password => "api_user_password", :
|
41
|
-
and_return(mock(Object, :return => "
|
38
|
+
it "should call 'refund' with the credentials and dummy values, returning true if we were authed but failed to refund" do
|
39
|
+
@client.should_receive(:refund).with(:shopName => "merchant_name", :userName => "api_user_name",
|
40
|
+
:password => "api_user_password", :verifyID => -1, :amount => 0).
|
41
|
+
and_return(mock(Object, :return => mock(Object, :resultText => "error_transID_or_verifyID")))
|
42
42
|
|
43
43
|
api = DebitechSoap::API.new(:merchant => "merchant_name", :username => "api_user_name", :password => "api_user_password")
|
44
44
|
api.valid_credentials?.should == true
|
45
45
|
end
|
46
46
|
|
47
|
-
it "should return false if the service returns
|
48
|
-
@client.stub!(:
|
47
|
+
it "should return false if the service returns an auth error" do
|
48
|
+
@client.stub!(:refund).and_return(mock(Object, :return => mock(Object, :resultText => "336 web_service_login_failed")))
|
49
49
|
api = DebitechSoap::API.new(:merchant => "merchant_name", :username => "api_user_name", :password => "api_user_password")
|
50
50
|
api.valid_credentials?.should == false
|
51
51
|
end
|
52
52
|
|
53
|
+
it "raises if the service returns an unexpected result" do
|
54
|
+
@client.stub!(:refund).and_return(mock(Object, :return => mock(Object, :resultText => "let's have lunch")))
|
55
|
+
api = DebitechSoap::API.new(:merchant => "merchant_name", :username => "api_user_name", :password => "api_user_password")
|
56
|
+
expect { api.valid_credentials? }.to raise_error(%{Unexpected result text: "let's have lunch"})
|
57
|
+
end
|
58
|
+
|
53
59
|
it "should work with Ruby 1.9 SOAP API" do
|
54
|
-
@client.stub!(:
|
60
|
+
@client.stub!(:refund).and_return(mock(Object, :m_return => mock(Object, :resultText => "error_transID_or_verifyID")))
|
55
61
|
api = DebitechSoap::API.new
|
56
62
|
api.valid_credentials?.should == true
|
57
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debitech_soap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joakim Kolsjö
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-12-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: httpclient
|
@@ -143,8 +143,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.6.
|
146
|
+
rubygems_version: 2.6.11
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: A pure ruby way to make payments with DebiTech
|
150
|
-
test_files:
|
150
|
+
test_files:
|
151
|
+
- spec/debitech_soap_spec.rb
|