jemquarie 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/jemquarie/parser/cash_transactions.rb +3 -1
- data/lib/jemquarie/version.rb +1 -1
- data/spec/files/wrong_account_number.xml +19 -0
- data/spec/files/wrong_authentication.xml +19 -0
- data/spec/lib/importer_spec.rb +42 -8
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34388f2aec3d3af4a4821cf685cc5fae4b6cd54e
|
4
|
+
data.tar.gz: 037df292b05aee50342735b33d205ab5d71119da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eed3dd6865208966b511fdb72e34f7c97ab35b346a857080bb1210cf166aeac0e1fc6d4a69b96824261a84ec9f81cbcb7e091bbb005b43b5f4926e3dcd9a2fb
|
7
|
+
data.tar.gz: d3c8f58db1d1df2d16812f022dbe968b57f83c5e941a161f2e3c7f77cc2e31b0353ba390675899cf9e214615b06eceb267131c62b0458691ad578d5bf84f33e3
|
data/Gemfile.lock
CHANGED
@@ -4,8 +4,10 @@ module Jemquarie
|
|
4
4
|
|
5
5
|
def parse_cash_transactions_response(response)
|
6
6
|
body = response.body
|
7
|
-
return {:error => "Invalid
|
7
|
+
return {:error => "Invalid Authentication Code or Authentication Password"} unless
|
8
|
+
body[:generate_xml_extract_response] && body[:generate_xml_extract_response][:result] && body[:generate_xml_extract_response][:result].is_a?(String)
|
8
9
|
result = Hash.from_xml(Nokogiri::XML.fragment(body[:generate_xml_extract_response][:result]).to_s)
|
10
|
+
return {error: result["XMLExtract"]["RequestDetails"]["RequestErrorDetails"]} if result["XMLExtract"]["RequestDetails"]["RequestStatus"] == "Failure"
|
9
11
|
transactions = []
|
10
12
|
return transactions unless result["XMLExtract"] && result["XMLExtract"]["yourclientsTransactions"] && result["XMLExtract"]["yourclientsTransactions"]["yourclientsTransaction"]
|
11
13
|
xml_transactions = if result["XMLExtract"]["yourclientsTransactions"]["yourclientsTransaction"].is_a?(Hash)
|
data/lib/jemquarie/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
2
|
+
<soapenv:Body>
|
3
|
+
<ns1:GenerateXMLExtractResponse xmlns:ns1="wrapwebservices" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
4
|
+
<result xsi:type="xsd:string"><?xml version="1.0" ?>
|
5
|
+
<XMLExtract>
|
6
|
+
<RequestDetails>
|
7
|
+
<RequestStatus>Failure</RequestStatus>
|
8
|
+
<RequestErrorNumber>V0001</RequestErrorNumber>
|
9
|
+
<RequestErrorDetails>Invalid Account Number</RequestErrorDetails>
|
10
|
+
</RequestDetails>
|
11
|
+
<XMLEntityDetails>
|
12
|
+
<XMLEntityName>your.clients Transactions</XMLEntityName>
|
13
|
+
<XMLEntityVersion>V1.4</XMLEntityVersion>
|
14
|
+
</XMLEntityDetails>
|
15
|
+
</XMLExtract>
|
16
|
+
</result>
|
17
|
+
</ns1:GenerateXMLExtractResponse>
|
18
|
+
</soapenv:Body>
|
19
|
+
</soapenv:Envelope>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
2
|
+
<soapenv:Body>
|
3
|
+
<ns1:GenerateXMLExtractResponse xmlns:ns1="wrapwebservices" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
4
|
+
<result xsi:type="xsd:string"><?xml version="1.0" ?>
|
5
|
+
<XMLExtract>
|
6
|
+
<RequestDetails>
|
7
|
+
<RequestStatus>Failure</RequestStatus>
|
8
|
+
<RequestErrorNumber>E0005</RequestErrorNumber>
|
9
|
+
<RequestErrorDetails>Invalid Authentication Code or Authentication Password</RequestErrorDetails>
|
10
|
+
</RequestDetails>
|
11
|
+
<XMLEntityDetails>
|
12
|
+
<XMLEntityName>your.clients Transactions</XMLEntityName>
|
13
|
+
<XMLEntityVersion>V1.4</XMLEntityVersion>
|
14
|
+
</XMLEntityDetails>
|
15
|
+
</XMLExtract>
|
16
|
+
</result>
|
17
|
+
</ns1:GenerateXMLExtractResponse>
|
18
|
+
</soapenv:Body>
|
19
|
+
</soapenv:Envelope>
|
data/spec/lib/importer_spec.rb
CHANGED
@@ -56,6 +56,23 @@ describe Jemquarie::Importer do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
describe "no data" do
|
60
|
+
let(:importer) do
|
61
|
+
Jemquarie::Importer.new('valid_code', 'valid_password')
|
62
|
+
end
|
63
|
+
before(:each) do
|
64
|
+
FakeWeb.register_uri(:post, Jemquarie::Jemquarie::BASE_URI,
|
65
|
+
body: File.read('spec/files/no_data.xml'),
|
66
|
+
content_type: 'text/xml'
|
67
|
+
)
|
68
|
+
@result = importer.cash_transactions(Date.parse("01/01/2000"), Date.today, '12345')
|
69
|
+
end
|
70
|
+
it "should return an empty array" do
|
71
|
+
expect(@result).to be_kind_of Array
|
72
|
+
expect(@result).to eq([])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
59
76
|
describe "do not allow more than 2 days without an account number" do
|
60
77
|
let(:importer) do
|
61
78
|
Jemquarie::Importer.new('valid_code', 'valid_password')
|
@@ -68,7 +85,7 @@ describe Jemquarie::Importer do
|
|
68
85
|
end
|
69
86
|
end
|
70
87
|
|
71
|
-
describe "
|
88
|
+
describe "non auth" do
|
72
89
|
let(:importer) do
|
73
90
|
Jemquarie::Importer.new('invalid_code', 'or_invalid_password')
|
74
91
|
end
|
@@ -81,24 +98,41 @@ describe Jemquarie::Importer do
|
|
81
98
|
end
|
82
99
|
it "should return wrong authentication" do
|
83
100
|
expect(@result).to be_kind_of Hash
|
84
|
-
expect(@result[:error]).to eq("Invalid
|
101
|
+
expect(@result[:error]).to eq("Invalid Authentication Code or Authentication Password")
|
85
102
|
end
|
86
103
|
end
|
87
104
|
|
88
|
-
describe "
|
105
|
+
describe "wrong auth" do
|
89
106
|
let(:importer) do
|
90
|
-
Jemquarie::Importer.new('
|
107
|
+
Jemquarie::Importer.new('invalid_code', 'or_invalid_password')
|
91
108
|
end
|
92
109
|
before(:each) do
|
93
110
|
FakeWeb.register_uri(:post, Jemquarie::Jemquarie::BASE_URI,
|
94
|
-
body: File.read('spec/files/
|
111
|
+
body: File.read('spec/files/wrong_authentication.xml'),
|
95
112
|
content_type: 'text/xml'
|
96
113
|
)
|
97
114
|
@result = importer.cash_transactions(Date.parse("01/01/2000"), Date.today, '12345')
|
98
115
|
end
|
99
|
-
it "should return
|
100
|
-
expect(@result).to be_kind_of
|
101
|
-
expect(@result).to eq(
|
116
|
+
it "should return wrong authentication" do
|
117
|
+
expect(@result).to be_kind_of Hash
|
118
|
+
expect(@result[:error]).to eq("Invalid Authentication Code or Authentication Password")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "non existing account number" do
|
123
|
+
let(:importer) do
|
124
|
+
Jemquarie::Importer.new('valid_code', 'valid_password')
|
125
|
+
end
|
126
|
+
before(:each) do
|
127
|
+
FakeWeb.register_uri(:post, Jemquarie::Jemquarie::BASE_URI,
|
128
|
+
body: File.read('spec/files/wrong_account_number.xml'),
|
129
|
+
content_type: 'text/xml'
|
130
|
+
)
|
131
|
+
@result = importer.cash_transactions(Date.parse("01/01/2000"), Date.today, 'invalid')
|
132
|
+
end
|
133
|
+
it "should return wrong account number" do
|
134
|
+
expect(@result).to be_kind_of Hash
|
135
|
+
expect(@result[:error]).to eq("Invalid Account Number")
|
102
136
|
end
|
103
137
|
end
|
104
138
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jemquarie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Contin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -118,6 +118,8 @@ files:
|
|
118
118
|
- spec/files/non_authenticated.xml
|
119
119
|
- spec/files/single_transaction.xml
|
120
120
|
- spec/files/transactions.xml
|
121
|
+
- spec/files/wrong_account_number.xml
|
122
|
+
- spec/files/wrong_authentication.xml
|
121
123
|
- spec/lib/importer_spec.rb
|
122
124
|
- spec/lib/jemquarie_spec.rb
|
123
125
|
- spec/spec_helper.rb
|
@@ -150,6 +152,8 @@ test_files:
|
|
150
152
|
- spec/files/non_authenticated.xml
|
151
153
|
- spec/files/single_transaction.xml
|
152
154
|
- spec/files/transactions.xml
|
155
|
+
- spec/files/wrong_account_number.xml
|
156
|
+
- spec/files/wrong_authentication.xml
|
153
157
|
- spec/lib/importer_spec.rb
|
154
158
|
- spec/lib/jemquarie_spec.rb
|
155
159
|
- spec/spec_helper.rb
|