Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Member
Posts: 1
Registered: ‎09-06-2020

Error with start date when ARBCreateSubscriptionController

Section of code for start Date:

# Setting payment schedule
    paymentschedule = apicontractsv1.paymentScheduleType()
    paymentschedule.interval = apicontractsv1.paymentScheduleTypeInterval()
    paymentschedule.interval.length = 1
    paymentschedule.interval.unit = 'months'
    today = datetime.today()
    if today.month == 12:
        month = 2
        year = today.year + 1
    elif today.month == 11:
        month = 1
        year = today.year + 1
    else:
        month = today.month + 2
        year = today.year
    paymentschedule.startDate = datetime(year, month, 1).isoformat().split('T')[0]
    paymentschedule.totalOccurrences = 12
    paymentschedule.trialOccurrences = 0

Even though startdate is auto saved as "YYYY-MM-DD"

Date when being processed in : apicontrollersbase.py is: 2020-11-01 00:00:00

Resulting in error:

2020-11-01 00:00:00
(2020, 11, 1, 12, 0, 0, 0, None)
127.0.0.1 - - [06/Sep/2020 22:35:37] "POST /api/MyRoute HTTP/1.0" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/authorizenet/apicontrollersbase.py", line 133, in execute
    xmlRequest = self.buildrequest()
  File "/usr/local/lib/python3.8/site-packages/authorizenet/apicontrollersbase.py", line 104, in buildrequest
    xmlRequest = self._request.toxml(encoding=constants.xml_encoding, element_name=self.getrequesttype())
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/basis.py", line 555, in toxml
    dom = self.toDOM(bds, element_name=element_name)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/basis.py", line 527, in toDOM
    self._toDOM_csc(bds, element)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/basis.py", line 2675, in _toDOM_csc
    content.elementDeclaration.toDOM(dom_support, parent, content.value)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/content.py", line 1101, in toDOM
    value._toDOM_csc(dom_support, element)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/basis.py", line 1119, in _toDOM_csc
    dom_support.appendTextChild(self, parent)
  File "/usr/local/lib/python3.8/site-packages/pyxb/utils/domutils.py", line 586, in appendTextChild
    return parent.appendChild(self.document().createTextNode(self.valueAsText(text)))
  File "/usr/local/lib/python3.8/site-packages/pyxb/utils/domutils.py", line 402, in valueAsText
    return value.xsdLiteral()
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/basis.py", line 992, in xsdLiteral
    return self.XsdLiteral(self)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/datatypes.py", line 739, in XsdLiteral
    value += datetime.timedelta(minutes=cls.__MinutesPerHalfDay)
  File "/usr/local/lib/python3.8/site-packages/pyxb/binding/datatypes.py", line 663, in __new__
    raise TypeError('function takes %d arguments plus optional tzinfo (%d given)' % (len(cls._ValidFields), len(args)))

Package Versions:

Requirement already up-to-date: authorizenet in /usr/local/lib/python3.8/site-packages (1.1.3)
Requirement already satisfied, skipping upgrade: lxml==4.* in /usr/local/lib64/python3.8/site-packages (from authorizenet) (4.5.1)
Requirement already satisfied, skipping upgrade: pyxb==1.2.5 in /usr/local/lib/python3.8/site-packages (from authorizenet) (1.2.5)
Requirement already satisfied, skipping upgrade: requests==2.* in /usr/local/lib/python3.8/site-packages (from authorizenet) (2.23.0)
Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.8/site-packages (from requests==2.*->authorizenet) (1.25.9)
Requirement already satisfied, skipping upgrade: chardet<4,>=3.0.2 in /usr/lib/python3.8/site-packages (from requests==2.*->authorizenet) (3.0.4)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /usr/local/lib/python3.8/site-packages (from requests==2.*->authorizenet) (2020.4.5.1)
Requirement already satisfied, skipping upgrade: idna<3,>=2.5 in /usr/local/lib/python3.8/site-packages (from requests==2.*->authorizenet) (2.9)

Have other's seen this error, I believe this is recent.

Thank you for the help.