@@ -265,6 +265,101 @@ def it_should_query(requests_post):
265
265
raw_response = asdict (mock_response ))
266
266
267
267
268
+ @patch ('requests.post' )
269
+ def it_should_handle_query_response_without_authorization_id (requests_post ):
270
+ mock_response = MockResponse (
271
+ status_code = 200 ,
272
+ url = 'https://test.epayment.nets.eu/Netaxept/Query.aspx' ,
273
+ encoding = 'ISO-8859-1' ,
274
+ reason = 'OK' ,
275
+ text = """<?xml version="1.0" encoding="utf-8"?>
276
+ <PaymentInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
277
+ <MerchantId>11111111</MerchantId>
278
+ <QueryFinished>2019-10-14T10:15:07.2677951+02:00</QueryFinished>
279
+ <TransactionId>1111111111114cf693a1cf86123e0d8f</TransactionId>
280
+ <OrderInformation>
281
+ <Amount>700</Amount>
282
+ <Currency>NOK</Currency>
283
+ <OrderNumber>7</OrderNumber>
284
+ <OrderDescription> </OrderDescription>
285
+ <Fee>0</Fee>
286
+ <RoundingAmount>0</RoundingAmount>
287
+ <Total>700</Total>
288
+ <Timestamp>2019-09-11T16:30:06.967</Timestamp>
289
+ </OrderInformation>
290
+ <TerminalInformation>
291
+ <CustomerEntered>2019-09-11T16:30:08.513</CustomerEntered>
292
+ <CustomerRedirected>2019-09-11T16:30:24.903</CustomerRedirected>
293
+ <Browser>Chrome-Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36</Browser>
294
+ </TerminalInformation>
295
+ <CustomerInformation>
296
+ <Email />
297
+ <IP>85.218.56.162</IP>
298
+ <PhoneNumber />
299
+ <CustomerNumber />
300
+ <FirstName />
301
+ <LastName />
302
+ <Address1 />
303
+ <Address2 />
304
+ <Postcode />
305
+ <Town />
306
+ <Country />
307
+ <SocialSecurityNumber />
308
+ <CompanyName />
309
+ <CompanyRegistrationNumber />
310
+ </CustomerInformation>
311
+ <Summary>
312
+ <AmountCaptured>700</AmountCaptured>
313
+ <AmountCredited>0</AmountCredited>
314
+ <Annulled>false</Annulled>
315
+ <Annuled>false</Annuled>
316
+ <Authorized>true</Authorized>
317
+ </Summary>
318
+ <CardInformation>
319
+ <Issuer>Visa</Issuer>
320
+ <IssuerCountry>NO</IssuerCountry>
321
+ <MaskedPAN>492500******0004</MaskedPAN>
322
+ <PaymentMethod>Visa</PaymentMethod>
323
+ <ExpiryDate>2301</ExpiryDate>
324
+ <IssuerId>3</IssuerId>
325
+ </CardInformation>
326
+ <History>
327
+ <TransactionLogLine>
328
+ <DateTime>2019-09-11T16:30:06.967</DateTime>
329
+ <Operation>Register</Operation>
330
+ </TransactionLogLine>
331
+ <TransactionLogLine>
332
+ <DateTime>2019-09-11T16:30:24.81</DateTime>
333
+ <Description>127.0.0.1: Auto AUTH</Description>
334
+ <Operation>Auth</Operation>
335
+ <BatchNumber>672</BatchNumber>
336
+ </TransactionLogLine>
337
+ </History>
338
+ <ErrorLog>
339
+ <PaymentError>
340
+ <DateTime>2019-11-03T09:34:40.18</DateTime>
341
+ <Operation>Auth</Operation>
342
+ <ResponseCode>99</ResponseCode>
343
+ <ResponseSource>Netaxept</ResponseSource>
344
+ <ResponseText>Auth Reg Comp Failure) </ResponseText>
345
+ </PaymentError>
346
+ </ErrorLog>
347
+ <AuthenticationInformation />
348
+ <AvtaleGiroInformation />
349
+ <SecurityInformation>
350
+ <CustomerIPCountry>CH</CustomerIPCountry>
351
+ <IPCountryMatchesIssuingCountry>false</IPCountryMatchesIssuingCountry>
352
+ </SecurityInformation>
353
+ </PaymentInfo>""" )
354
+ requests_post .return_value = mock_response
355
+ query_response = query (config = _netaxept_config , transaction_id = '233abb21f18b47dc98469fb9000b1f21' )
356
+ assert query_response == QueryResponse (
357
+ annulled = False ,
358
+ authorized = True ,
359
+ authorization_id = None ,
360
+ raw_response = asdict (mock_response ))
361
+
362
+
268
363
##############################################################################
269
364
# SPI tests
270
365
0 commit comments