-
Notifications
You must be signed in to change notification settings - Fork 629
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
Shopify Connector Tax ID, Multiple Company Locations, Tax ID export, Company Mapping by Tax ID, Payment Terms Export/Import, Company External ID #27577
Open
GediminasGaubys
wants to merge
34
commits into
microsoft:main
Choose a base branch
from
GediminasGaubys:taxid_minorchanges_withunittests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
299bb82
1 task. Customer No. assignment for Shopify Catalogs during Customer …
jzaksauskas b9b6462
2 task. Import Multiple Company locations to Business Central. Additi…
jzaksauskas bf343d5
2 task. Import Multiple Company locations to Business Central. Improv…
jzaksauskas 00b9c65
3 task. Tax ID export/mapping
jzaksauskas 51cae44
5 task. Assign External ID during Csutomer as Company export
jzaksauskas 8cbb245
Set Company Location as default on Shopify Company creation
jzaksauskas ee27f39
Get Tax Registration Number moved to implementation codeunits
jzaksauskas accc09a
Moved Company Mapping to implementation codeunits
jzaksauskas 2e90b5d
Implemented Export and Import for Company Location Payment Terms
jzaksauskas 7916a9e
Re-implemented logic to get Graph queries to Interfces
jzaksauskas a3491c0
Fixes after PR review
jzaksauskas 8ca4d53
Changes after PR review
jzaksauskas 17c2f51
Created new interface to avoid destructive change. Created pagination…
jzaksauskas df63786
Removed locations from GetCompany graphQL
jzaksauskas c7f8822
Extending the compnay mapping interface
jzaksauskas 497976b
removed implemenetions from enum for new interface
jzaksauskas 64b60e6
test commit
petemchlk 52426d1
remove empty line
petemchlk e217b4d
fix existing test, add test for catalog
petemchlk ca3dd8c
Task 1 test
petemchlk b779120
add find mapping tests
petemchlk 2ba709b
add tests
petemchlk bc4d15d
Payment terms integration tests, fix create customer Payment terms ma…
petemchlk d86daa5
TaxID and Payment Terms export tests
petemchlk 853e713
Add external id export test
petemchlk 6e07369
refactor
petemchlk edc6480
refactor
petemchlk da05306
fix test
petemchlk 58bbf66
Minor adjustment
GediminasGaubys f4dc384
fix naming
petemchlk 34476e2
Merge branch 'main' into taxid_minorchanges_withunittests
petemchlk f6c0c19
remove duplicated object
petemchlk d5e6fad
fix issue with default location
petemchlk b6e00ce
change clear to init
petemchlk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
Apps/W1/Shopify/app/src/Companies/Codeunits/ShpfyCompByTaxId.Codeunit.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
namespace Microsoft.Integration.Shopify; | ||
|
||
using Microsoft.Sales.Customer; | ||
|
||
/// <summary> | ||
/// Codeunit Shpfy Comp. By Tax Id (ID 30366) implements Interface Shpfy ICompany Mapping. | ||
/// </summary> | ||
codeunit 30366 "Shpfy Comp. By Tax Id" implements "Shpfy ICompany Mapping", "Shpfy IFind Company Mapping" | ||
{ | ||
Access = Internal; | ||
|
||
internal procedure DoMapping(CompanyId: BigInteger; ShopCode: Code[20]; TemplateCode: Code[20]; AllowCreate: Boolean): Code[20] | ||
var | ||
ShopifyCompany: Record "Shpfy Company"; | ||
begin | ||
if ShopifyCompany.Get(CompanyId) then begin | ||
if not IsNullGuid(ShopifyCompany."Customer SystemId") then begin | ||
ShopifyCompany.CalcFields("Customer No."); | ||
if ShopifyCompany."Customer No." = '' then begin | ||
Clear(ShopifyCompany."Customer SystemId"); | ||
ShopifyCompany.Modify(true); | ||
end else | ||
exit(ShopifyCompany."Customer No."); | ||
end; | ||
exit(CreateCompany(CompanyId, ShopCode, TemplateCode, AllowCreate)); | ||
end else | ||
exit(CreateCompany(CompanyId, ShopCode, TemplateCode, AllowCreate)); | ||
end; | ||
|
||
internal procedure FindMapping(var ShopifyCompany: Record "Shpfy Company"; var TempShopifyCustomer: Record "Shpfy Customer" temporary): Boolean | ||
var | ||
Customer: Record Customer; | ||
CompanyLocation: Record "Shpfy Company Location"; | ||
begin | ||
if not IsNullGuid(ShopifyCompany."Customer SystemId") then | ||
if Customer.GetBySystemId(ShopifyCompany."Customer SystemId") then | ||
exit(true) | ||
else begin | ||
Clear(ShopifyCompany."Customer SystemId"); | ||
ShopifyCompany.Modify(true); | ||
end; | ||
|
||
if IsNullGuid(ShopifyCompany."Customer SystemId") then | ||
if ShopifyCompany."Location Id" <> 0 then begin | ||
CompanyLocation.Get(ShopifyCompany."Location Id"); | ||
if CompanyLocation."Tax Registration Id" <> '' then | ||
exit(FindByTaxRegistrationId(ShopifyCompany, TempShopifyCustomer, CompanyLocation)); | ||
end; | ||
end; | ||
|
||
local procedure CreateCompany(CompanyId: BigInteger; ShopCode: Code[20]; TemplateCode: Code[20]; AllowCreate: Boolean): Code[20] | ||
var | ||
ShopifyCompany: Record "Shpfy Company"; | ||
TempShopifyCompany: Record "Shpfy Company" temporary; | ||
CompanyImport: Codeunit "Shpfy Company Import"; | ||
begin | ||
CompanyImport.SetShop(ShopCode); | ||
CompanyImport.SetAllowCreate(AllowCreate); | ||
CompanyImport.SetTemplateCode(TemplateCode); | ||
TempShopifyCompany.Id := CompanyId; | ||
TempShopifyCompany.Insert(false); | ||
|
||
CompanyImport.Run(TempShopifyCompany); | ||
CompanyImport.GetCompany(ShopifyCompany); | ||
if ShopifyCompany.Find() then | ||
ShopifyCompany.CalcFields("Customer No."); | ||
|
||
exit(ShopifyCompany."Customer No."); | ||
end; | ||
|
||
local procedure FindByTaxRegistrationId(var ShopifyCompany: Record "Shpfy Company"; var TempShopifyCustomer: Record "Shpfy Customer" temporary; CompanyLocation: Record "Shpfy Company Location"): Boolean | ||
var | ||
Customer: Record Customer; | ||
ShopifyCustomer: Record "Shpfy Customer"; | ||
Shop: Record "Shpfy Shop"; | ||
TaxRegistrationIdMapping: Interface "Shpfy Tax Registration Id Mapping"; | ||
begin | ||
Clear(Customer); | ||
Shop.Get(ShopifyCompany."Shop Code"); | ||
TaxRegistrationIdMapping := Shop."Shpfy Comp. Tax Id Mapping"; | ||
TaxRegistrationIdMapping.SetMappingFiltersForCustomers(Customer, CompanyLocation); | ||
if Customer.FindFirst() then begin | ||
ShopifyCompany."Customer SystemId" := Customer.SystemId; | ||
|
||
if not ShopifyCustomer.Get(TempShopifyCustomer.Id) then begin | ||
ShopifyCustomer.Copy(TempShopifyCustomer); | ||
ShopifyCustomer."Customer SystemId" := Customer.SystemId; | ||
ShopifyCustomer.Insert(true); | ||
end; | ||
|
||
ShopifyCompany."Main Contact Customer Id" := ShopifyCustomer.Id; | ||
ShopifyCompany.Modify(true); | ||
exit(true); | ||
end; | ||
end; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndreiPanko this means each catalog will be assigned a customer and only that customer will be used to calculate the price. Not the settings in the catalogs page. ("Customer Price Group", "Customer Disc. Group", "Allow Line Disc.")
Is that the intention? Then shouldn't we remove those settings from the page?