Open jimmymcpeter opened 3 years ago
Here is a unit test you can use to replicate in SessionProviderTest.ts --
it("should execute from console login credentials to client", async () => {
const xmlResponse = `<?xml version="1.0" encoding="UTF-8"?>
<response>
<control>
<status>success</status>
<senderid>testsenderid</senderid>
<controlid>sessionProvider</controlid>
<uniqueid>false</uniqueid>
<dtdversion>3.0</dtdversion>
</control>
<operation>
<authentication>
<status>failure</status>
<userid>invaliduserid</userid>
<companyid>testconsoleid</companyid>
<locationid></locationid>
</authentication>
</operation>
</response>
`;
const headers = {
"Content-Type": 'text/xml; encoding="UTF-8"',
};
nock.disableNetConnect();
nock("https://api.intacct.com")
.replyContentLength()
.post("/ia/xml/xmlgw.phtml")
.reply(200, xmlResponse, headers);
const config = new ClientConfig();
config.senderId = "testsenderid";
config.senderPassword = "pass123!";
config.companyId = "testconsoleid|testclientid";
config.userId = "invaliduserid";
config.userPassword = "testpass";
const sessionCreds = await SessionProvider.factory(config);
});
The following code
Throws the following
In OnlineResponse.ts, this is the section throwing
To replicate this, the company ID must be in pipe form
testconsoleid|testclientid
and the user ID in the console must be invalid. For whatever reason with this combo, Web Services returns the following XML response which is completely missing any sort oferrormessage
element in theoperation
block.