Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# This file is part of Koha. |
4 |
# |
5 |
# Koha is free software; you can redistribute it and/or modify it |
6 |
# under the terms of the GNU General Public License as published by |
7 |
# the Free Software Foundation; either version 3 of the License, or |
8 |
# (at your option) any later version. |
9 |
# |
10 |
# Koha is distributed in the hope that it will be useful, but |
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
# GNU General Public License for more details. |
14 |
# |
15 |
# You should have received a copy of the GNU General Public License |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
18 |
use Modern::Perl; |
19 |
use Test::More; |
20 |
use Test::MockModule; |
21 |
use t::lib::Mocks; |
22 |
use Data::Dumper; |
23 |
|
24 |
# Check that all the modules we need are installed, or bail out |
25 |
BEGIN { |
26 |
eval { |
27 |
require Test::DBIx::Class; |
28 |
1; |
29 |
} or do { |
30 |
plan skip_all => "Test::DBIx::Class is not available"; |
31 |
}; |
32 |
} |
33 |
BEGIN { |
34 |
eval { |
35 |
require SOAP::Lite; |
36 |
1; |
37 |
} or do { |
38 |
plan skip_all => "SOAP::Lite is not available"; |
39 |
}; |
40 |
} |
41 |
BEGIN { |
42 |
eval { |
43 |
require Crypt::GCrypt; |
44 |
1; |
45 |
} or do { |
46 |
plan skip_all => "Crypt::GCrypt is not available"; |
47 |
}; |
48 |
} |
49 |
BEGIN { |
50 |
eval { |
51 |
require Convert::BaseN; |
52 |
1; |
53 |
} or do { |
54 |
plan skip_all => "Convert::BaseN is not available"; |
55 |
}; |
56 |
} |
57 |
|
58 |
use Test::DBIx::Class { |
59 |
schema_class => 'Koha::Schema', |
60 |
connect_info => ['dbi:SQLite:dbname=:memory:','',''], |
61 |
connect_opts => { name_sep => '.', quote_char => '`', }, |
62 |
fixture_class => '::Populate', |
63 |
}, 'Borrower', 'BorrowerSync'; |
64 |
|
65 |
# Make the code in the module use our mocked Koha::Schema/Koha::Database |
66 |
my $db = Test::MockModule->new('Koha::Database'); |
67 |
$db->mock( |
68 |
# Schema() gives us the DB connection set up by Test::DBIx::Class |
69 |
_new_schema => sub { return Schema(); } |
70 |
); |
71 |
|
72 |
fixtures_ok [ |
73 |
'Borrower' => [ |
74 |
[qw/firstname surname borrowernumber address city/], |
75 |
['Test', 'Borrower', 1, 'Test road', 'Test city'], |
76 |
['Test', 'Borrower', 2, 'Test road', 'Test city'], |
77 |
['Test', 'Borrower', 3, 'Test road', 'Test city'], |
78 |
['Test', 'Borrower', 4, 'Test road', 'Test city'], |
79 |
], |
80 |
'BorrowerSync' => [ |
81 |
[qw/borrowernumber sync syncstatus lastsync hashed_pin synctype/], |
82 |
[1, 1, 'new', '2014-03-31T12:35:14', 'abc', 'norwegianpatrondb' ], |
83 |
[2, 1, 'edited', '2014-03-31T12:35:14', 'abc', 'norwegianpatrondb' ], |
84 |
[3, 1, 'new', '2014-03-31T12:35:14', 'abc', 'norwegianpatrondb' ], |
85 |
[4, 1, 'new', '2014-03-31T12:35:14', 'abc', 'norwegianpatrondb' ], |
86 |
], |
87 |
], 'installed some fixtures'; |
88 |
|
89 |
=head1 LOADING THE MODULE |
90 |
|
91 |
=cut |
92 |
|
93 |
BEGIN { use_ok( 'Koha::NorwegianPatronDB', ':all' ) } |
94 |
|
95 |
|
96 |
=head1 UTILITY SUBROUTINES |
97 |
|
98 |
=head2 NLCheckSysprefs |
99 |
|
100 |
Relevant sysprefs: |
101 |
|
102 |
=over 4 |
103 |
|
104 |
=item * NorwegianPatronDBEnable |
105 |
|
106 |
=item * NorwegianPatronDBEndpoint |
107 |
|
108 |
=item * NorwegianPatronDBUsername |
109 |
|
110 |
=item * NorwegianPatronDBPassword |
111 |
|
112 |
=back |
113 |
|
114 |
=cut |
115 |
|
116 |
t::lib::Mocks::mock_preference('NorwegianPatronDBEnable', 0); |
117 |
t::lib::Mocks::mock_preference('NorwegianPatronDBEndpoint', ''); |
118 |
t::lib::Mocks::mock_preference('NorwegianPatronDBUsername', ''); |
119 |
t::lib::Mocks::mock_preference('NorwegianPatronDBPassword', ''); |
120 |
ok( my $result = NLCheckSysprefs(), 'call NLCheckSysprefs() ok' ); |
121 |
is( $result->{ 'error' }, 1, 'error detected' ); |
122 |
is( $result->{ 'nlenabled' }, 0, 'NL is not enabled' ); |
123 |
is( $result->{ 'endpoint' }, 0, 'an endpoint is not specified' ); |
124 |
is( $result->{ 'userpass' }, 0, 'username and/or password is missing' ); |
125 |
|
126 |
t::lib::Mocks::mock_preference('NorwegianPatronDBEnable', 1); |
127 |
ok( $result = NLCheckSysprefs(), 'call NLCheckSysprefs() ok' ); |
128 |
is( $result->{ 'error' }, 1, 'error detected' ); |
129 |
is( $result->{ 'nlenabled' }, 1, 'NL is enabled' ); |
130 |
is( $result->{ 'endpoint' }, 0, 'an endpoint is not specified' ); |
131 |
is( $result->{ 'userpass' }, 0, 'username and/or password is missing' ); |
132 |
|
133 |
t::lib::Mocks::mock_preference('NorwegianPatronDBEnable', 0); |
134 |
t::lib::Mocks::mock_preference('NorwegianPatronDBUsername', 'user'); |
135 |
t::lib::Mocks::mock_preference('NorwegianPatronDBPassword', 'pass'); |
136 |
ok( $result = NLCheckSysprefs(), 'call NLCheckSysprefs() ok' ); |
137 |
is( $result->{ 'error' }, 1, 'error detected' ); |
138 |
is( $result->{ 'nlenabled' }, 0, 'NL is not enabled' ); |
139 |
is( $result->{ 'endpoint' }, 0, 'an endpoint is not specified' ); |
140 |
is( $result->{ 'userpass' }, 1, 'username and/or password is present' ); |
141 |
|
142 |
t::lib::Mocks::mock_preference('NorwegianPatronDBEnable', 1); |
143 |
t::lib::Mocks::mock_preference('NorwegianPatronDBEndpoint', 'http://example.com/'); |
144 |
ok( $result = NLCheckSysprefs(), 'call NLCheckSysprefs() ok' ); |
145 |
is( $result->{ 'error' }, 0, 'no error detected' ); |
146 |
is( $result->{ 'nlenabled' }, 1, 'NL is enabled' ); |
147 |
is( $result->{ 'endpoint' }, 1, 'an endpoint is specified' ); |
148 |
is( $result->{ 'userpass' }, 1, 'username and/or password is present' ); |
149 |
|
150 |
=head2 NLGetFirstname and NLGetSurname |
151 |
|
152 |
=cut |
153 |
|
154 |
my $firstname = 'Firstname'; |
155 |
my $surname = 'Surname'; |
156 |
my $fullname = "$surname, $firstname"; |
157 |
my $wrongname = "$surname $firstname"; |
158 |
|
159 |
is( NLGetFirstname( $fullname ), $firstname, 'can get firstname from name' ); |
160 |
is( NLGetSurname( $fullname ), $surname, 'can get surname from name' ); |
161 |
is( NLGetFirstname( $wrongname ), $wrongname, 'returns full string when name misses comma' ); |
162 |
is( NLGetSurname( $wrongname ), $wrongname, 'returns full string when name misses comma' ); |
163 |
|
164 |
=head2 NLDecodePin and NLEncryptPIN |
165 |
|
166 |
=cut |
167 |
|
168 |
my $pin = '1234'; |
169 |
my $hash = NLEncryptPIN( $pin ); |
170 |
|
171 |
is( NLEncryptPIN( $pin ), $hash, 'NLEncryptPIN works' ); |
172 |
is( NLDecodePin( $hash ), $pin, 'NLDecodePin works' ); |
173 |
|
174 |
=head2 NLUpdateHashedPIN |
175 |
|
176 |
=cut |
177 |
|
178 |
is ( BorrowerSync->find({ 'borrowernumber' => 1 })->get_column('hashed_pin'), 'abc', 'hashed_pin is "abc"' ); |
179 |
# Set a new pin |
180 |
my $new_pin = 'bcd'; |
181 |
ok( NLUpdateHashedPIN( 1, $new_pin ), 'NLUpdateHashedPIN runs ok' ); |
182 |
# Hash the new pin and compare it to the one stored in the database |
183 |
my $hashed_pin = Koha::NorwegianPatronDB::_encrypt_pin( $new_pin ); |
184 |
is ( BorrowerSync->find({ 'borrowernumber' => 1 })->get_column('hashed_pin'), $hashed_pin, 'hashed_pin was updated' ); |
185 |
|
186 |
=head2 NLMarkForDeletion |
187 |
|
188 |
=cut |
189 |
|
190 |
is ( BorrowerSync->find({ 'borrowernumber' => 3 })->get_column('syncstatus'), 'new', 'syncstatus is "new"' ); |
191 |
ok( NLMarkForDeletion( 3 ), 'NLMarkForDeletion runs ok' ); |
192 |
# Check that the syncstatus was updated. Note: We will use this status later, to check syncing of deleted borrowers |
193 |
is ( BorrowerSync->find({ 'borrowernumber' => 3 })->get_column('syncstatus'), 'delete', 'syncstatus is "delete"' ); |
194 |
|
195 |
=head2 NLGetSyncDataFromBorrowernumber |
196 |
|
197 |
=cut |
198 |
|
199 |
ok( my $sync_data = NLGetSyncDataFromBorrowernumber( 1 ), 'NLGetSyncDataFromBorrowernumber runs ok' ); |
200 |
isa_ok( $sync_data, 'Koha::Schema::Result::BorrowerSync' ); |
201 |
is( $sync_data->sync, 1, 'the sync is on' ); |
202 |
is( $sync_data->syncstatus, 'new', 'syncstatus is "new"' ); |
203 |
is( $sync_data->lastsync, '2014-03-31T12:35:14', 'lastsync is ok' ); |
204 |
is( $sync_data->hashed_pin, $hashed_pin, 'hashed_pin is ok' ); |
205 |
|
206 |
=head1 SUBROUTINES THAT TALK TO SOAP |
207 |
|
208 |
=head2 NLSearch |
209 |
|
210 |
=cut |
211 |
|
212 |
my $lite = Test::MockModule->new('SOAP::Lite'); |
213 |
|
214 |
# Mock a successfull call to the "hent" method |
215 |
$lite->mock( |
216 |
hent => sub { return SOAP::Deserializer->deserialize( hent_success() )->result; } |
217 |
); |
218 |
ok( my $res = NLSearch( '12345678910' ), 'successfull call to NLSearch' ); |
219 |
is( $res->{'antall_poster_returnert'}, 1, 'got 1 record' ); |
220 |
isa_ok( $res, "Resultat" ); |
221 |
isa_ok( $res->{'respons_poster'}, "LaanerListe" ); |
222 |
isa_ok( $res->{'respons_poster'}[0], "Laaner" ); |
223 |
|
224 |
# Mock an unsuccessfull call to the "hent" method |
225 |
$lite->mock( |
226 |
hent => sub { return SOAP::Deserializer->deserialize( hent_failure() )->result; } |
227 |
); |
228 |
ok( $res = NLSearch( '12345678910' ), 'call to NLSearch with an illegal argument' ); |
229 |
is( $res->{'antall_poster_returnert'}, 0, 'got 0 records' ); |
230 |
isa_ok( $res, "Resultat" ); |
231 |
like( $res->{'melding'}, qr/Ulovlig argument: hverken LNR eller FNR_HASH/, "got expected error message for an illegal identifier" ); |
232 |
|
233 |
=head2 NLSync |
234 |
|
235 |
=head3 New patron |
236 |
|
237 |
=cut |
238 |
|
239 |
my $borrower = Borrower->find({ 'borrowernumber' => 1 }); |
240 |
$lite->mock( |
241 |
nyPost => sub { return SOAP::Deserializer->deserialize( nyPost_success() )->result; } |
242 |
); |
243 |
is ( BorrowerSync->find({ 'borrowernumber' => 1 })->get_column('syncstatus'), 'new', 'patron is new' ); |
244 |
ok ( $result = NLSync({ 'patron' => $borrower }), 'successfull call to NLSync via patron ("nyPost")' ); |
245 |
is ( BorrowerSync->find({ 'borrowernumber' => 1 })->get_column('syncstatus'), 'synced', 'patron is synced' ); |
246 |
|
247 |
# Now do the same test, but pass in a borrowernumber, not a Koha::Schema::Result::Borrower |
248 |
is ( BorrowerSync->find({ 'borrowernumber' => 4 })->get_column('syncstatus'), 'new', 'patron is new' ); |
249 |
ok ( $result = NLSync({ 'borrowernumber' => 4 }), 'successfull call to NLSync via borrowernumber ("nyPost")' ); |
250 |
is ( BorrowerSync->find({ 'borrowernumber' => 4 })->get_column('syncstatus'), 'synced', 'patron is synced' ); |
251 |
|
252 |
=head3 Edited patron |
253 |
|
254 |
=cut |
255 |
|
256 |
ok ( $borrower = Borrower->find({ 'borrowernumber' => 2 }), 'find our "edited" mock patron' ); |
257 |
$lite->mock( |
258 |
endre => sub { return SOAP::Deserializer->deserialize( endre_success() )->result; } |
259 |
); |
260 |
is ( BorrowerSync->find({ 'borrowernumber' => 2 })->get_column('syncstatus'), 'edited', 'patron is edited' ); |
261 |
ok ( $result = NLSync({ 'patron' => $borrower }), 'successfull call to NLSync ("endre")' ); |
262 |
is ( BorrowerSync->find({ 'borrowernumber' => 2 })->get_column('syncstatus'), 'synced', 'patron is synced' ); |
263 |
|
264 |
=head3 Deleted patron |
265 |
|
266 |
=cut |
267 |
|
268 |
ok ( $borrower = Borrower->find({ 'borrowernumber' => 3 }), 'find our "deleted" mock patron' ); |
269 |
$lite->mock( |
270 |
slett => sub { return SOAP::Deserializer->deserialize( endre_success() )->result; } |
271 |
); |
272 |
is ( BorrowerSync->find({ 'borrowernumber' => 3 })->get_column('syncstatus'), 'delete', 'patron is marked for deletion' ); |
273 |
ok ( $result = NLSync({ 'patron' => $borrower }), 'successfull call to NLSync ("slett")' ); |
274 |
is ( BorrowerSync->find({ 'borrowernumber' => 3 })->get_column('sync'), 0, 'sync is now disabled' ); |
275 |
|
276 |
=head2 NLGetChanged |
277 |
|
278 |
=cut |
279 |
|
280 |
# Mock a successfull call to the "soekEndret" method |
281 |
$lite->mock( |
282 |
soekEndret => sub { return SOAP::Deserializer->deserialize( soekEndret_success() ); } |
283 |
); |
284 |
ok( $res = NLGetChanged(), 'successfull call to NLGetChanged - 2 results' ); |
285 |
is( $res->{'melding'}, 'OK', 'got "OK"' ); |
286 |
is( $res->{'antall_poster_returnert'}, 2, 'got 2 records' ); |
287 |
isa_ok( $res, "Resultat" ); |
288 |
isa_ok( $res->{'respons_poster'}, "LaanerListe" ); |
289 |
isa_ok( $res->{'respons_poster'}[0], "Laaner" ); |
290 |
|
291 |
|
292 |
# Mock a successfull call to the "soekEndret" method, but with zero new records |
293 |
$lite->mock( |
294 |
soekEndret => sub { return SOAP::Deserializer->deserialize( soekEndret_zero_new() ); } |
295 |
); |
296 |
ok( $res = NLGetChanged(), 'successfull call to NLGetChanged - 0 results' ); |
297 |
is( $res->{'melding'}, 'ingen treff', 'got "ingen treff"' ); |
298 |
is( $res->{'antall_poster_returnert'}, 0, 'got 0 records' ); |
299 |
is( $res->{'antall_treff'}, 0, 'got 0 records' ); |
300 |
|
301 |
done_testing(); |
302 |
|
303 |
=head1 SAMPLE SOAP XML RESPONSES |
304 |
|
305 |
These responses can be gathered by setting "outputxml()" to true on the SOAP |
306 |
client: |
307 |
|
308 |
my $client = SOAP::Lite |
309 |
->on_action( sub { return '""';}) |
310 |
->uri('http://lanekortet.no') |
311 |
->proxy('https://fl.lanekortet.no/laanekort/fl_test.php') |
312 |
->outputxml(1); |
313 |
my $response = $client->slett( $x ); |
314 |
say $response; |
315 |
|
316 |
Pretty formatting can be achieved by piping the output from a test script |
317 |
through xmllint: |
318 |
|
319 |
perl my_test_script.pl > xmllint --format - |
320 |
|
321 |
=cut |
322 |
|
323 |
sub slett_success { |
324 |
|
325 |
return <<'ENDRESPONSE'; |
326 |
<?xml version="1.0" encoding="UTF-8"?> |
327 |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://lanekortet.no" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> |
328 |
<SOAP-ENV:Body> |
329 |
<ns1:slettResponse> |
330 |
<return xsi:type="ns1:Svar"> |
331 |
<status xsi:type="xsd:boolean">true</status> |
332 |
<melding xsi:type="xsd:string">Test Testersen (1973-08-11) er slettet fra registeret</melding> |
333 |
<lnr xsi:type="xsd:string">N000106188</lnr> |
334 |
<server_tid xsi:type="xsd:string">2014-06-02T16:51:58</server_tid> |
335 |
</return> |
336 |
</ns1:slettResponse> |
337 |
</SOAP-ENV:Body> |
338 |
</SOAP-ENV:Envelope> |
339 |
ENDRESPONSE |
340 |
|
341 |
} |
342 |
|
343 |
sub endre_success { |
344 |
|
345 |
return <<'ENDRESPONSE'; |
346 |
<?xml version="1.0" encoding="UTF-8"?> |
347 |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://lanekortet.no" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> |
348 |
<SOAP-ENV:Body> |
349 |
<ns1:endreResponse> |
350 |
<return xsi:type="ns1:Svar"> |
351 |
<status xsi:type="xsd:boolean">true</status> |
352 |
<melding xsi:type="xsd:string">Oppdaterte felt: navn, p_adresse1, p_postnr, p_sted, p_land, fdato, fnr_hash, kjonn, pin, sist_endret, sist_endret_av</melding> |
353 |
<lnr xsi:type="xsd:string">N000106188</lnr> |
354 |
<server_tid xsi:type="xsd:string">2014-06-02T16:42:32</server_tid> |
355 |
</return> |
356 |
</ns1:endreResponse> |
357 |
</SOAP-ENV:Body> |
358 |
</SOAP-ENV:Envelope> |
359 |
ENDRESPONSE |
360 |
|
361 |
} |
362 |
|
363 |
sub nyPost_success { |
364 |
|
365 |
return <<'ENDRESPONSE'; |
366 |
<?xml version="1.0" encoding="UTF-8"?> |
367 |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://lanekortet.no" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> |
368 |
<SOAP-ENV:Body> |
369 |
<ns1:nyPostResponse> |
370 |
<return xsi:type="ns1:Svar"> |
371 |
<status xsi:type="xsd:boolean">true</status> |
372 |
<melding xsi:type="xsd:string">Ny post er opprettet</melding> |
373 |
<lnr xsi:type="xsd:string">N000106188</lnr> |
374 |
<server_tid xsi:type="xsd:string">2014-06-02T14:10:09</server_tid> |
375 |
</return> |
376 |
</ns1:nyPostResponse> |
377 |
</SOAP-ENV:Body> |
378 |
</SOAP-ENV:Envelope> |
379 |
ENDRESPONSE |
380 |
|
381 |
} |
382 |
|
383 |
sub soekEndret_success { |
384 |
|
385 |
return <<'ENDRESPONSE'; |
386 |
<?xml version="1.0" encoding="UTF-8"?> |
387 |
<SOAP-ENV:Envelope |
388 |
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" |
389 |
xmlns:ns1="http://lanekortet.no" |
390 |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
391 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
392 |
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" |
393 |
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> |
394 |
<SOAP-ENV:Body> |
395 |
<ns1:soekEndretResponse> |
396 |
<return xsi:type="ns1:Resultat"> |
397 |
<status xsi:type="xsd:boolean">true</status> |
398 |
<melding xsi:type="xsd:string">OK</melding> |
399 |
<antall_treff xsi:type="xsd:int">2</antall_treff> |
400 |
<antall_poster_returnert xsi:type="xsd:int">2</antall_poster_returnert> |
401 |
<neste_indeks xsi:type="xsd:int">0</neste_indeks> |
402 |
<respons_poster SOAP-ENC:arrayType="ns1:Laaner[2]" xsi:type="ns1:LaanerListe"> |
403 |
<item xsi:type="ns1:Laaner"> |
404 |
<lnr xsi:type="xsd:string">N000106186</lnr> |
405 |
<navn xsi:type="xsd:string">Hansen, Hanne</navn> |
406 |
<p_adresse1 xsi:type="xsd:string"/> |
407 |
<p_adresse2 xsi:type="xsd:string"/> |
408 |
<p_postnr xsi:type="xsd:string"/> |
409 |
<p_sted xsi:type="xsd:string">BØDØ</p_sted> |
410 |
<p_land xsi:type="xsd:string">no</p_land> |
411 |
<p_sjekk xsi:type="xsd:string">0</p_sjekk> |
412 |
<m_adresse1 xsi:type="xsd:string"/> |
413 |
<m_adresse2 xsi:type="xsd:string"/> |
414 |
<m_postnr xsi:type="xsd:string"/> |
415 |
<m_sted xsi:type="xsd:string"/> |
416 |
<m_land xsi:type="xsd:string"/> |
417 |
<m_sjekk xsi:type="xsd:string">0</m_sjekk> |
418 |
<m_gyldig_til xsi:type="xsd:string">0000-00-00</m_gyldig_til> |
419 |
<tlf_hjemme xsi:type="xsd:string"/> |
420 |
<tlf_jobb xsi:type="xsd:string"/> |
421 |
<tlf_mobil xsi:type="xsd:string"/> |
422 |
<epost xsi:type="xsd:string"/> |
423 |
<epost_sjekk xsi:type="xsd:string"/> |
424 |
<prim_kontakt xsi:type="xsd:string"/> |
425 |
<hjemmebibliotek xsi:type="xsd:string">5180401</hjemmebibliotek> |
426 |
<fdato xsi:type="xsd:string">1994-04-08</fdato> |
427 |
<fnr_hash xsi:type="xsd:string">11087395628</fnr_hash> |
428 |
<kjonn xsi:type="xsd:string">F</kjonn> |
429 |
<pin xsi:type="xsd:string">89308dfc85ee7a5826ae14e2d8efad1e</pin> |
430 |
<passord xsi:type="xsd:string"/> |
431 |
<feide xsi:type="xsd:string">0</feide> |
432 |
<opprettet xsi:type="xsd:string">2014-04-28T15:20:38</opprettet> |
433 |
<opprettet_av xsi:type="xsd:string">5180401</opprettet_av> |
434 |
<sist_endret xsi:type="xsd:string">2014-04-28T15:20:38</sist_endret> |
435 |
<sist_endret_av xsi:type="xsd:string">5180401</sist_endret_av> |
436 |
<folkeregsjekk_dato xsi:type="xsd:string">0000-00-00</folkeregsjekk_dato> |
437 |
</item> |
438 |
<item xsi:type="ns1:Laaner"> |
439 |
<lnr xsi:type="xsd:string">N000106184</lnr> |
440 |
<navn xsi:type="xsd:string">Enger, Magnus</navn> |
441 |
<p_adresse1 xsi:type="xsd:string">Svarthammarveien 633333</p_adresse1> |
442 |
<p_adresse2 xsi:type="xsd:string"/> |
443 |
<p_postnr xsi:type="xsd:string">8015</p_postnr> |
444 |
<p_sted xsi:type="xsd:string">Bodø</p_sted> |
445 |
<p_land xsi:type="xsd:string">no</p_land> |
446 |
<p_sjekk xsi:type="xsd:string">0</p_sjekk> |
447 |
<m_adresse1 xsi:type="xsd:string"/> |
448 |
<m_adresse2 xsi:type="xsd:string"/> |
449 |
<m_postnr xsi:type="xsd:string"/> |
450 |
<m_sted xsi:type="xsd:string"/> |
451 |
<m_land xsi:type="xsd:string">no</m_land> |
452 |
<m_sjekk xsi:type="xsd:string">0</m_sjekk> |
453 |
<m_gyldig_til xsi:type="xsd:string">0000-00-00</m_gyldig_til> |
454 |
<tlf_hjemme xsi:type="xsd:string">95158548</tlf_hjemme> |
455 |
<tlf_jobb xsi:type="xsd:string"/> |
456 |
<tlf_mobil xsi:type="xsd:string"/> |
457 |
<epost xsi:type="xsd:string">magnus@enger.priv.no</epost> |
458 |
<epost_sjekk xsi:type="xsd:string"/> |
459 |
<prim_kontakt xsi:type="xsd:string"/> |
460 |
<hjemmebibliotek xsi:type="xsd:string">5180401</hjemmebibliotek> |
461 |
<fdato xsi:type="xsd:string">1973-08-11</fdato> |
462 |
<fnr_hash xsi:type="xsd:string">11087345795</fnr_hash> |
463 |
<kjonn xsi:type="xsd:string">M</kjonn> |
464 |
<pin xsi:type="xsd:string">a632c504b8c4fba3149115cb07e0796c</pin> |
465 |
<passord xsi:type="xsd:string"/> |
466 |
<feide xsi:type="xsd:string">0</feide> |
467 |
<opprettet xsi:type="xsd:string">2014-04-28T14:52:02</opprettet> |
468 |
<opprettet_av xsi:type="xsd:string">5180401</opprettet_av> |
469 |
<sist_endret xsi:type="xsd:string">2014-05-13T11:01:33</sist_endret> |
470 |
<sist_endret_av xsi:type="xsd:string">5180401</sist_endret_av> |
471 |
<folkeregsjekk_dato xsi:type="xsd:string">0000-00-00</folkeregsjekk_dato> |
472 |
</item> |
473 |
</respons_poster> |
474 |
<server_tid xsi:type="xsd:string">2014-05-16T14:44:44</server_tid> |
475 |
</return> |
476 |
</ns1:soekEndretResponse> |
477 |
</SOAP-ENV:Body> |
478 |
</SOAP-ENV:Envelope> |
479 |
ENDRESPONSE |
480 |
} |
481 |
|
482 |
sub soekEndret_zero_new { |
483 |
return <<'ENDRESPONSE'; |
484 |
<?xml version="1.0" encoding="UTF-8"?> |
485 |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://lanekortet.no" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> |
486 |
<SOAP-ENV:Body> |
487 |
<ns1:soekEndretResponse> |
488 |
<return xsi:type="ns1:Resultat"> |
489 |
<status xsi:type="xsd:boolean">false</status> |
490 |
<melding xsi:type="xsd:string">ingen treff</melding> |
491 |
<antall_treff xsi:type="xsd:int">0</antall_treff> |
492 |
<antall_poster_returnert xsi:type="xsd:int">0</antall_poster_returnert> |
493 |
<neste_indeks xsi:type="xsd:int">0</neste_indeks> |
494 |
<respons_poster SOAP-ENC:arrayType="ns1:Laaner[0]" xsi:type="ns1:LaanerListe"/> |
495 |
<server_tid xsi:type="xsd:string">2014-05-20T13:02:02</server_tid> |
496 |
</return> |
497 |
</ns1:soekEndretResponse> |
498 |
</SOAP-ENV:Body> |
499 |
</SOAP-ENV:Envelope> |
500 |
ENDRESPONSE |
501 |
} |
502 |
|
503 |
sub hent_failure { |
504 |
return <<'ENDRESPONSE'; |
505 |
<?xml version="1.0" encoding="UTF-8"?> |
506 |
<SOAP-ENV:Envelope |
507 |
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" |
508 |
xmlns:ns1="http://lanekortet.no" |
509 |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
510 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
511 |
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" |
512 |
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> |
513 |
<SOAP-ENV:Body> |
514 |
<ns1:hentResponse> |
515 |
<return xsi:type="ns1:Resultat"> |
516 |
<status xsi:type="xsd:boolean">false</status> |
517 |
<melding xsi:type="xsd:string">hent: Ulovlig argument: hverken LNR eller FNR_HASH</melding> |
518 |
<antall_treff xsi:type="xsd:int">0</antall_treff> |
519 |
<antall_poster_returnert xsi:type="xsd:int">0</antall_poster_returnert> |
520 |
<neste_indeks xsi:type="xsd:int">0</neste_indeks> |
521 |
<respons_poster SOAP-ENC:arrayType="ns1:Laaner[0]" xsi:type="ns1:LaanerListe"/> |
522 |
<server_tid xsi:type="xsd:string">2014-05-15T10:56:24</server_tid> |
523 |
</return> |
524 |
</ns1:hentResponse> |
525 |
</SOAP-ENV:Body> |
526 |
</SOAP-ENV:Envelope> |
527 |
ENDRESPONSE |
528 |
|
529 |
} |
530 |
|
531 |
sub hent_success { |
532 |
|
533 |
return <<'ENDRESPONSE'; |
534 |
<?xml version="1.0" encoding="UTF-8"?> |
535 |
<SOAP-ENV:Envelope |
536 |
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" |
537 |
xmlns:ns1="http://lanekortet.no" |
538 |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
539 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
540 |
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" |
541 |
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> |
542 |
<SOAP-ENV:Body> |
543 |
<ns1:hentResponse> |
544 |
<return xsi:type="ns1:Resultat"> |
545 |
<status xsi:type="xsd:boolean">true</status> |
546 |
<melding xsi:type="xsd:string">OK</melding> |
547 |
<antall_treff xsi:type="xsd:int">1</antall_treff> |
548 |
<antall_poster_returnert xsi:type="xsd:int">1</antall_poster_returnert> |
549 |
<neste_indeks xsi:type="xsd:int">0</neste_indeks> |
550 |
<respons_poster SOAP-ENC:arrayType="ns1:Laaner[1]" xsi:type="ns1:LaanerListe"> |
551 |
<item xsi:type="ns1:Laaner"> |
552 |
<lnr xsi:type="xsd:string">N000123456</lnr> |
553 |
<navn xsi:type="xsd:string">Test, Testersen</navn> |
554 |
<p_adresse1 xsi:type="xsd:string">Bibliotekveien 6</p_adresse1> |
555 |
<p_adresse2 xsi:type="xsd:string"/> |
556 |
<p_postnr xsi:type="xsd:string">1234</p_postnr> |
557 |
<p_sted xsi:type="xsd:string">Lillevik</p_sted> |
558 |
<p_land xsi:type="xsd:string">no</p_land> |
559 |
<p_sjekk xsi:type="xsd:string">0</p_sjekk> |
560 |
<m_adresse1 xsi:type="xsd:string"/> |
561 |
<m_adresse2 xsi:type="xsd:string"/> |
562 |
<m_postnr xsi:type="xsd:string"/> |
563 |
<m_sted xsi:type="xsd:string"/> |
564 |
<m_land xsi:type="xsd:string">no</m_land> |
565 |
<m_sjekk xsi:type="xsd:string">0</m_sjekk> |
566 |
<m_gyldig_til xsi:type="xsd:string">0000-00-00</m_gyldig_til> |
567 |
<tlf_hjemme xsi:type="xsd:string"/> |
568 |
<tlf_jobb xsi:type="xsd:string"/> |
569 |
<tlf_mobil xsi:type="xsd:string">12345678</tlf_mobil> |
570 |
<epost xsi:type="xsd:string">test@example.com</epost> |
571 |
<epost_sjekk xsi:type="xsd:string">0</epost_sjekk> |
572 |
<prim_kontakt xsi:type="xsd:string"/> |
573 |
<hjemmebibliotek xsi:type="xsd:string">2060000</hjemmebibliotek> |
574 |
<fdato xsi:type="xsd:string">1964-05-22</fdato> |
575 |
<fnr_hash xsi:type="xsd:string">22056412345</fnr_hash> |
576 |
<kjonn xsi:type="xsd:string">F</kjonn> |
577 |
<pin xsi:type="xsd:string">g345abc123dab567abc78900abc123ab</pin> |
578 |
<passord xsi:type="xsd:string"/> |
579 |
<feide xsi:type="xsd:string"/> |
580 |
<opprettet xsi:type="xsd:string">2005-10-20</opprettet> |
581 |
<opprettet_av xsi:type="xsd:string">2060000</opprettet_av> |
582 |
<sist_endret xsi:type="xsd:string">2013-05-13T13:51:24</sist_endret> |
583 |
<sist_endret_av xsi:type="xsd:string">2060000</sist_endret_av> |
584 |
<gyldig_til xsi:type="xsd:string"/> |
585 |
<folkeregsjekk_dato xsi:type="xsd:string">0000-00-00</folkeregsjekk_dato> |
586 |
</item> |
587 |
</respons_poster> |
588 |
<server_tid xsi:type="xsd:string">2014-01-07T14:43:18</server_tid> |
589 |
</return> |
590 |
</ns1:hentResponse> |
591 |
</SOAP-ENV:Body> |
592 |
</SOAP-ENV:Envelope> |
593 |
ENDRESPONSE |
594 |
|
595 |
} |