Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$250] BUG: No RBR occurs when invalid credentials used to connect to Sage Intacct #45938

Closed
dylanexpensify opened this issue Jul 22, 2024 · 16 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2

Comments

@dylanexpensify
Copy link
Contributor

dylanexpensify commented Jul 22, 2024

Testing doc: here (request, will share)

Pre-testing steps

  • Make sure the email address does not already have existing workspaces/policies
  • Make sure emails sent to the testing email addresses go to an inbox you can access to validate your account(s)
  • Create a new collect policy on OldDot and;
  • Set the approval mode to “submit and approve”
  • Enable scheduled submit with a frequency of Daily or “slower”
  • Invite an additional user to the policy to play the member role in these testing flows
  • Run the script stated here to enable workspace chat creation for a paid plan.

Pre-testing steps

  • Make sure that your test account is on the intacctOnNewExpensify beta
  • Make sure you have Sage Intacct web services user ID, password and Company ID to initiate a connection
  • Make sure you create a new workspace/policy for each test run
  • Make sure emails sent to the testing email addresses go to an inbox you can access to validate your account(s)

Steps:

  1. Head to Workspace settings
  2. Head to Accounting
  3. Under Sage Intacct Connection click Connect
  4. Enter incorrect validation tokens

Expected result: A RBR is shown on Accounting in LHN and on the Connections card in Accounting.
Actual result: No RBR is present, and the #admins page shows that the connection occurred

Screenshot LHN:
Screenshot 2024-07-22 at 8 31 20 PM

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f23c70a65cf3f85e
  • Upwork Job ID: 1815806620903385053
  • Last Price Increase: 2024-07-23
  • Automatic offers:
    • situchan | Reviewer | 103316519
Issue OwnerCurrent Issue Owner: @NikkiWines
@dylanexpensify dylanexpensify added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 22, 2024
Copy link

melvin-bot bot commented Jul 22, 2024

Triggered auto assignment to @stephanieelliott (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@stephanieelliott stephanieelliott added the External Added to denote the issue can be worked on by a contributor label Jul 23, 2024
Copy link

melvin-bot bot commented Jul 23, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01f23c70a65cf3f85e

@melvin-bot melvin-bot bot changed the title BUG: No RBR occurs when invalid credentials used to connect to Sage Intacct [$250] BUG: No RBR occurs when invalid credentials used to connect to Sage Intacct Jul 23, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 23, 2024
Copy link

melvin-bot bot commented Jul 23, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)

@kabeer95
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.

When invalid credentials are used to connect to Sage Intacct, no Retry, Backup, and Retry (RBR) mechanism is triggered, resulting in an "invalid credentials" or "authentication failure" error.

What is the root cause of that problem?

The root cause of this problem is likely due to an incorrect implementation of the Sage Intacct API or a misconfiguration of the connection settings, which prevents the RBR mechanism from kicking in when invalid credentials are used.

What changes do you think we should make in order to solve the problem?

To solve this problem, we need to review and adjust the Sage Intacct API implementation to ensure that it correctly handles invalid credentials and triggers the RBR mechanism. Specifically, we should:

Verify Sage Intacct credentials and connection settings.
Set API endpoint and headers correctly.
Set XML payload to retrieve subsidiary information.
Send request to Sage Intacct API and check if response is invalid credentials error.
If invalid credentials error, trigger RBR mechanism.
Here is an example code snippet to illustrate the solution:

// Verify Sage Intacct credentials and connection settings
const sageIntacctCredentials = {
  userId: 'your_user_id',
  password: 'your_password',
  companyId: 'your_company_id'
};

// Set API endpoint and headers
const endpoint = 'https://api.intacct.com/ia/xml/xmlgw.aspx';
const headers = {
  'Content-Type': 'application/xml',
  'Authorization': `Basic ${sageIntacctCredentials.userId}:${sageIntacctCredentials.password}`
};

// Set XML payload to retrieve subsidiary information
const payload = `
<?xml version="1.0" encoding="UTF-8"?>
<request>
  <control>
    <senderid>${sageIntacctCredentials.companyId}</senderid>
    <password>${sageIntacctCredentials.password}</password>
    <controlid>string</controlid>
    <uniqueid>false</uniqueid>
    <dtdversion>3.0</dtdversion>
  </control>
  <operation>
    <authentication>${sageIntacctCredentials.companyId}</authentication>
    <get>
      <object>subsidiary</object>
    </get>
  </operation>
</request>
`;

// Send request to Sage Intacct API
const response = await fetch(endpoint, {
  method: 'POST',
  headers,
  body: payload
});

// Check if response is invalid credentials error
if (response.status === 401) {
  // Trigger RBR mechanism
  console.log('Invalid credentials, triggering RBR...');
  // Implement RBR logic here
} else {
  console.log('Error:', response.statusText);
}

@situchan
Copy link
Contributor

@kabeer95 Can you please familiarize yourself with our codebase and some old proposals on closed issues to understand what is expected in a proposal?

@jayeshmangwani
Copy link
Contributor

@dylanexpensify @stephanieelliott Script link is of internal SO and is not accessible to everyone. Is there any way to add(or access script) the for adding/testing the test Sage Intacct?

@SzymczakJ
Copy link
Contributor

I was implementing this so you can assign me.
This is probably caused by the way we handle incorrect credentials on Sage Intacct. @NikkiWines should have more context.
I guess our solution to incorrect credentials has some downsides 😅

@melvin-bot melvin-bot bot added the Overdue label Jul 29, 2024
@situchan
Copy link
Contributor

@stephanieelliott please assign @SzymczakJ from SWM

@melvin-bot melvin-bot bot removed the Overdue label Jul 29, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

📣 @situchan 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@NikkiWines
Copy link
Contributor

This one's a backend bug so i'll try and patch it when I've got some spare cycles - adjusting the labels accordingly

@melvin-bot melvin-bot bot added the Overdue label Aug 1, 2024
@NikkiWines NikkiWines added Weekly KSv2 Internal Requires API changes or must be handled by Expensify staff and removed Daily KSv2 Overdue labels Aug 1, 2024
@NikkiWines NikkiWines self-assigned this Aug 1, 2024
@NikkiWines NikkiWines removed the External Added to denote the issue can be worked on by a contributor label Aug 1, 2024
Copy link

melvin-bot bot commented Aug 5, 2024

@NikkiWines @stephanieelliott @SzymczakJ @situchan this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@NikkiWines
Copy link
Contributor

Sorry guys, been swamped with competing priorities these last few weeks, will try to prioritize this as soon as i have time

@NikkiWines
Copy link
Contributor

🤔 Seems to be a RBR for me when I enter invalid creds locally, but I do see the connected to Sage Intacct message still. I'll update it so we don't send that message if the connection fails

Screen.Recording.2024-08-23.at.16.36.36.mov

@melvin-bot melvin-bot bot added the Overdue label Aug 23, 2024
@NikkiWines
Copy link
Contributor

Not overdue

@melvin-bot melvin-bot bot removed the Overdue label Aug 23, 2024
@NikkiWines NikkiWines added the Reviewing Has a PR in review label Aug 27, 2024
@stephanieelliott
Copy link
Contributor

Seems like both linked PRs are on prod now -- @NikkiWines are we ok to close this, or is there more to do?

@NikkiWines
Copy link
Contributor

NikkiWines commented Sep 11, 2024

Thanks for the bump @stephanieelliott - I just re-tested the flow and I see a RBR and I don't see the double notification, so this one should be all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2
Projects
Status: Done
Development

No branches or pull requests

7 participants