wirecard_checkout_page 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.utilsrc +21 -0
- data/VERSION +1 -1
- data/lib/wirecard_checkout_page.rb +1 -0
- data/lib/wirecard_checkout_page/checked_response.rb +23 -0
- data/lib/wirecard_checkout_page/gateway.rb +4 -2
- data/lib/wirecard_checkout_page/version.rb +1 -1
- data/spec/wirecard_checkout_page/checked_response_spec.rb +45 -0
- data/spec/wirecard_checkout_page/gateway_spec.rb +6 -4
- data/spec/wirecard_checkout_page/{init_response_spec.rb → response_spec.rb} +0 -0
- data/wirecard_checkout_page.gemspec +5 -5
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc51edcaa21801adf0d37957f3990226d9184b66
|
4
|
+
data.tar.gz: 2a97377d4cee7c220213c2b46f16f0929082b3bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17df65f469ef1335cd5d70617d5922a138a4c860d439774de221b59c57a53fa329292ef74580374258b84239d11340c6581cf933fa0157a3c20d3ca27f10c0c7
|
7
|
+
data.tar.gz: edfea03e52cbb6efd033c0699ca99b8c24802fb31cd24fbc86f6433352d93cd98799d9f7520b85e7e7b4d7804390178e64858fc1a87225309b07411f8fb1ab2a
|
data/.utilsrc
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# vim: set ft=ruby:
|
2
|
+
|
3
|
+
search do
|
4
|
+
prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage)\z/
|
5
|
+
skip_files /(\A\.|\.sw[pon]\z|\.(log|fnm|jpg|jpeg|png|pdf|svg)\z|tags|~\z)/i
|
6
|
+
end
|
7
|
+
|
8
|
+
discover do
|
9
|
+
prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage)\z/
|
10
|
+
skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
|
11
|
+
binary false
|
12
|
+
end
|
13
|
+
|
14
|
+
strip_spaces do
|
15
|
+
prune_dirs /\A(\..*|CVS)\z/
|
16
|
+
skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
|
17
|
+
end
|
18
|
+
|
19
|
+
probe do
|
20
|
+
test_framework :'rspec'
|
21
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
@@ -7,6 +7,7 @@ require 'wirecard_checkout_page/utils'
|
|
7
7
|
require 'wirecard_checkout_page/request_checksum'
|
8
8
|
require 'wirecard_checkout_page/response_checksum'
|
9
9
|
require 'wirecard_checkout_page/init_response'
|
10
|
+
require 'wirecard_checkout_page/checked_response'
|
10
11
|
|
11
12
|
module WirecardCheckoutPage
|
12
13
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module WirecardCheckoutPage
|
2
|
+
class CheckedResponse
|
3
|
+
include WirecardCheckoutPage::Utils
|
4
|
+
|
5
|
+
def initialize(params)
|
6
|
+
@params = stringify_keys(params).freeze
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader :params
|
10
|
+
|
11
|
+
def valid?
|
12
|
+
WirecardCheckoutPage::ResponseChecksum.new(@params).valid?
|
13
|
+
end
|
14
|
+
|
15
|
+
def success?
|
16
|
+
valid? && @params['paymentState'] == 'SUCCESS'
|
17
|
+
end
|
18
|
+
|
19
|
+
def message
|
20
|
+
@params['message']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -15,8 +15,10 @@ module WirecardCheckoutPage
|
|
15
15
|
InitResponse.new Typhoeus.post(init_url, body: checksum.request_parameters)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
WirecardCheckoutPage::
|
18
|
+
def check_response(params = {})
|
19
|
+
WirecardCheckoutPage::CheckedResponse.new(
|
20
|
+
params.merge(authentication_params)
|
21
|
+
)
|
20
22
|
end
|
21
23
|
|
22
24
|
private
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WirecardCheckoutPage::CheckedResponse do
|
4
|
+
let :checked_response do
|
5
|
+
WirecardCheckoutPage::CheckedResponse.new(
|
6
|
+
paymentState: 'SUCCESS',
|
7
|
+
message: 'It worked!'
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#success?' do
|
12
|
+
it 'is not succcessful if invalid' do
|
13
|
+
allow(checked_response).to receive(:valid?).and_return(false)
|
14
|
+
expect(checked_response).to_not be_success
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'is not succcessful if paymentState is not "SUCCESS"' do
|
18
|
+
checked_response = WirecardCheckoutPage::CheckedResponse.new(
|
19
|
+
paymentState: 'SOMETHING'
|
20
|
+
)
|
21
|
+
allow(checked_response).to receive(:valid?).and_return(true)
|
22
|
+
expect(checked_response).to_not be_success
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'is succcessful if valid and paymentState "SUCCESS"' do
|
26
|
+
allow(checked_response).to receive(:valid?).and_return(true)
|
27
|
+
expect(checked_response).to be_success
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#params' do
|
32
|
+
it 'returns the the params' do
|
33
|
+
expect(checked_response.params).to eq(
|
34
|
+
'message' => 'It worked!',
|
35
|
+
'paymentState' => 'SUCCESS'
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#message' do
|
41
|
+
it 'returns the message' do
|
42
|
+
expect(checked_response.message).to eq 'It worked!'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -45,16 +45,18 @@ describe WirecardCheckoutPage::Gateway do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe '#
|
48
|
+
describe '#check_response' do
|
49
49
|
it 'builds a checksum with the authorization params' do
|
50
50
|
expect(WirecardCheckoutPage::ResponseChecksum).to receive(:new).
|
51
|
-
with(
|
52
|
-
|
51
|
+
with(
|
52
|
+
hash_including('customerId' => 'foo', 'secret' => 'bar')
|
53
|
+
).and_call_original
|
54
|
+
gateway.check_response.valid?
|
53
55
|
end
|
54
56
|
|
55
57
|
it 'returns true if the response was valid' do
|
56
58
|
allow_any_instance_of(WirecardCheckoutPage::ResponseChecksum).to receive(:valid?).and_return(true)
|
57
|
-
expect(gateway.
|
59
|
+
expect(gateway.check_response).to be_valid
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
File without changes
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: wirecard_checkout_page 0.0.
|
2
|
+
# stub: wirecard_checkout_page 0.0.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "wirecard_checkout_page"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Florian Frank"]
|
11
|
-
s.date = "2014-10-
|
11
|
+
s.date = "2014-10-27"
|
12
12
|
s.description = "This library allows you to use the Wirecard Checkout Page service."
|
13
13
|
s.email = "flori@ping.de"
|
14
|
-
s.extra_rdoc_files = ["README.md", "lib/wirecard_checkout_page.rb", "lib/wirecard_checkout_page/errors.rb", "lib/wirecard_checkout_page/gateway.rb", "lib/wirecard_checkout_page/init_response.rb", "lib/wirecard_checkout_page/request_checksum.rb", "lib/wirecard_checkout_page/response_checksum.rb", "lib/wirecard_checkout_page/utils.rb", "lib/wirecard_checkout_page/value_handling.rb", "lib/wirecard_checkout_page/value_missing.rb", "lib/wirecard_checkout_page/version.rb", "lib/wirecard_checkout_page/wirecard_checkout_page_error.rb"]
|
15
|
-
s.files = [".gitignore", ".rspec", ".travis.yml", "Gemfile", "README.md", "Rakefile", "VERSION", "lib/wirecard_checkout_page.rb", "lib/wirecard_checkout_page/errors.rb", "lib/wirecard_checkout_page/gateway.rb", "lib/wirecard_checkout_page/init_response.rb", "lib/wirecard_checkout_page/request_checksum.rb", "lib/wirecard_checkout_page/response_checksum.rb", "lib/wirecard_checkout_page/utils.rb", "lib/wirecard_checkout_page/value_handling.rb", "lib/wirecard_checkout_page/value_missing.rb", "lib/wirecard_checkout_page/version.rb", "lib/wirecard_checkout_page/wirecard_checkout_page_error.rb", "spec/spec_helper.rb", "spec/wirecard_checkout_page/
|
14
|
+
s.extra_rdoc_files = ["README.md", "lib/wirecard_checkout_page.rb", "lib/wirecard_checkout_page/checked_response.rb", "lib/wirecard_checkout_page/errors.rb", "lib/wirecard_checkout_page/gateway.rb", "lib/wirecard_checkout_page/init_response.rb", "lib/wirecard_checkout_page/request_checksum.rb", "lib/wirecard_checkout_page/response_checksum.rb", "lib/wirecard_checkout_page/utils.rb", "lib/wirecard_checkout_page/value_handling.rb", "lib/wirecard_checkout_page/value_missing.rb", "lib/wirecard_checkout_page/version.rb", "lib/wirecard_checkout_page/wirecard_checkout_page_error.rb"]
|
15
|
+
s.files = [".gitignore", ".rspec", ".travis.yml", ".utilsrc", "Gemfile", "README.md", "Rakefile", "VERSION", "lib/wirecard_checkout_page.rb", "lib/wirecard_checkout_page/checked_response.rb", "lib/wirecard_checkout_page/errors.rb", "lib/wirecard_checkout_page/gateway.rb", "lib/wirecard_checkout_page/init_response.rb", "lib/wirecard_checkout_page/request_checksum.rb", "lib/wirecard_checkout_page/response_checksum.rb", "lib/wirecard_checkout_page/utils.rb", "lib/wirecard_checkout_page/value_handling.rb", "lib/wirecard_checkout_page/value_missing.rb", "lib/wirecard_checkout_page/version.rb", "lib/wirecard_checkout_page/wirecard_checkout_page_error.rb", "spec/spec_helper.rb", "spec/wirecard_checkout_page/checked_response_spec.rb", "spec/wirecard_checkout_page/gateway_spec.rb", "spec/wirecard_checkout_page/request_checksum_spec.rb", "spec/wirecard_checkout_page/response_checksum_spec.rb", "spec/wirecard_checkout_page/response_spec.rb", "wirecard_checkout_page.gemspec"]
|
16
16
|
s.homepage = "http://flori.github.com/wirecard_checkout_page"
|
17
17
|
s.licenses = ["Apache-2.0"]
|
18
18
|
s.rdoc_options = ["--title", "WirecardCheckoutPage -- Wirecard Checkout Page implementation", "--main", "README.md"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wirecard_checkout_page
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -101,6 +101,7 @@ extensions: []
|
|
101
101
|
extra_rdoc_files:
|
102
102
|
- README.md
|
103
103
|
- lib/wirecard_checkout_page.rb
|
104
|
+
- lib/wirecard_checkout_page/checked_response.rb
|
104
105
|
- lib/wirecard_checkout_page/errors.rb
|
105
106
|
- lib/wirecard_checkout_page/gateway.rb
|
106
107
|
- lib/wirecard_checkout_page/init_response.rb
|
@@ -115,11 +116,13 @@ files:
|
|
115
116
|
- .gitignore
|
116
117
|
- .rspec
|
117
118
|
- .travis.yml
|
119
|
+
- .utilsrc
|
118
120
|
- Gemfile
|
119
121
|
- README.md
|
120
122
|
- Rakefile
|
121
123
|
- VERSION
|
122
124
|
- lib/wirecard_checkout_page.rb
|
125
|
+
- lib/wirecard_checkout_page/checked_response.rb
|
123
126
|
- lib/wirecard_checkout_page/errors.rb
|
124
127
|
- lib/wirecard_checkout_page/gateway.rb
|
125
128
|
- lib/wirecard_checkout_page/init_response.rb
|
@@ -131,10 +134,11 @@ files:
|
|
131
134
|
- lib/wirecard_checkout_page/version.rb
|
132
135
|
- lib/wirecard_checkout_page/wirecard_checkout_page_error.rb
|
133
136
|
- spec/spec_helper.rb
|
137
|
+
- spec/wirecard_checkout_page/checked_response_spec.rb
|
134
138
|
- spec/wirecard_checkout_page/gateway_spec.rb
|
135
|
-
- spec/wirecard_checkout_page/init_response_spec.rb
|
136
139
|
- spec/wirecard_checkout_page/request_checksum_spec.rb
|
137
140
|
- spec/wirecard_checkout_page/response_checksum_spec.rb
|
141
|
+
- spec/wirecard_checkout_page/response_spec.rb
|
138
142
|
- wirecard_checkout_page.gemspec
|
139
143
|
homepage: http://flori.github.com/wirecard_checkout_page
|
140
144
|
licenses:
|