Skip to content

Commit

Permalink
modified batch serialization and test to be compatible with python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhill95 committed Jan 10, 2019
1 parent d169f1e commit 3bb26e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/functional/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,13 @@ def test_batch_ctx(self):

except Exception as ex:

if 'Cannot find file' in ex.message:
if 'Cannot find file' in ex.args[0]:
# sleep 1 minute waiting for batch get processed
print("sleep 30 seconds waiting for batch to get processed")
time.sleep(30)
else:
#retry = False
self.fail(ex.message)
self.fail(ex.args[0])

if tried > 20:
self.fail("Timeout for retrieving batch response")
Expand Down
16 changes: 8 additions & 8 deletions vantivsdk/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def CreateFromDocument (xml_text, default_namespace=None, location_base=None):
the document was obtained.
"""
if '<batchRequest' in xml_text:
xml_text = xml_text.replace(b'vendorCredit>', b'vendorCreditCtx>')
xml_text = xml_text.replace(b'vendorDebit>', b'vendorDebitCtx>')
xml_text = xml_text.replace(b'submerchantCredit>', b'submerchantCreditCtx>')
xml_text = xml_text.replace(b'submerchantDebit>', b'submerchantDebitCtx>')
xml_text = xml_text.replace(b'<vendorCredit', b'<vendorCreditCtx')
xml_text = xml_text.replace(b'<vendorDebit', b'<vendorDebitCtx')
xml_text = xml_text.replace(b'<submerchantCredit', b'<submerchantCreditCtx')
xml_text = xml_text.replace(b'<submerchantDebit', b'<submerchantDebitCtx')
xml_text = xml_text.replace('vendorCredit>', 'vendorCreditCtx>')
xml_text = xml_text.replace('vendorDebit>', 'vendorDebitCtx>')
xml_text = xml_text.replace('submerchantCredit>', 'submerchantCreditCtx>')
xml_text = xml_text.replace('submerchantDebit>', 'submerchantDebitCtx>')
xml_text = xml_text.replace('<vendorCredit', '<vendorCreditCtx')
xml_text = xml_text.replace('<vendorDebit', '<vendorDebitCtx')
xml_text = xml_text.replace('<submerchantCredit', '<submerchantCreditCtx')
xml_text = xml_text.replace('<submerchantDebit', '<submerchantDebitCtx')

if pyxb.XMLStyle_saxer != pyxb._XMLStyle:
dom = pyxb.utils.domutils.StringToDOM(xml_text)
Expand Down

0 comments on commit 3bb26e5

Please sign in to comment.