Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARBSubscriptionType issue with Python 3.8 #145

Open
countach74 opened this issue Dec 16, 2019 · 7 comments
Open

ARBSubscriptionType issue with Python 3.8 #145

countach74 opened this issue Dec 16, 2019 · 7 comments

Comments

@countach74
Copy link

countach74 commented Dec 16, 2019

When updating from Python 3.7 => 3.8, I've started to receive the following complaint from Authorize.net / PyXB:

TypeError: function takes 3 arguments plus optional tzinfo (8 given)
  File "authorizenet/apicontrollersbase.py", line 134, in execute
    xmlRequest = self.buildrequest()
  File "authorizenet/apicontrollersbase.py", line 105, in buildrequest
    xmlRequest = self._request.toxml(encoding=constants.xml_encoding, element_name=self.getrequesttype())
  File "pyxb/binding/basis.py", line 555, in toxml
    dom = self.toDOM(bds, element_name=element_name)
  File "pyxb/binding/basis.py", line 527, in toDOM
    self._toDOM_csc(bds, element)
  File "pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "pyxb/binding/basis.py", line 1119, in _toDOM_csc
    dom_support.appendTextChild(self, parent)
  File "pyxb/utils/domutils.py", line 584, in appendTextChild
    return parent.appendChild(self.document().createTextNode(self.valueAsText(text)))
  File "pyxb/utils/domutils.py", line 402, in valueAsText
    return value.xsdLiteral()
  File "pyxb/binding/basis.py", line 992, in xsdLiteral
    return self.XsdLiteral(self)
  File "pyxb/binding/datatypes.py", line 738, in XsdLiteral
    value += datetime.timedelta(minutes=cls.__MinutesPerHalfDay)
  File "pyxb/binding/datatypes.py", line 662, in __new__
    raise TypeError('function takes %d arguments plus optional tzinfo (%d given)' % (len(cls._ValidFields), len(args)))

It seems to be related to the paymentScheduleType.startDate property. I've tried setting it to a pyxb date, a python datetime.date, and a string. None of these work. And if I roll back to Python 3.7, the issue goes away. Any thoughts or suggestions? Is this a mistake on my end?

@AntonDeMeester
Copy link

I've encoutered the same problem. I've created an issue directly on PyXB and also found an temporary solution: pabigot/pyxb#123

@Sharpienero
Copy link

Sharpienero commented Jun 3, 2021

Reproducable in 3.9.

I've tried many things, including @AntonDeMeester's solution but nothing is working. Any help would be greatly appreciated as this is holding up a production release.

@countach74
Copy link
Author

I'm pretty sure I found a solution but for the life of me I actually can't find what it was. Been so long ago now, I can't even remember what project I ran into this on.

@Sharpienero
Copy link

I'm pretty sure I found a solution but for the life of me I actually can't find what it was. Been so long ago now, I can't even remember what project I ran into this on.

The solution above by @AntonDeMeester did end up working with 3.9. Just had to set startDate = customdate(datetime object) and it ended up posting the ARB correctly.

This is a clear issue with pyxb and Authorize.net, but I don't see any real resolution coming for this. Shame, really.

Thanks for everyone's help.

@ghost
Copy link

ghost commented Oct 18, 2023

Facing the same issue with Python 3.10, the custom date is also not working. Any recommendations will be helpful. Thank you.

@Sharpienero
Copy link

@anmolmonga-kiwi Are you sure? I use this solution on 3.10.

@dhanashreeyadav1
Copy link

TCS-Dev Dhanashree- If I try to execute the file, I am not able to reproduce the error because we have replaced the offending serialization library with a newer one, which will hopefully not cause more issues like this.

This issue has been fixed in v1.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants