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

[HOLD for payment 2024-07-22] [HOLD for payment 2024-07-17] [#Wave-Control - Add Sage Intacct] Add the Connection option and Connection button in NewDot #43532

Closed yuwenmemon closed 4 months ago

yuwenmemon commented 5 months ago

Tracking GH: https://github.com/Expensify/Expensify/issues/388780

Design doc section: https://docs.google.com/document/d/1k3ZFw8KB55yPUSCG6KYZlwpwEtmRt3eUshwxs7bZq5I/edit#heading=h.w7qju91gpvcq


Before diving into it, let’s add it to the list of the available connections options.

// src/CONST.ts       

const CONNECTIONS = {
    NAME: {
        // Here we will add other connections names when we add support for them
        QBO: 'quickbooksOnline',
        XERO: 'xero',
        // …
        SAGE_INTACCT: 'intacct',
    },
};

Next, we’re going to show it in the Accounting page. To do this, modify PolicyAccountingPage.tsx:

// src/pages/workspace/accounting/PolicyAccountingPage.tsx

switch (connectionName) {
// ...
case CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT:
                return {
                    title: translate('workspace.accounting.sageIntacct'),
                    icon: Expensicons.SageIntacctSquare,
                    setupConnectionButton: (
                        <ConnectToSageIntacctButton
                            policyID={policyID}
                            shouldDisconnectIntegrationBeforeConnecting={isConnectedToIntegration}
                            integrationToDisconnect={integrationToDisconnect}
                        />
                    ),
                    onImportPagePress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_IMPORT.getRoute(policyID)),
                    onExportPagePress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_EXPORT.getRoute(policyID)),
                    onAdvancedPagePress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_ADVANCED.getRoute(policyID)),
                };     

Creating the connection button

The code for the ConnectToSageIntacctButton.tsx component would look like something like this:

// src/components/ConnectToSageIntacctButton/index.tsx

function ConnectToSageIntacctButton({policyID, shouldDisconnectIntegrationBeforeConnecting, integrationToDisconnect}: ConnectToSageIntacctButtonProps) {
    return (
        <>
            <Button
                onPress={() => {
                    if (shouldDisconnectIntegrationBeforeConnecting && integrationToDisconnect) {
                        setIsDisconnectModalOpen(true);
                        return;
                    }
            // 3 conditions need to be done here (screenshots in the "Connection Process" section)
            // These are:
                    // 1. show prerequisites modal if necessary i.e credentials not present in policy's intacct connection data
            // 2. if secondary workspace with Intacct sync, show a menu with options "Create new connection" and "Reuse existing connection" 
            // 3. otherwise sync by calling the SyncPolicyToSageIntacct command
                }}
                text={translate('workspace.accounting.setup')}
                style={styles.justifyContentCenter}
                small
                isDisabled={isOffline}
            />
            {shouldDisconnectIntegrationBeforeConnecting && isDisconnectModalOpen && integrationToDisconnect && (
                <ConfirmModal
                    title={translate('workspace.accounting.disconnectTitle', CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT)}
                    isVisible
                    onConfirm={() => {
                        removePolicyConnection(policyID, integrationToDisconnect);
                        Link.openLink(getSageIntacctSetupLink(policyID), environmentURL);
                        setIsDisconnectModalOpen(false);
                    }}
                    onCancel={() => setIsDisconnectModalOpen(false)}
                    prompt={translate('workspace.accounting.disconnectPrompt', CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT)}
                    confirmText={translate('workspace.accounting.disconnect')}
                    cancelText={translate('common.cancel')}
                    danger
                />
            )}
        </>
    );
}

export default React.memo(ConnectToSageIntacctButton);
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017a8c2faf283b52e8
  • Upwork Job ID: 1800756578326323366
  • Last Price Increase: 2024-06-12
  • Automatic offers:
    • ishpaul777 | Reviewer | 102709182
    • hungvu193 | Contributor | 102767547
Issue OwnerCurrent Issue Owner: @alexpensify
melvin-bot[bot] commented 5 months ago

Triggered auto assignment to @alexpensify (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

melvin-bot[bot] commented 5 months ago

:warning: It looks like this issue is labelled as a New Feature but not tied to any GitHub Project. Keep in mind that all new features should be tied to GitHub Projects in order to properly track external CAP software time :warning:

melvin-bot[bot] commented 5 months ago

Triggered auto assignment to Design team member for new feature review - @shawnborton (NewFeature)

melvin-bot[bot] commented 5 months ago

Job added to Upwork: https://www.upwork.com/jobs/~017a8c2faf283b52e8

melvin-bot[bot] commented 5 months ago

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

SzymczakJ commented 5 months ago

Hey! I’m Jakub Szymczak from Software Mansion, an expert agency, and I’d like to work on this issue!

melvin-bot[bot] commented 5 months ago

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

alexpensify commented 5 months ago

Thanks, I've assigned to @SzymczakJ

SzymczakJ commented 5 months ago

Update: Even though we are still waiting for API command to be implemented on BE I'll put up a PR with mocked backend interaction. It should be ready tomorrow or on Monday.

hungvu193 commented 5 months ago

@yuwenmemon Can you assign me this one?

ishpaul777 commented 5 months ago

@hungvu193 would you be working on whole Sage Intacct project, i dont have any PRs assigned for while so i can help, just let me know : )

yuwenmemon commented 5 months ago

Yeah @ishpaul777 - @hungvu193 is working on the whole project and reviewing all PRs underneath since they have broad context.

melvin-bot[bot] commented 5 months ago

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

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻 Keep in mind: Code of Conduct | Contributing 📖

SzymczakJ commented 5 months ago

PR on this should be ready to review tomorrow(of course we're still waiting for BE but this code could use some checking 😄 ). Btw how is BE work going @yuwenmemon?

alexpensify commented 5 months ago

Thanks for the update @SzymczakJ!

yuwenmemon commented 5 months ago

@SzymczakJ I think we should have the BE done and deployed sometime this week. @NikkiWines said she'll have a PR ready by EOD today! 🎉

NikkiWines commented 5 months ago

Backend PR is up https://github.com/Expensify/Web-Expensify/pull/42400

SzymczakJ commented 5 months ago

@hungvu193 PR is ready for review. Please keep in mind that I'm gonna add some API calls/error handling when backend is ready but these should be pretty small changes 😄

hungvu193 commented 5 months ago

Awesome. I'll take a look in a while 👀

hungvu193 commented 5 months ago

Backend PR is up https://github.com/Expensify/Web-Expensify/pull/42400

Please let us know once this is deployed so @SzymczakJ can continue to integrate the API to current PR 😄

SzymczakJ commented 5 months ago

What's status of your BE PR @NikkiWines? 😺

NikkiWines commented 5 months ago

It's on staging currently, should be deployed to production on Monday

SzymczakJ commented 5 months ago

@NikkiWines how to execute this command properly from FE, doc is missing information on that part. I tried something like

image

with the credentials with which I logged into Sage Intacct on Old Dot and it's not working 😭. I also tried many other variations of this command usage and all of them fail. Can you give me and example how to invoke ConnectPolicyToSageIntacct command?

NikkiWines commented 5 months ago

@SzymczakJ the parameter names are slightly different - they're all prepended with intacct (i.e. intacctCompanyID, intacctUserID, intacctPassword). Also, looks like it should be const parameters: ConnectPolicyToSageIntacct

Other than those two things what you have above should work!

SzymczakJ commented 5 months ago

It works! One more question @NikkiWines: what about reusing existing Sage Intacct connection? I have credentials data in intacct config but sage intacct password is encrypted. Using this encrypted password with ConnectPolicyToSageIntacct doesn't work.

SzymczakJ commented 5 months ago

I have some problems:

  1. connectionSyncProgress is not updated when connecting to Sage Intacct. I can connect properly, but I cannot update connection progress because connectionSyncProgress is undefined all the time
  2. what to do when user gives wrong Sage Intacct credentials, should we show some kind of error?
  3. this might be a good place to add Entity selection page Screenshot 2024-06-25 at 13 23 52

    when will command for updating "Entity" be added on backend(his command is not mentioned in design doc but I guess it should be 😬 )?

NikkiWines commented 5 months ago

@SzymczakJ sounds like you got these answered q's in this slack thread, is that correct?

alexpensify commented 5 months ago

It looks like the Slack thread has a plan. Keep us posted if you need anything else @SzymczakJ to keep moving forward here. Thanks!

alexpensify commented 5 months ago

Heads up, I will be offline until Monday, July 8, 2024, and will not actively watch over this GitHub during that period.

I'll try to check in a few times. If anything urgent is needed here, please ask for help in the #expensify-open-source Slack Room-- thanks!

SzymczakJ commented 5 months ago

As we planned to create a follow-up PR, can we create a separate issue for it? @yuwenmemon

hungvu193 commented 5 months ago

Thanks for pointing that out @SzymczakJ, let's me create an issue for it 🙏

melvin-bot[bot] commented 4 months ago

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

alexpensify commented 4 months ago

@hungvu193 and @SzymczakJ - can we confirm if this deploy blocker notice is accurate or an error? Thanks!

SzymczakJ commented 4 months ago

Like @lakchote said here it's not a deploy blocker and I agree with him. I can fix this bug right away because the fix is changing one line, but I would rather do it in this PR, since I'm spinning up a follow-up PR anyway. WDYT

SzymczakJ commented 4 months ago

I've included the fix in the PR that I was talking about.

alexpensify commented 4 months ago

Thank you for this update and swift action.

melvin-bot[bot] commented 4 months ago

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

melvin-bot[bot] commented 4 months ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.5-13 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-07-17. :confetti_ball:

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

melvin-bot[bot] commented 4 months ago

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

melvin-bot[bot] commented 4 months ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.6-8 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-07-22. :confetti_ball:

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

melvin-bot[bot] commented 4 months ago

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

alexpensify commented 4 months ago

I believe the payment date has been moved to 7/22, and will prepare accordingly.

hungvu193 commented 4 months ago

No payment needed for me. I will be paid later after SageIntacct project is completed

alexpensify commented 4 months ago

@hungvu193 - thank you for that update. Here is the payment breakdown for the records:

Payouts due: N/A

Upwork job is https://www.upwork.com/jobs/~017a8c2faf283b52e8