payex 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -2
- data/Gemfile.lock +25 -24
- data/README.md +0 -2
- data/lib/payex/api.rb +3 -4
- data/lib/payex/api/pxorder.rb +3 -3
- data/lib/payex/credit_card_redirect.rb +1 -1
- data/payex.gemspec +3 -4
- data/spec/credit_card_redirect_spec.rb +10 -3
- data/spec/fixtures/{initialize7 → initialize8}/initialize_ok.xml +4 -4
- data/spec/spec_helper.rb +0 -9
- metadata +32 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e825093f950b6bf7d448dff56603b82b89c3fef
|
4
|
+
data.tar.gz: 2da6c252406b9592226b8d8dfceb700bd7fe3ed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1608997f902e1930b383d83a28f332dee1d5b0a91e754ee73d798d2cf24200ada828e83d328b9b4d79e70588aea2250c227b99d84e9255deb041f1d5a988942a
|
7
|
+
data.tar.gz: 4102cfbca7a44344da45cc48b1685e75397fbddba330144fffcc5656ee22b219b81095826a6573eebb0aacfb6b94b0989deff8a3d0c53f848f1e38aedde58abd
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,16 +3,16 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
payex (0.3)
|
5
5
|
httpclient (~> 2.2)
|
6
|
-
nori (~>
|
7
|
-
savon (~>
|
6
|
+
nori (~> 2.6)
|
7
|
+
savon (~> 2.11)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
akami (1.
|
12
|
+
akami (1.3.1)
|
13
13
|
gyoku (>= 0.4.0)
|
14
|
-
nokogiri
|
15
|
-
builder (3.
|
14
|
+
nokogiri
|
15
|
+
builder (3.2.2)
|
16
16
|
diff-lcs (1.1.3)
|
17
17
|
guard (1.3.3)
|
18
18
|
listen (>= 0.4.2)
|
@@ -22,15 +22,17 @@ GEM
|
|
22
22
|
guard (~> 1.1)
|
23
23
|
guard-rspec (1.2.1)
|
24
24
|
guard (>= 1.1)
|
25
|
-
gyoku (
|
25
|
+
gyoku (1.3.1)
|
26
26
|
builder (>= 2.1.2)
|
27
|
-
httpclient (2.
|
28
|
-
httpi (
|
27
|
+
httpclient (2.8.0)
|
28
|
+
httpi (2.4.1)
|
29
29
|
rack
|
30
30
|
listen (0.5.2)
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
mini_portile2 (2.0.0)
|
32
|
+
nokogiri (1.6.7.2)
|
33
|
+
mini_portile2 (~> 2.0.0.rc2)
|
34
|
+
nori (2.6.0)
|
35
|
+
rack (1.6.4)
|
34
36
|
rake (0.9.2.2)
|
35
37
|
rb-fsevent (0.9.2)
|
36
38
|
rspec (2.11.0)
|
@@ -41,22 +43,19 @@ GEM
|
|
41
43
|
rspec-expectations (2.11.3)
|
42
44
|
diff-lcs (~> 1.1.3)
|
43
45
|
rspec-mocks (2.11.3)
|
44
|
-
savon (
|
45
|
-
akami (~> 1.2
|
46
|
+
savon (2.11.1)
|
47
|
+
akami (~> 1.2)
|
46
48
|
builder (>= 2.1.2)
|
47
|
-
gyoku (~>
|
48
|
-
httpi (~>
|
49
|
+
gyoku (~> 1.2)
|
50
|
+
httpi (~> 2.3)
|
49
51
|
nokogiri (>= 1.4.0)
|
50
|
-
nori (~>
|
51
|
-
wasabi (~>
|
52
|
-
savon_spec (1.3.0)
|
53
|
-
rspec (>= 2.0.0)
|
54
|
-
savon (~> 1.0)
|
52
|
+
nori (~> 2.4)
|
53
|
+
wasabi (~> 3.4)
|
55
54
|
terminal-notifier-guard (1.5.3)
|
56
55
|
thor (0.16.0)
|
57
|
-
wasabi (
|
58
|
-
httpi (~>
|
59
|
-
nokogiri (>= 1.4.
|
56
|
+
wasabi (3.5.0)
|
57
|
+
httpi (~> 2.0)
|
58
|
+
nokogiri (>= 1.4.2)
|
60
59
|
|
61
60
|
PLATFORMS
|
62
61
|
ruby
|
@@ -70,5 +69,7 @@ DEPENDENCIES
|
|
70
69
|
rake (~> 0.9)
|
71
70
|
rb-fsevent (~> 0.9)
|
72
71
|
rspec (~> 2.11)
|
73
|
-
savon_spec (~> 1.3)
|
74
72
|
terminal-notifier-guard (~> 1.5)
|
73
|
+
|
74
|
+
BUNDLED WITH
|
75
|
+
1.11.2
|
data/README.md
CHANGED
data/lib/payex/api.rb
CHANGED
@@ -15,7 +15,8 @@ module PayEx::API
|
|
15
15
|
# Unwrap e.g. <Initialize8Result>
|
16
16
|
response = response[response.keys.first]
|
17
17
|
# Parse embedded XML document
|
18
|
-
|
18
|
+
parser = Nori.new(convert_tags_to: lambda { |tag| tag.snakecase.to_sym })
|
19
|
+
response = parser.parse(response)
|
19
20
|
# Unwrap <payex>
|
20
21
|
response = response[response.keys.first]
|
21
22
|
|
@@ -29,9 +30,7 @@ module PayEx::API
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def invoke_raw! wsdl, name, body
|
32
|
-
Savon.client(wsdl).
|
33
|
-
http.headers.delete('SOAPAction')
|
34
|
-
}.body
|
33
|
+
Savon.client(wsdl: wsdl).call(name, soap_action: false, message: body).body
|
35
34
|
end
|
36
35
|
|
37
36
|
def signed_hash(string)
|
data/lib/payex/api/pxorder.rb
CHANGED
@@ -5,8 +5,8 @@ module PayEx::PxOrder
|
|
5
5
|
'%s/pxorder/pxorder.asmx?WSDL' % PayEx.base_url
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
PayEx::API.invoke! wsdl,
|
8
|
+
def Initialize8(params)
|
9
|
+
PayEx::API.invoke! wsdl, :initialize8, params, {
|
10
10
|
'accountNumber' => {
|
11
11
|
signed: true,
|
12
12
|
default: proc { PayEx.account_number! }
|
@@ -81,7 +81,7 @@ module PayEx::PxOrder
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def Complete(params)
|
84
|
-
PayEx::API.invoke! wsdl,
|
84
|
+
PayEx::API.invoke! wsdl, :complete, params, {
|
85
85
|
'accountNumber' => {
|
86
86
|
signed: true,
|
87
87
|
default: proc { PayEx.account_number! }
|
@@ -2,7 +2,7 @@ module PayEx::CreditCardRedirect
|
|
2
2
|
extend self
|
3
3
|
|
4
4
|
def initialize_transaction! params
|
5
|
-
response = PayEx::PxOrder.
|
5
|
+
response = PayEx::PxOrder.Initialize8 \
|
6
6
|
orderID: params[:order_id],
|
7
7
|
purchaseOperation: 'AUTHORIZATION',
|
8
8
|
productNumber: params[:product_number],
|
data/payex.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'payex'
|
5
|
-
gem.version = '0.
|
5
|
+
gem.version = '0.4'
|
6
6
|
gem.summary = 'PayEx SOAP API glue'
|
7
7
|
gem.author = 'Daniel Brockman'
|
8
8
|
gem.files = `git ls-files 2>/dev/null`.split($\)
|
9
9
|
|
10
10
|
gem.add_dependency 'httpclient', '~> 2.2'
|
11
|
-
gem.add_dependency 'nori', '~>
|
12
|
-
gem.add_dependency 'savon', '~>
|
11
|
+
gem.add_dependency 'nori', '~> 2.6'
|
12
|
+
gem.add_dependency 'savon', '~> 2.11'
|
13
13
|
|
14
14
|
if RUBY_PLATFORM == 'java'
|
15
15
|
gem.add_dependency 'jruby-openssl', '~> 0.7'
|
@@ -21,6 +21,5 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_development_dependency 'rake', '~> 0.9'
|
22
22
|
gem.add_development_dependency 'rb-fsevent', '~> 0.9'
|
23
23
|
gem.add_development_dependency 'rspec', '~> 2.11'
|
24
|
-
gem.add_development_dependency 'savon_spec', '~> 1.3'
|
25
24
|
gem.add_development_dependency 'terminal-notifier-guard', '~> 1.5'
|
26
25
|
end
|
@@ -1,8 +1,13 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'payex'
|
3
3
|
require 'spec_helper'
|
4
|
+
require "savon/mock/spec_helper"
|
4
5
|
|
5
6
|
describe PayEx::CreditCardRedirect do
|
7
|
+
include Savon::SpecHelper
|
8
|
+
before(:all) { savon.mock! }
|
9
|
+
after(:all) { savon.unmock! }
|
10
|
+
|
6
11
|
SAMPLE_ACCOUNT_NUMBER = 'SAMPLEACCOUNTNUMBER0001'
|
7
12
|
SAMPLE_ENCRYPTION_KEY = 'SAMPLEENCRYPTIONKEY0001'
|
8
13
|
SAMPLE_DEFAULT_CURRENCY = 'SEK'
|
@@ -45,7 +50,8 @@ describe PayEx::CreditCardRedirect do
|
|
45
50
|
}
|
46
51
|
|
47
52
|
expected['hash'] = PayEx::API.signed_hash(expected.values.join)
|
48
|
-
|
53
|
+
initialize_ok_fixture = File.read('spec/fixtures/initialize8/initialize_ok.xml')
|
54
|
+
savon.expects(:initialize8).with(message: expected).returns(initialize_ok_fixture)
|
49
55
|
|
50
56
|
href = PayEx::CreditCardRedirect.initialize_transaction! \
|
51
57
|
order_id: SAMPLE_ORDER_ID,
|
@@ -63,14 +69,15 @@ describe PayEx::CreditCardRedirect do
|
|
63
69
|
SAMPLE_ORDER_REF = 'SAMPLEORDERREF0001'
|
64
70
|
|
65
71
|
describe :complete_transaction! do
|
66
|
-
def invoke_complete!
|
72
|
+
def invoke_complete! response_fixture_file
|
67
73
|
expected = {
|
68
74
|
'accountNumber' => SAMPLE_ACCOUNT_NUMBER,
|
69
75
|
'orderRef' => SAMPLE_ORDER_REF
|
70
76
|
}
|
71
77
|
|
72
78
|
expected['hash'] = PayEx::API.signed_hash(expected.values.join)
|
73
|
-
|
79
|
+
response_fixture = File.read("spec/fixtures/complete/#{response_fixture_file}.xml")
|
80
|
+
savon.expects(:complete).with(message: expected).returns(response_fixture)
|
74
81
|
PayEx::CreditCardRedirect.complete_transaction! SAMPLE_ORDER_REF
|
75
82
|
end
|
76
83
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
4
|
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
5
5
|
<soap:Body>
|
6
|
-
<
|
7
|
-
<
|
6
|
+
<Initialize8Response xmlns="http://external.payex.com/PxOrder/">
|
7
|
+
<Initialize8Result>
|
8
8
|
<![CDATA[
|
9
9
|
<?xml version="1.0" encoding="utf-8" ?>
|
10
10
|
<payex>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<redirectUrl>https://test-confined.payex.com/PxOrderCC.aspx?orderRef=67d7e7d3b4134741a3297480dca6d899</redirectUrl>
|
25
25
|
</payex>
|
26
26
|
]]>
|
27
|
-
</
|
28
|
-
</
|
27
|
+
</Initialize8Result>
|
28
|
+
</Initialize8Response>
|
29
29
|
</soap:Body>
|
30
30
|
</soap:Envelope>
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,2 @@
|
|
1
|
-
require 'savon_spec'
|
2
|
-
|
3
|
-
Savon::Spec::Fixture.path =
|
4
|
-
File.expand_path('../fixtures', __FILE__)
|
5
|
-
|
6
|
-
RSpec.configure do |config|
|
7
|
-
config.include Savon::Spec::Macros
|
8
|
-
end
|
9
|
-
|
10
1
|
# Suppress "HTTPI executes HTTP GET using the httpclient adapter"
|
11
2
|
HTTPI.log = false
|
metadata
CHANGED
@@ -1,167 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Brockman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.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
26
|
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nori
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.6'
|
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: '2.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: savon
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.11'
|
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: '
|
54
|
+
version: '2.11'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: guard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.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
68
|
version: '1.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.0'
|
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
82
|
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: guard-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.2'
|
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
96
|
version: '1.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0.9'
|
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
110
|
version: '0.9'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rb-fsevent
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0.9'
|
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
124
|
version: '0.9'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '2.11'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '2.11'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: savon_spec
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ~>
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '1.3'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ~>
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '1.3'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: terminal-notifier-guard
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
|
-
- - ~>
|
143
|
+
- - "~>"
|
158
144
|
- !ruby/object:Gem::Version
|
159
145
|
version: '1.5'
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
|
-
- - ~>
|
150
|
+
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: '1.5'
|
167
153
|
description:
|
@@ -170,8 +156,8 @@ executables: []
|
|
170
156
|
extensions: []
|
171
157
|
extra_rdoc_files: []
|
172
158
|
files:
|
173
|
-
- .gitignore
|
174
|
-
- .travis.yml
|
159
|
+
- ".gitignore"
|
160
|
+
- ".travis.yml"
|
175
161
|
- Gemfile
|
176
162
|
- Gemfile.lock
|
177
163
|
- Guardfile
|
@@ -187,7 +173,7 @@ files:
|
|
187
173
|
- spec/fixtures/complete/complete_declined.xml
|
188
174
|
- spec/fixtures/complete/complete_failed.xml
|
189
175
|
- spec/fixtures/complete/complete_ok.xml
|
190
|
-
- spec/fixtures/
|
176
|
+
- spec/fixtures/initialize8/initialize_ok.xml
|
191
177
|
- spec/spec_helper.rb
|
192
178
|
homepage:
|
193
179
|
licenses: []
|
@@ -198,17 +184,17 @@ require_paths:
|
|
198
184
|
- lib
|
199
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
200
186
|
requirements:
|
201
|
-
- -
|
187
|
+
- - ">="
|
202
188
|
- !ruby/object:Gem::Version
|
203
189
|
version: '0'
|
204
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
191
|
requirements:
|
206
|
-
- -
|
192
|
+
- - ">="
|
207
193
|
- !ruby/object:Gem::Version
|
208
194
|
version: '0'
|
209
195
|
requirements: []
|
210
196
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.
|
197
|
+
rubygems_version: 2.6.6
|
212
198
|
signing_key:
|
213
199
|
specification_version: 4
|
214
200
|
summary: PayEx SOAP API glue
|