jemquarie 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c289fe5e228aaffc293c9c8ee06b376795c45529
4
- data.tar.gz: 72287bf80cdaac015a1184d3d993d7c7f14e310f
3
+ metadata.gz: 34388f2aec3d3af4a4821cf685cc5fae4b6cd54e
4
+ data.tar.gz: 037df292b05aee50342735b33d205ab5d71119da
5
5
  SHA512:
6
- metadata.gz: 6e194d5f02ac1b03f56957905abb3ef674c91546138e7f3f41a6d1f74dd25eaf3a0ebe1f2f8c1350476266de0e8429bf7cdd68c939f470d80ee72fbc37c3c232
7
- data.tar.gz: 2ff5b231413c378e9232cda5fbb54d39008727e68e83f0d19b297010b746e8f606589e0ccf0e0b5e995a00c35e35a825ca019f71b3a1b2b1a931763cdabe2dc1
6
+ metadata.gz: 5eed3dd6865208966b511fdb72e34f7c97ab35b346a857080bb1210cf166aeac0e1fc6d4a69b96824261a84ec9f81cbcb7e091bbb005b43b5f4926e3dcd9a2fb
7
+ data.tar.gz: d3c8f58db1d1df2d16812f022dbe968b57f83c5e941a161f2e3c7f77cc2e31b0353ba390675899cf9e214615b06eceb267131c62b0458691ad578d5bf84f33e3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jemquarie (0.0.3)
4
+ jemquarie (0.0.4)
5
5
  activesupport (>= 3.0)
6
6
  savon (~> 2.0)
7
7
 
@@ -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 credentials"} unless body[:generate_xml_extract_response] && body[:generate_xml_extract_response][:result] && body[:generate_xml_extract_response][:result].is_a?(String)
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)
@@ -1,3 +1,3 @@
1
1
  module Jemquarie
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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">&lt;?xml version="1.0" ?&gt;
5
+ &lt;XMLExtract&gt;
6
+ &lt;RequestDetails&gt;
7
+ &lt;RequestStatus&gt;Failure&lt;/RequestStatus&gt;
8
+ &lt;RequestErrorNumber&gt;V0001&lt;/RequestErrorNumber&gt;
9
+ &lt;RequestErrorDetails&gt;Invalid Account Number&lt;/RequestErrorDetails&gt;
10
+ &lt;/RequestDetails&gt;
11
+ &lt;XMLEntityDetails&gt;
12
+ &lt;XMLEntityName&gt;your.clients Transactions&lt;/XMLEntityName&gt;
13
+ &lt;XMLEntityVersion&gt;V1.4&lt;/XMLEntityVersion&gt;
14
+ &lt;/XMLEntityDetails&gt;
15
+ &lt;/XMLExtract&gt;
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">&lt;?xml version="1.0" ?&gt;
5
+ &lt;XMLExtract&gt;
6
+ &lt;RequestDetails&gt;
7
+ &lt;RequestStatus&gt;Failure&lt;/RequestStatus&gt;
8
+ &lt;RequestErrorNumber&gt;E0005&lt;/RequestErrorNumber&gt;
9
+ &lt;RequestErrorDetails&gt;Invalid Authentication Code or Authentication Password&lt;/RequestErrorDetails&gt;
10
+ &lt;/RequestDetails&gt;
11
+ &lt;XMLEntityDetails&gt;
12
+ &lt;XMLEntityName&gt;your.clients Transactions&lt;/XMLEntityName&gt;
13
+ &lt;XMLEntityVersion&gt;V1.4&lt;/XMLEntityVersion&gt;
14
+ &lt;/XMLEntityDetails&gt;
15
+ &lt;/XMLExtract&gt;
16
+ </result>
17
+ </ns1:GenerateXMLExtractResponse>
18
+ </soapenv:Body>
19
+ </soapenv:Envelope>
@@ -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 "wrong auth" do
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 credentials")
101
+ expect(@result[:error]).to eq("Invalid Authentication Code or Authentication Password")
85
102
  end
86
103
  end
87
104
 
88
- describe "no data" do
105
+ describe "wrong auth" do
89
106
  let(:importer) do
90
- Jemquarie::Importer.new('valid_code', 'valid_password')
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/no_data.xml'),
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 an empty array" do
100
- expect(@result).to be_kind_of Array
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.3
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-22 00:00:00.000000000 Z
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