Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.58k stars 2.92k forks source link

[$250] BUG: Sage Intacct subsidiary is not shown on Connections card under Sage Intacct logo #45935

Closed dylanexpensify closed 3 months ago

dylanexpensify commented 4 months ago

Testing doc: here (request, will share)

Pre-testing steps

Pre-testing steps

Steps:

  1. Head to Workspace settings
  2. Head to Accounting
  3. Under Sage Intacct Connection click Connect
  4. Enter valid credentials

Expected result: Once connected, the Sage Intacct subsidiary is shown on Connections card under Sage Intacct logo + Last synced message Actual result: The Sage Intacct subsidiary is not shown on Connections card under Sage Intacct logo + Last synced message

Screenshot:

Screenshot 2024-07-22 at 8 28 51 PM
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015bae9383e2075bb8
  • Upwork Job ID: 1815835932579772267
  • Last Price Increase: 2024-07-23
  • Automatic offers:
    • paultsimura | Reviewer | 103311605
Issue OwnerCurrent Issue Owner: @greg-schroeder
melvin-bot[bot] commented 4 months ago

Triggered auto assignment to @greg-schroeder (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.

melvin-bot[bot] commented 4 months ago

Job added to Upwork: https://www.upwork.com/jobs/~015bae9383e2075bb8

melvin-bot[bot] commented 4 months ago

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

kabeer95 commented 4 months ago

Proposal

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

The problem we are trying to solve is that the Sage Intacct subsidiary is not shown on the Connections card under the Sage Intacct logo after connecting to Sage Intacct from the Workspace settings.

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 subsidiary information from being retrieved and displayed on the Connections card.

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 retrieves and displays the subsidiary information on the Connections card. Specifically, we should verify that the Sage Intacct web services user ID, password, and Company ID are correct and properly configured, check the XML API calls to ensure that they are correctly formatted and include the necessary fields to retrieve the subsidiary information, and review the code that handles the connection to Sage Intacct and the display of the Connections card to ensure that it is correctly parsing and displaying the subsidiary information.

// 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
});

// Parse response to retrieve subsidiary information
const subsidiaryInfo = await response.xml();
if (subsidiaryInfo) {
  // Display subsidiary information on Connections card
  console.log('Subsidiary information:', subsidiaryInfo.text);
} else {
  console.error('Failed to retrieve subsidiary information');
}
greg-schroeder commented 4 months ago

Proposal review underway

paultsimura commented 4 months ago

@greg-schroeder not much to review here. Unfortunately, @kabeer95's proposal looks like a generic GPT-generated answer (they've been warned about such proposals in the past, but nothing really changed): generic self-repeating sentences with no App-specific code links, etc.

greg-schroeder commented 4 months ago

Word, thanks @paultsimura

SzymczakJ commented 4 months ago

Hello, I was implementing this feature, so you can assign me to this 😄. I though that having no entity chosen is a viable option and means "syncing at a top level" as mentioned in design doc. But now when I think of it, we don't give the user an option to come back to Top Level sync, so we surely need to address it. How should Entities work in Sage Intacct @yuwenmemon? When we connect to Intacct, should entity be chosen arbitrarily? How to show that user is syncing at a top level(I think that showing no entity chosen is a bac way to indicate this)?

melvin-bot[bot] commented 4 months ago

📣 @paultsimura 🎉 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

yuwenmemon commented 4 months ago

@SzymczakJ We show the option as "Top Level". I'll even share with you the JS from OldDot:

            // create entities selector
            let entities;
            let entitiesClass = '';
            if (!_.isEmpty(data.entities)) {
                entitiesClass = 'hasEntities';
                const entitiesOptions = _.map(data.entities, entity => ({value: entity.id, text: entity.name}));
                entitiesOptions.unshift({value: '', text: 'Top level'});
                entities = (
                    <div className="form xl-labels rowGaps">
                        <label htmlFor="intacct_entities">Top or entity level sync</label>
                        <React.c.FormElementSelect id="intacct_entities" options={entitiesOptions} defaultValue={config.entity} onChangeCallback={this.changeEntity} />
                    </div>
                );
            }
Screenshot 2024-07-29 at 11 18 38 AM
yuwenmemon commented 4 months ago

How to show that user is syncing at a top level(I think that showing no entity chosen is a bac way to indicate this)?

So based on the above, we should show an explicit "Top Level" option.

yuwenmemon commented 4 months ago

cc @ryanldonato

SzymczakJ commented 4 months ago

So basically we should translate missing entity field or entity set to "" to a Top level option, right?

yuwenmemon commented 4 months ago

Yep!

paultsimura commented 3 months ago

Hey @yuwenmemon – will this PR require C+ review? If so – could you please help me get access to the testing doc? I've requested but haven't gotten access yet.

yuwenmemon commented 3 months ago

Sorry @paultsimura it will not require C+ review, I'll unassign here.

melvin-bot[bot] commented 3 months ago

Triggered auto assignment to @tgolen, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] commented 3 months ago

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] commented 3 months ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.17-2 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-08-14. :confetti_ball:

For reference, here are some details about the assignees on this issue:

melvin-bot[bot] commented 3 months ago

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

tgolen commented 3 months ago

I don't think we need to treat this as a regression. As pointed out above, this was just something missed during implementation.

isagoico commented 3 months ago

Related to this regression suite update - https://github.com/Expensify/Expensify/issues/414754#issuecomment-2278409936

@SzymczakJ I'm still able to reproduce that the Intacct Entity is not displayed on the latest staging build: image

SzymczakJ commented 3 months ago

I've also stumbled upon such bug once, it comes from Sage Intacct connection object not being connected properly causing entity object to be empty. Did it fix after reconnecting/relogging @isagoico? I noticed sometimes connection action fails and we get such "not complete" objects in connections

isagoico commented 3 months ago

I'm not able to see the option even after disconnect > reconnect or refreshing the page. image

greg-schroeder commented 3 months ago

There aren't any payments due here from my end. Should we close this is or the above discussion still unresolved?

SzymczakJ commented 3 months ago

@greg-schroeder let's keep this discussion for a moment. Cannot reproduce on my end but I've checked frond-end code and it seems like it might be related to BE.

it comes from Sage Intacct connection object not being connected properly causing entity object to be empty.

@NikkiWines @yuwenmemon are there any BE issues related to connecting to Sage intacct?

SzymczakJ commented 3 months ago

I'll OOO the whole next week but feel free to ask @war-in, as he has a lot of context.

dylanexpensify commented 3 months ago

@greg-schroeder let's get @war-in assigned here to keep it moving? @yuwenmemon @NikkiWines can you confirm @SzymczakJ's query here?

yuwenmemon commented 3 months ago

@NikkiWines @yuwenmemon are there any BE issues related to connecting to Sage intacct?

There could be a multitude of errors. However, I, too, am unable to reproduce it on my end. @isagoico would you be able to spin up an issue with reproduction steps?

And then I think we can close this issue out.

yuwenmemon commented 3 months ago

Oooooh wait I know what's happening. @isagoico You're using the QA account right? That one doesn't use subsidiaries/entities. You can confirm this by looking at the same connection in OldDot, there is no entity selector there either. So, this is working as expected: Screenshot 2024-08-15 at 1 34 28 PM

isagoico commented 3 months ago

Ah! My apologies for this then 🫠 I think we can close this one out if it's a expected configuration on the QA account