Skip to content

Commit

Permalink
Hide tax for new users - Intacct and Xero (#916)
Browse files Browse the repository at this point in the history
* Hide tax for new users - Intacct and Xero

* refactor
  • Loading branch information
ashwin1111 committed Aug 19, 2024
1 parent 804a9c4 commit 1c6864f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { IntacctDestinationAttribute } from 'src/app/core/models/intacct/db/dest
import { ExpenseField } from 'src/app/core/models/intacct/db/expense-field.model';
import { LocationEntityMapping } from 'src/app/core/models/intacct/db/location-entity-mapping.model';
import { DependentFieldSetting, ImportSettingGet, ImportSettingPost, ImportSettings, MappingSetting } from 'src/app/core/models/intacct/intacct-configuration/import-settings.model';
import { Org } from 'src/app/core/models/org/org.model';
import { IntegrationsToastService } from 'src/app/core/services/common/integrations-toast.service';
import { StorageService } from 'src/app/core/services/common/storage.service';
import { TrackingService } from 'src/app/core/services/integration/tracking.service';
import { OrgService } from 'src/app/core/services/org/org.service';
import { SiImportSettingService } from 'src/app/core/services/si/si-configuration/si-import-setting.service';
import { IntacctConnectorService } from 'src/app/core/services/si/si-core/intacct-connector.service';
import { SiMappingsService } from 'src/app/core/services/si/si-core/si-mappings.service';
Expand All @@ -29,6 +31,8 @@ export class IntacctImportSettingsComponent implements OnInit {

appName = AppName.INTACCT;

org: Org = this.orgService.getCachedOrg();

importSettingsForm: FormGroup;

customFieldForm: FormGroup;
Expand Down Expand Up @@ -93,6 +97,7 @@ export class IntacctImportSettingsComponent implements OnInit {
private connectorService: IntacctConnectorService,
private importSettingService: SiImportSettingService,
@Inject(FormBuilder) private formBuilder: FormBuilder,
private orgService: OrgService,
private toastService: IntegrationsToastService,
private trackingService: TrackingService,
private storageService: StorageService,
Expand Down Expand Up @@ -409,7 +414,7 @@ export class IntacctImportSettingsComponent implements OnInit {
}

showImportTax(locationEntity: LocationEntityMapping) {
return (locationEntity.country_name && locationEntity.country_name !== 'United States' && locationEntity.destination_id !== 'top_level') ? true : false;
return new Date(this.org.created_at) < new Date('2024-08-19') && locationEntity.country_name && locationEntity.country_name !== 'United States' && locationEntity.destination_id !== 'top_level' ? true : false;
}

private initializeForm(importSettings: ImportSettingGet): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import { DestinationAttribute } from 'src/app/core/models/db/destination-attribu
import { FyleField, IntegrationField } from 'src/app/core/models/db/mapping.model';
import { AppName, ConfigurationCta, ToastSeverity, XeroOnboardingState } from 'src/app/core/models/enum/enum.model';
import { XeroFyleField } from 'src/app/core/models/enum/enum.model';
import { Org } from 'src/app/core/models/org/org.model';
import { XeroWorkspaceGeneralSetting } from 'src/app/core/models/xero/db/xero-workspace-general-setting.model';
import { XeroImportSettingGet, XeroImportSettingModel } from 'src/app/core/models/xero/xero-configuration/xero-import-settings.model';
import { IntegrationsToastService } from 'src/app/core/services/common/integrations-toast.service';
import { MappingService } from 'src/app/core/services/common/mapping.service';
import { WorkspaceService } from 'src/app/core/services/common/workspace.service';
import { OrgService } from 'src/app/core/services/org/org.service';
import { XeroConnectorService } from 'src/app/core/services/xero/xero-configuration/xero-connector.service';
import { XeroImportSettingsService } from 'src/app/core/services/xero/xero-configuration/xero-import-settings.service';
import { XeroHelperService } from 'src/app/core/services/xero/xero-core/xero-helper.service';
Expand Down Expand Up @@ -72,6 +74,8 @@ export class XeroImportSettingsComponent implements OnInit {

isCustomerPresent: boolean;

org: Org = this.orgService.getCachedOrg();

readonly brandingFeatureConfig = brandingFeatureConfig;

readonly brandingContent = brandingContent.xero.configuration.importSetting;
Expand All @@ -87,6 +91,7 @@ export class XeroImportSettingsComponent implements OnInit {
private mappingService: MappingService,
private xeroHelperService: XeroHelperService,
@Inject(FormBuilder) private formBuilder: FormBuilder,
private orgService: OrgService,
private toastService: IntegrationsToastService,
private xeroConnectorService: XeroConnectorService
) { }
Expand Down Expand Up @@ -266,7 +271,7 @@ export class XeroImportSettingsComponent implements OnInit {

this.importSettingsForm = XeroImportSettingModel.mapAPIResponseToFormGroup(this.importSettings, this.xeroExpenseFields, this.isCustomerPresent, this.taxCodes);

if (response[5] && response[5].country !== 'US') {
if (response[5] && response[5].country !== 'US' && new Date(this.org.created_at) < new Date('2024-08-19')) {
this.isTaxGroupSyncAllowed = true;
}
// This is only for C1
Expand Down

0 comments on commit 1c6864f

Please sign in to comment.