globalpayments / python-sdk

GNU General Public License v2.0
23 stars 17 forks source link

Typo Preventing API use #4

Open sktzofrenic opened 5 years ago

sktzofrenic commented 5 years ago

I tried do a simple card charge transaction from the docs:

response = card.charge(10) \
    .with_currency('USD') \
    .with_address(address) \
    .execute()

Here is the response I received:

danwinsrx.globalpayments.api.entities.exceptions.GatewayException: Unexpected http status code [500]

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <soap:Fault>
            <soap:Code>
                <soap:Value>soap:Sender</soap:Value>
            </soap:Code>
            <soap:Reason>
                <soap:Text xml:lang="en">Unable to process request.  Message failed validation.  The element \'Header\' in namespace \'http://Hps.Exchange.PosGateway\' has invalid child element \'VersionNumber\' in namespace \'http://Hps.Exchange.PosGateway\'. List of possible elements expected: \'UniqueDeviceId, LicenseId, Password, SiteId, DeviceId, GPSCoordinates, ClerkID, CredentialToken, ClientTxnId, DeviceConfiguration, SiteTrace, PosReqDT, VersionNbr, UserName, x_global_transaction_id\' in namespace \'http://Hps.Exchange.PosGateway\'.  (line#1,pos#265)</soap:Text>
            </soap:Reason>
            <soap:Node>http://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx</soap:Node>
            <soap:Detail />
        </soap:Fault>
    </soap:Body>

Here is the issue:

        if self.version_number is not None:
            et.SubElement(header, 'VersionNumber').text = self.version_number  <----------- SHOULD BE 'VersionNbr'
        if client_transaction_id is not None:
            et.SubElement(header, 'ClientTxnId').text = client_transaction_id

https://github.com/globalpayments/python-sdk/blob/15b8fc4c9e8337bb8feb2b93211850e7910eea77/globalpayments/api/gateways/__init__.py#L1086

j3pic commented 4 years ago

Looks like the problem is fixed in the latest version (the code says VersionNbr instead of VersionNumber), but I'm still getting the same HTTP status, except instead of an informative XML body, the response comes with a generic HTML body that contains no details about the error. I'm completely unable to diagnose the problem.

sktzofrenic commented 3 years ago

I forked this repository and have my own working copy of it that I maintain. Unfortunately there really isn't any active development or maintenance being done here and the code base is a bit over engineered which may be contributing to the issue.