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

Shopify Connector Tax ID, Multiple Company Locations, Tax ID export, Company Mapping by Tax ID, Payment Terms Export/Import, Company External ID #27577

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

GediminasGaubys
Copy link
Contributor

This pull request does not have a related issue as it's part of the delivery for development agreed directly with @AndreiPanko

Implementation 1 (Customer No. in Shopify Catalogs)

  • New functionality has been added to assign 'Customer No.' in Shopify Catalogs during Customer as Company export.

Implementation 2 (Import of Multiple Company Locations)

  • New functionality has been added that stores all Company Locations during import from Shopify. The first Company Location in the response is marked as 'Default'. To receive all Company Locations instead of one, new Query 'Shpfy GQL CompLocations' has been created. And Locations part has been removed from 'Shpfy GQL Company' query.
  • During the Customer as Company export, new created Shopify Company Location is marked as 'Default'.
  • Additionally Company Locations page was created to be able to see information from Business Central side. Company Locations page can be opened from Shopify Companies and Shopify Company Card pages.

Implementation 3 (Tax ID export and Company/Customer mapping by Tax Id)

  • Tax ID export to Shopify - Added functionality to update Tax Id on Company Creation and Synchronization (new GraphQL 'companyLocationCreateTaxRegistration' created and extended GraphQL 'companyCreate' by including Tax ID). Which Customer field has to be used as Tax Id is determined by field 'Company Tax Id Mapping' value on 'Shopify Shop Card'. There are 2 possible options: 'Registration Number' and 'VAT Registration No.'. Enum is extensible, so that user could add any other option to which fields Tax ID has to be linked (implementation codeunit has to be created and linked to new Enum value).
  • Company/Customer mapping by Tax Id - The logic how Company is linked to customer has to be mapped (by email/phone, by tax id, default company) is defined on 'Company Mapping Type' field on 'Shopify Shop Card' page. The 'Company Mapping Type' enum value has to be linked with implementation codeunits that are doing actual Company/Customer mapping. The changes that has been made:
  1. Interface "Shpfy ICompany Mapping" has been extended by creating new interface 'Shpfy IFind Company Mapping' that has new procedure FindMapping()
  2. Moved Existing Mapping by email/phone logic to implementation codeunit
  3. Added new functionality to implementation codeunit for 'Default Company' selection
  4. Created new implementation codeunit to do mapping by Tax ID
  5. Updated existing code by implementing 'Type testing and casting operators for interfaces - 'is' 'as' '. This functionality identifies if implementation codeunit has new interface 'Shpfy IFind Company Mapping' implemented. If so - 'FindMapping' procedure is executed, if not - mapping using email/phone is used as default option.

Implementation 4 (Company Location Payment Terms Export/Import)

  • Company Location Payment Terms Export - new GraphQL implementation codeunit for 'Shpfy GraphQL Type' has been created which allows to send Payment Terms to Shopify. If mapped value for Customer Payment Terms Code exist in 'Payment Terms Mapping', Shopify Payment Terms ID is exported to Shopify for that Company/Customer.
  • Company Location Payment Terms Import - GraphQL 'Shpfy GQL Company' that retrieves Company information from Shopify has been updated by adding new field 'paymentTermsTemplate'. If During the import the mapping in 'Payment Terms Mapping' exist, the Customer in BC is updated by the Payment Terms from Shopify.

Implementation 5 (Populate External ID during the export customer as a company)

  • Existing GraphQL that creates new Companies in Shopify has been updated by adding new field 'externalId'. The value which is 'Customer No.'

jzaksauskas and others added 29 commits September 30, 2024 16:14
@GediminasGaubys GediminasGaubys requested a review from a team as a code owner October 31, 2024 10:36
Copy link
Contributor

Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link.

@JesperSchulz JesperSchulz added the Integration GitHub request for Integration area label Nov 1, 2024
@@ -28,7 +28,7 @@ page 30159 "Shpfy Catalogs"
field("Customer No."; Rec."Customer No.")
{
ApplicationArea = All;
Visible = false;
Editable = false;
Copy link
Contributor

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?

}
field(14; "Shpfy Payment Terms Id"; BigInteger)
{
Caption = 'Shpfy Payment Terms Id';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Caption = 'Shpfy Payment Terms Id';
Caption = 'Shopify Payment Terms Id';

ShopifyCustomer: Record "Shpfy Customer";
CustomerMapping: Codeunit "Shpfy Customer Mapping";
PhoneFilter: Text;
ShpfyCompByEmailPhone: Codeunit "Shpfy Comp. By Email/Phone";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the variable naming.

If same name exists in Base Application then Shopify prefix, otherwise no prefix.

Example:

ShopifyCustomer: Record "Shpfy Customer" -> customer exists in Base Application
Catalog: Record "Shpfy Catalog" -> catalog does not exist in Base Application

@@ -199,4 +208,16 @@ codeunit 30284 "Shpfy Company Export"
begin
CreateCustomers := NewCustomers;
end;

local procedure GetShpfyPaymentTermsIdFromCustomer(Customer: Record Customer; var ShpfyPaymentTermsId: BigInteger): Boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to use Shpfy in the procedure names. Just use Shopify

@onbuyuka
Copy link
Contributor

onbuyuka commented Nov 6, 2024

Have you considered upgrade scenarios? What will happen for already imported companies? How will locations sync in that case?

@petemchlk
Copy link
Contributor

@onbuyuka resolved your comments about the naming issues

Regarding upgrade - it updates the locations well when you Sync Companies, but the problem is that update happens only if Company was updated on the date later than Last Synchronization for Shopify Companies. So, if somebody has old version and multiple location existing and had not updated company in Shopify in meantime won't get these updated locations in BC.

Since this is how the Company Sync. worked before is this correct behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration GitHub request for Integration area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants