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