08-16-2023 07:22 AM
Hey faugermire1. I was frustrated with this issue as well. With the age of the package, I decided to just use requests to make the calls. Fundamentally they are using requests.post of an xml object. I am using constants.SANDBOX to get the dev environment url and constants.PRODUCTION to get the production environment url. With the url I'm making a call to requests.post. I'm using a json object instead of xml for readability and so I could test with the Live API call json objects.
Ex:
def get_portal_token(self, amount, profile, line_items):
if Config.get('PAYMENT_PORTAL', 'dev'):
url = constants.SANDBOX
else:
url = constants.PRODUCTION
r = requests.post(url, json={
"getHostedPaymentPageRequest": {
"merchantAuthentication": self.get_merchant_auth(),
"transactionRequest": self.get_transaction_request(amount, profile, line_items),
"hostedPaymentSettings": {
"setting": self.get_portal_settings()
}
}
})
return json.loads(r.text[1:])
08-18-2023 11:15 AM