Skip to content

Commit 06012eb

Browse files
committed
Merge remote-tracking branch 'upstream/master' into readme
2 parents 9c0c238 + 379edea commit 06012eb

File tree

6 files changed

+5046
-4476
lines changed

6 files changed

+5046
-4476
lines changed

authorizenet/apicontractsv1.py

Lines changed: 5012 additions & 4462 deletions
Large diffs are not rendered by default.

authorizenet/apicontrollers.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,27 @@ def getrequesttype(self):
646646
def getresponseclass(self):
647647
''' Returns the response class '''
648648
return apicontractsv1.getTransactionListResponse()
649+
650+
class getTransactionListForCustomerController(apicontrollersbase.APIOperationBase):
651+
652+
def __init__(self, apirequest):
653+
super(getTransactionListForCustomerController, self).__init__(apirequest)
654+
return
655+
656+
def validaterequest(self):
657+
logging.debug('performing custom validation..')
658+
#validate required fields
659+
#if (self._request.xyz == "null"):
660+
# raise ValueError('xyz is required')
661+
return
649662

663+
def getrequesttype(self):
664+
'''Returns request type'''
665+
return 'getTransactionListForCustomerRequest'
666+
def getresponseclass(self):
667+
''' Returns the response class '''
668+
return apicontractsv1.getTransactionListResponse()
669+
650670
class getUnsettledTransactionListController(apicontrollersbase.APIOperationBase):
651671

652672
def __init__(self, apirequest):

authorizenet/apicontrollersbase.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,20 @@ def execute(self):
147147

148148
except Exception as objectifyexception:
149149
logging.error( 'Create Document Exception: %s, %s', type(objectifyexception), objectifyexception.args )
150-
pyxb.GlobalValidationConfig._setForBinding(False)
151-
self._response = apicontractsv1.CreateFromDocument(self._httpResponse)
152-
#objectify code
153-
xmlResponse= self._response.toxml(encoding=constants.xml_encoding, element_name=self.getrequesttype())
154-
xmlResponse = xmlResponse.replace(constants.nsNamespace1, b'')
155-
xmlResponse = xmlResponse.replace(constants.nsNamespace2, b'')
156-
self._mainObject = objectify.fromstring(xmlResponse)
157-
else:
150+
responseString = self._httpResponse
151+
152+
# removing encoding attribute as objectify fails if it is present
153+
responseString = responseString.replace('encoding=\"utf-8\"', '')
154+
self._mainObject = objectify.fromstring(responseString)
155+
else:
156+
domResponse = xml.dom.minidom.parseString(self._httpResponse)
157+
158158
#if type(self.getresponseclass()) == type(self._response):
159159
if type(self.getresponseclass()) != type(self._mainObject):
160160
if self._response.messages.resultCode == "Error":
161161
logging.debug("Response error")
162-
domResponse = xml.dom.minidom.parseString(self._httpResponse)
163-
logging.debug('Received response: %s' % domResponse.toprettyxml())
162+
domResponse = xml.dom.minidom.parseString(self._httpResponse.encode('utf-8').decode('utf-8'))
163+
logging.debug('Received response: %s' % domResponse.toprettyxml(encoding='utf-8'))
164164
else:
165165
#Need to handle ErrorResponse
166166
logging.debug('Error retrieving response for request: %s' % self._request)

authorizenet/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class constants(object):
1616
PRODUCTION = 'https://api2.authorize.net/xml/v1/request.api'
1717

1818
'''clientId'''
19-
version = '1.0.13'
19+
version = '1.0.14'
2020
clientId = 'sdk-python-' + version
2121

2222
'''xml encoding'''

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Versions should comply with PEP440. For a discussion on single-sourcing
1818
# the version across setup.py and the project code, see
1919
# https://packaging.python.org/en/latest/single_source_version.html
20-
version='1.0.13',
20+
version='1.0.14',
2121

2222
description='Authorize.Net Python SDK',
2323

@@ -62,7 +62,7 @@
6262
# your project is installed. For an analysis of "install_requires" vs pip's
6363
# requirements files see:
6464
# https://packaging.python.org/en/latest/requirements.html
65-
install_requires=['pyxb', 'nose', 'mock', 'lxml'],
65+
install_requires=['pyxb==1.2.5', 'nose', 'mock', 'lxml'],
6666
#install_requires=['nose'],
6767
#install_requires=['nosetests'],
6868
#install_requires=['mock'],

tests/testpyxb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def testGetCustomerProfile(self):
171171

172172
logging.error( 'Create Document Exception: %s, %s', type(ex), ex.args )
173173

174-
self.assertEquals(type(getCustomerProfileRequest), type(deserializedObject), "deseriaziedObject does not match original object")
174+
self.assertEqual(type(getCustomerProfileRequest), type(deserializedObject), "deseriaziedObject does not match original object")
175175

176176
try:
177177
#print("starting with element in mid")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy