Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0662172
Final integration to 27.0 (#4546)
aholstrup1 Aug 26, 2025
2634feb
[27.0] Update BCArtifact version. New value: 27.0.38460.38591 (#4551)
business-central-bot[bot] Aug 27, 2025
86c56cd
[releases/27.0] [Shopify] Add HttpClientHandler request path check fr…
onbuyuka Aug 27, 2025
00cac05
[27.0] Add CLEAN28 to AL-Go-Settings.json (#4608)
aholstrup1 Aug 28, 2025
ca2bf8d
[27.0] Update BCArtifact version. New value: bcinsider/Sandbox/27.0/b…
business-central-bot[bot] Aug 28, 2025
c95dbf4
[27.0] Bring back VAT Prod Posting Grp for SubscriptionBilling Item T…
haoranpb Aug 28, 2025
6b27c36
[releases/27.0] [Shopify] Catalog price sync fixes (#4584)
onbuyuka Aug 29, 2025
8a2b3ae
[27.0] Agents - Implementing the support for region and language (#4615)
nikolakukrika Aug 29, 2025
a4e9d92
[27.0] Update app baselines package version. New value: 26.4.37194.38…
business-central-bot[bot] Sep 2, 2025
7740a57
[releases/27.0] [Shopify] Refund processing improvements (#4625)
onbuyuka Sep 2, 2025
0b5a138
[27.0] Fix obsoletion in v27.0 for No Series (#4664)
haoranpb Sep 2, 2025
39f9e90
[releases/27.0] [Shopify] Add error to item creation when setting is …
onbuyuka Sep 4, 2025
5bf726f
[releases/27.0] [Shopify] Create customer as company locations improv…
onbuyuka Sep 4, 2025
ebfa51b
Subscription billing app conflicts with IRS Forms app (#4705)
ventselartur Sep 8, 2025
a79d9cc
[27.0] Update app baselines package version. New value: 26.5.38752.39…
business-central-bot[bot] Sep 9, 2025
fd03044
[Backport 27.0][Copilot] GA Analyze List (#4692) (#4734)
claudiuciumedean Sep 9, 2025
0bf6d3f
[releases/27.0] [Shopify] New event after creating Shopify order and …
onbuyuka Sep 11, 2025
33bc103
Bug 602448: [27.0] There is no method to compare old and current pass…
JesperSchulz Sep 11, 2025
d88f59e
[27.0] Update app baselines package version. New value: 26.5.38752.39…
business-central-bot[bot] Sep 16, 2025
1bab7d6
[27.0] Disable tests in Contract Renewal Test (#4817)
aholstrup1 Sep 19, 2025
c26899d
[27.0] Update app baselines package version. New value: 26.5.38752.39…
business-central-bot[bot] Sep 23, 2025
9feb46a
[27.0][AnalysisMode]: Include Add Related Fields permission in Basic …
claudiuciumedean Sep 23, 2025
6b82bdc
[releases/27.0] [Email] Add filter on time when counting email concur…
gggdttt Sep 26, 2025
488d928
[27.0] Update app baselines package version. New value: 26.5.38752.40…
business-central-bot[bot] Sep 30, 2025
2c81644
[27.0] Update BCArtifact version. New value: bcartifacts/Sandbox/27.0…
business-central-bot[bot] Oct 2, 2025
9950b0d
[releases/27.0] [Shopify] Replace deprecated shop.plan.displayName wi…
onbuyuka Oct 3, 2025
2e573d9
Init Value for Customer Contracts (#4873) (#4984)
AndersLarsenMicrosoft Oct 6, 2025
eeac226
[27.0] Update BCArtifact version. New value: bcartifacts/Sandbox/27.0…
business-central-bot[bot] Oct 6, 2025
6a2a818
[27.0] Update app baselines package version. New value: 26.5.38752.40…
business-central-bot[bot] Oct 7, 2025
517a7e3
[27.0] Incorrect Billing To Date for Billing Lines (#4621) (#5092)
djukicmilica Oct 8, 2025
d76567c
[27.0] Backport "Prepare for move of TaskPane objects to Platform sym…
hoovercj Oct 13, 2025
5301474
[27.0] Update app baselines package version. New value: 26.5.38752.40…
business-central-bot[bot] Oct 13, 2025
5bb3650
[27.0] Update app baselines package version. New value: 26.5.38752.40…
business-central-bot[bot] Oct 14, 2025
fc8da18
[releases/27.0] Update email status when email is rescheduled (#5176)
gggdttt Oct 15, 2025
957bf1c
[releases/27.0] [Shopify] Add missing fields to calcsum (#5160)
onbuyuka Oct 17, 2025
a6fcd0b
[27.0] Update app baselines package version. New value: 26.5.38752.41…
business-central-bot[bot] Oct 21, 2025
61f9559
[27.0] Update app baselines package version. New value: 26.5.38752.41…
business-central-bot[bot] Oct 28, 2025
23e7e43
[Backport] [27.0] Only Append Asterisk for Quote and Order (#5307)
pri-kise Oct 29, 2025
84dbc2e
[27.0] [Shopify] Do not send empty variant update request if there ar…
haoranpb Oct 29, 2025
7857554
[27.0] Update app baselines package version. New value: 26.5.38752.41…
business-central-bot[bot] Nov 4, 2025
c5457b5
[27.0] Update app baselines package version. New value: 26.5.38752.41…
business-central-bot[bot] Nov 11, 2025
9943a77
[27.0] Update app baselines package version. New value: 26.5.38752.42…
business-central-bot[bot] Nov 18, 2025
79886a5
[releases/27.0] Private/nhsejth/memory telemetry (#5569)
nhsejth Nov 19, 2025
81234e3
[27.0] Update app baselines package version. New value: 26.5.38752.42…
business-central-bot[bot] Nov 25, 2025
d247a7b
[releases/27.0] Disable UT_UpdateServiceDatesDoesNotCalculateCancella…
aholstrup1 Dec 2, 2025
5d1a073
[27.0] Update app baselines package version. New value: 26.5.38752.42…
business-central-bot[bot] Dec 3, 2025
43597a9
[27.0] Update app baselines package version. New value: 26.5.38752.43…
business-central-bot[bot] Dec 9, 2025
572ab37
[releases/27.0] [Shopify] Catalog products pagination is missing pric…
onbuyuka Dec 11, 2025
cb49f0e
[27.0] Update app baselines package version. New value: 26.5.38752.43…
business-central-bot[bot] Dec 16, 2025
7a6c59f
[27.0] Update app baselines package version. New value: 26.5.38752.44…
business-central-bot[bot] Jan 6, 2026
36d987f
Expose CreateVendorContractLineFromServiceCommitment
samra-singhammer Jan 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/AL-Go-Settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"runs-on": "windows-2025",
"cacheImageName": "",
"UsePsSession": false,
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/27.0.38415.0/base",
"artifact": "bcartifacts/Sandbox/27.0//latest",
"country": "base",
"useProjectDependencies": true,
"repoVersion": "27.0",
Expand All @@ -21,7 +21,8 @@
"CLEAN24",
"CLEAN25",
"CLEAN26",
"CLEAN27"
"CLEAN27",
"CLEAN28"
]
}
},
Expand Down
4 changes: 2 additions & 2 deletions build/Packages.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"Microsoft.Dynamics.BusinessCentral.Translations": {
"Version": "27.0.25230.2",
"Version": "27.0.25239.3",
"Source": "NuGet.org"
},
"AppBaselines-BCArtifacts": {
"Version": "26.5.38258.0",
"Version": "26.5.38752.44128",
"Source": "BCArtifacts",
"_comment": "Used to fetch app baselines from BC artifacts"
}
Expand Down
7 changes: 3 additions & 4 deletions src/Apps/W1/Shopify/App/src/Base/Tables/ShpfyShop.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -995,12 +995,11 @@ table 30102 "Shpfy Shop"
JItem: JsonToken;
begin
CommunicationMgt.SetShop(Rec);
JResponse := CommunicationMgt.ExecuteGraphQL('{"query":"query { shop { name plan { displayName partnerDevelopment shopifyPlus } weightUnit } }"}');
JResponse := CommunicationMgt.ExecuteGraphQL('{"query":"query { shop { name plan { publicDisplayName partnerDevelopment shopifyPlus } weightUnit } }"}');
if JResponse.SelectToken('$.data.shop.plan', JItem) then
if JItem.IsObject then
Rec."B2B Enabled" := JsonHelper.GetValueAsBoolean(JItem, 'partnerDevelopment') or
JsonHelper.GetValueAsBoolean(JItem, 'shopifyPlus') or
(JsonHelper.GetValueAsText(JItem, 'displayName') = 'Plus Trial');
Rec."B2B Enabled" := JsonHelper.GetValueAsBoolean(JItem, 'shopifyPlus') or
(JsonHelper.GetValueAsText(JItem, 'publicDisplayName') in ['Plus Trial', 'Development']);
Rec."Weight Unit" := ConvertToWeightUnit(JsonHelper.GetValueAsText(JResponse, 'data.shop.weightUnit'));
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,24 @@ codeunit 30290 "Shpfy Catalog API"
ShopifyMarketCatalogURLLbl: Label 'https://admin.shopify.com/store/%1/settings/markets/%2/pricing', Comment = '%1 - Shop Name, %2 - Market Catalog Id', Locked = true;
ShopifyUnifiedMarketCatalogURLLbl: Label 'https://admin.shopify.com/store/%1/catalogs/%2/editor', Comment = '%1 - Shop Name, %2 - Catalog Id', Locked = true;
CatalogNotFoundLbl: Label 'Catalog is not found.';
CurrencyMismatchLbl: Label 'Catalog currency does not match with Shopify. Reimport the catalog.';

internal procedure CreateCatalog(ShopifyCompany: Record "Shpfy Company"; Customer: Record Customer)
internal procedure CreateCatalog(LocationId: BigInteger; CatalogName: Text[500]; ShopifyCompany: Record "Shpfy Company"; Customer: Record Customer)
var
Catalog: Record "Shpfy Catalog";
GraphQLType: Enum "Shpfy GraphQL Type";
CatalogId: BigInteger;
JResponse: JsonToken;
Parameters: Dictionary of [Text, Text];
begin
Parameters.Add('Title', ShopifyCompany.Name);
Parameters.Add('CompanyLocationId', Format(ShopifyCompany."Location Id"));
Parameters.Add('Title', CatalogName);
Parameters.Add('CompanyLocationId', Format(LocationId));
JResponse := CommunicationMgt.ExecuteGraphQL(GraphQLType::CreateCatalog, Parameters);
CatalogId := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JResponse, 'data.catalogCreate.catalog.id'));
if CatalogId > 0 then begin
Catalog.Id := CatalogId;
Catalog."Shop Code" := Shop.Code;
Catalog.Name := ShopifyCompany.Name;
Catalog.Name := CatalogName;
Catalog."Company SystemId" := ShopifyCompany.SystemId;
Catalog."Customer No." := Customer."No.";
Catalog."Catalog Type" := CatalogType::Company;
Expand All @@ -51,6 +52,11 @@ codeunit 30290 "Shpfy Catalog API"
end;
end;

internal procedure CreateCatalog(ShopifyCompany: Record "Shpfy Company"; Customer: Record Customer)
begin
CreateCatalog(ShopifyCompany."Location Id", ShopifyCompany.Name, ShopifyCompany, Customer);
end;

internal procedure CreatePublication(var Catalog: Record "Shpfy Catalog")
var
GraphQLType: Enum "Shpfy GraphQL Type";
Expand Down Expand Up @@ -230,10 +236,12 @@ codeunit 30290 "Shpfy Catalog API"
internal procedure ExtractShopifyCatalogs(var ShopifyCompany: Record "Shpfy Company"; JResponse: JsonObject; var Cursor: Text): Boolean
var
Catalog: Record "Shpfy Catalog";
ImportOrder: Codeunit "Shpfy Import Order";
JCatalogs: JsonArray;
JEdge: JsonToken;
JNode: JsonObject;
CatalogId: BigInteger;
CurrencyCode: Text;
begin
if not JsonHelper.GetJsonArray(JResponse, JCatalogs, 'data.catalogs.edges') then
exit(false);
Expand All @@ -242,18 +250,19 @@ codeunit 30290 "Shpfy Catalog API"
Cursor := JsonHelper.GetValueAsText(JEdge.AsObject(), 'cursor');
if JsonHelper.GetJsonObject(JEdge.AsObject(), JNode, 'node') then begin
CatalogId := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JNode, 'id'));
CurrencyCode := JsonHelper.GetValueAsText(JNode, 'priceList.currency');
Catalog.SetRange(Id, CatalogId);
Catalog.SetRange("Company SystemId", ShopifyCompany.SystemId);
Catalog.SetRange("Catalog Type", "Shpfy Catalog Type"::Company);
if not Catalog.FindFirst() then begin
Catalog.Id := CatalogId;
Catalog."Company SystemId" := ShopifyCompany.SystemId;
Catalog."Sync Prices" := false;
Catalog."Catalog Type" := "Shpfy Catalog Type"::Company;
Catalog.Insert(true);
end;
Catalog."Shop Code" := Shop.Code;
Catalog.Name := CopyStr(JsonHelper.GetValueAsText(JNode, 'title'), 1, MaxStrLen(Catalog.Name));
Catalog."Currency Code" := ImportOrder.TranslateCurrencyCode(CurrencyCode);
Catalog.Modify(true);
end;
end;
Expand All @@ -263,6 +272,7 @@ codeunit 30290 "Shpfy Catalog API"
internal procedure ExtractShopifyMarketCatalogs(JResponse: JsonObject; var Cursor: Text): Boolean
var
Catalog: Record "Shpfy Catalog";
ImportOrder: Codeunit "Shpfy Import Order";
JCatalogs: JsonArray;
JEdge: JsonToken;
JNode: JsonObject;
Expand All @@ -286,7 +296,7 @@ codeunit 30290 "Shpfy Catalog API"
end;
Catalog."Shop Code" := Shop.Code;
Catalog.Name := CopyStr(JsonHelper.GetValueAsText(JNode, 'title'), 1, MaxStrLen(Catalog.Name));
Catalog."Currency Code" := CopyStr(CurrencyCode, 1, MaxStrLen(Catalog."Currency Code"));
Catalog."Currency Code" := ImportOrder.TranslateCurrencyCode(CurrencyCode);
Catalog.Modify(true);

GetMarketsLinkedToCatalog(Catalog);
Expand Down Expand Up @@ -385,17 +395,25 @@ codeunit 30290 "Shpfy Catalog API"

internal procedure ExtractShopifyCatalogProducts(var ProductList: List of [BigInteger]; JResponse: JsonObject; Catalog: Record "Shpfy Catalog"; var Cursor: Text): Boolean
var
ImportOrder: Codeunit "Shpfy Import Order";
JCatalogProducts: JsonArray;
JEdge: JsonToken;
JCatalog: JsonObject;
JNode: JsonObject;
ProductId: BigInteger;
CurrencyCode: Text;
begin
if not JsonHelper.GetJsonObject(JResponse, JCatalog, 'data.catalog') then begin
SkippedRecord.LogSkippedRecord(Catalog.Id, Catalog.RecordId, CatalogNotFoundLbl, Shop);
exit(false);
end;

CurrencyCode := JsonHelper.GetValueAsText(JCatalog, 'priceList.currency');
if Catalog."Currency Code" <> ImportOrder.TranslateCurrencyCode(CurrencyCode) then begin
SkippedRecord.LogSkippedRecord(Catalog.Id, Catalog.RecordId, CurrencyMismatchLbl, Shop);
exit(false);
end;

if JsonHelper.GetJsonArray(JCatalog, JCatalogProducts, 'publication.products.edges') then begin
foreach JEdge in JCatalogProducts do begin
Cursor := JsonHelper.GetValueAsText(JEdge.AsObject(), 'cursor');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ page 30159 "Shpfy Catalogs"
Editable = false;
}
field(SyncPrices; Rec."Sync Prices") { }
field("Currency Code"; Rec."Currency Code")
{
Editable = false;
}
field(CustomerPriceGroup; Rec."Customer Price Group") { }
field(CustomerDiscountGroup; Rec."Customer Discount Group") { }
field("Prices Including VAT"; Rec."Prices Including VAT") { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ page 30174 "Shpfy Market Catalogs"
field(Id; Rec.Id) { }
field(Name; Rec.Name) { }
field(SyncPrices; Rec."Sync Prices") { }
field("Customer No."; Rec."Customer No.") { }
field("Currency Code"; Rec."Currency Code") { }
#if not CLEAN28
field("Customer No."; Rec."Customer No.")
{
Visible = false;
ObsoleteReason = 'Customer No. is not used for market catalogs.';
ObsoleteState = Pending;
ObsoleteTag = '28.0';
}
#endif
field("Currency Code"; Rec."Currency Code")
{
Editable = false;
}
field(CustomerPriceGroup; Rec."Customer Price Group") { }
field(CustomerDiscountGroup; Rec."Customer Discount Group") { }
field("Prices Including VAT"; Rec."Prices Including VAT") { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ codeunit 30286 "Shpfy Company API"
CompanyContactRoles.Add(JsonHelper.GetValueAsText(JItem, 'node.name'), CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JItem, 'node.id')));
end;
if ShopifyCompany.Id > 0 then begin
CompanyContactId := AssignCompanyMainContact(ShopifyCompany.Id, ShopifyCustomer.Id, ShopifyCompany."Location Id", CompanyContactRoles);
CompanyContactId := AssignCompanyContact(ShopifyCompany.Id, ShopifyCustomer.Id, ShopifyCompany."Location Id", CompanyContactRoles, true);
ShopifyCompany."Main Contact Id" := CompanyContactId;
exit(true);
end else
Expand Down Expand Up @@ -156,7 +156,7 @@ codeunit 30286 "Shpfy Company API"
exit(GraphQuery.ToText());
end;

local procedure AssignCompanyMainContact(CompanyId: BigInteger; CustomerId: BigInteger; LocationId: BigInteger; CompanyContactRoles: Dictionary of [Text, BigInteger]): BigInteger
local procedure AssignCompanyContact(CompanyId: BigInteger; CustomerId: BigInteger; LocationId: BigInteger; CompanyContactRoles: Dictionary of [Text, BigInteger]; IsMainContact: Boolean): BigInteger
var
GraphQLType: Enum "Shpfy GraphQL Type";
JResponse: JsonToken;
Expand All @@ -168,10 +168,12 @@ codeunit 30286 "Shpfy Company API"
JResponse := CommunicationMgt.ExecuteGraphQL(GraphQLType::CompanyAssignCustomerAsContact, Parameters);
CompanyContactId := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JResponse, 'data.companyAssignCustomerAsContact.companyContact.id'));
if CompanyContactId > 0 then begin
Clear(Parameters);
Parameters.Add('CompanyId', Format(CompanyId));
Parameters.Add('CompanyContactId', Format(CompanyContactId));
JResponse := CommunicationMgt.ExecuteGraphQL(GraphQLType::CompanyAssignMainContact, Parameters);
if IsMainContact then begin
Clear(Parameters);
Parameters.Add('CompanyId', Format(CompanyId));
Parameters.Add('CompanyContactId', Format(CompanyContactId));
JResponse := CommunicationMgt.ExecuteGraphQL(GraphQLType::CompanyAssignMainContact, Parameters);
end;
AssignCompanyContactRoles(CompanyContactId, LocationId, CompanyContactRoles);
end;
exit(CompanyContactId);
Expand Down Expand Up @@ -420,7 +422,9 @@ codeunit 30286 "Shpfy Company API"
internal procedure CreateCompanyLocation(Customer: Record Customer)
var
ShopifyCompany: Record "Shpfy Company";
ShopifyCustomer: Record "Shpfy Customer";
CompanyLocation: Record "Shpfy Company Location";
CompanyExport: Codeunit "Shpfy Company Export";
SkippedRecord: Codeunit "Shpfy Skipped Record";
CustomerAlreadyExportedCompanyLbl: Label 'Customer %1 is already exported as a company', Comment = '%1 = Customer No.';
CustomerAlreadyExportedLocationLbl: Label 'Customer %1 is already exported as a location', Comment = '%1 = Customer No.';
Expand All @@ -436,7 +440,9 @@ codeunit 30286 "Shpfy Company API"
SkippedRecord.LogSkippedRecord(Customer.RecordId, StrSubstNo(CustomerAlreadyExportedLocationLbl, Customer."No."), Shop);
exit;
end;
CreateCustomerAsCompanyLocation(Customer, this.Company);
CompanyExport.SetShop(Shop.Code);
if CompanyExport.CreateCompanyContact(Customer, ShopifyCustomer) then
CreateCustomerAsCompanyLocation(Customer, this.Company, ShopifyCustomer);
end;

internal procedure SetCompany(ShopifyCompany: Record "Shpfy Company")
Expand All @@ -448,8 +454,9 @@ codeunit 30286 "Shpfy Company API"
/// Creates a customer as a company location in Shopify using GraphQL API.
/// This procedure handles the API communication and error processing.
/// </summary>
/// <param name="CompanyLocation">The Shopify company location record containing the data to be sent to Shopify.</param>
/// <param name="Customer">The Business Central customer record used to populate additional fields.</param>
/// <param name="ShopifyCompany">The Shopify company record used to populate additional fields.</param>
/// <param name="ShopifyCustomer">The Shopify customer record used to populate additional fields.</param>
/// <remarks>
/// This procedure:
/// - Fills the Shopify company location with data from the customer
Expand All @@ -461,13 +468,18 @@ codeunit 30286 "Shpfy Company API"
/// The procedure supports both billing and shipping addresses, with billing address used for both when billingSameAsShipping is true.
/// Error handling includes field-specific error messages from Shopify API.
/// </remarks>
local procedure CreateCustomerAsCompanyLocation(Customer: Record Customer; ShopifyCompany: Record "Shpfy Company")
internal procedure CreateCustomerAsCompanyLocation(Customer: Record Customer; ShopifyCompany: Record "Shpfy Company"; ShopifyCustomer: Record "Shpfy Customer")
var
CompanyLocation: Record "Shpfy Company Location";
CompanyExport: Codeunit "Shpfy Company Export";
CatalogAPI: Codeunit "Shpfy Catalog API";
GraphQuery: TextBuilder;
JResponse: JsonToken;
JCompanyLocation: JsonToken;
JContactRoles: JsonArray;
JItem: JsonToken;
LocationId: BigInteger;
CompanyContactRoles: Dictionary of [Text, BigInteger];
CompanyIdTxt: Label 'gid://shopify/Company/%1', Comment = '%1 = Company Id', Locked = true;
PaymentTermsTemplateIdTxt: Label 'gid://shopify/PaymentTermsTemplate/%1', Comment = '%1 = Payment Terms Template Id', Locked = true;
begin
Expand All @@ -476,8 +488,6 @@ codeunit 30286 "Shpfy Company API"

GraphQuery.Append('{"query": "mutation { companyLocationCreate( companyId: \"' + StrSubstNo(CompanyIdTxt, ShopifyCompany.Id) + '\", input: {');

if ShopifyCompany."External Id" <> '' then
AddFieldToGraphQuery(GraphQuery, 'externalId', ShopifyCompany."External Id");
if CompanyLocation.Name <> '' then
AddFieldToGraphQuery(GraphQuery, 'name', CompanyLocation.Name);
if CompanyLocation."Phone No." <> '' then
Expand Down Expand Up @@ -505,15 +515,23 @@ codeunit 30286 "Shpfy Company API"
if CompanyLocation."Shpfy Payment Terms Id" <> 0 then
AddFieldToGraphQuery(GraphQuery, 'paymentTermsTemplateId', StrSubstNo(PaymentTermsTemplateIdTxt, CompanyLocation."Shpfy Payment Terms Id"));
GraphQuery.Remove(GraphQuery.Length - 1, 2);
GraphQuery.Append('}}) { companyLocation { id name billingAddress { address1 address2 city countryCode phone province recipient zip zoneCode } ');
GraphQuery.Append('}}) { companyLocation { id name company { contactRoles(first:10) {edges {node {id name}}}} billingAddress { address1 address2 city countryCode phone province recipient zip zoneCode } ');
GraphQuery.Append('shippingAddress { address1 address2 city countryCode phone province recipient zip zoneCode } ');
GraphQuery.Append('buyerExperienceConfiguration { paymentTermsTemplate { id } checkoutToDraft editableShippingAddress } taxRegistrationId taxExemptions } ');
GraphQuery.Append('userErrors { field message } } }"}');

JResponse := CommunicationMgt.ExecuteGraphQL(GraphQuery.ToText());
if JResponse.SelectToken('$.data.companyLocationCreate.companyLocation', JCompanyLocation) then
if not JsonHelper.IsTokenNull(JCompanyLocation) then
CreateCustomerLocation(JCompanyLocation.AsObject(), ShopifyCompany, Customer.SystemId);
if not JsonHelper.IsTokenNull(JCompanyLocation) then begin
LocationId := CreateCustomerLocation(JCompanyLocation.AsObject(), ShopifyCompany, Customer.SystemId);
if JsonHelper.GetJsonArray(JCompanyLocation, JContactRoles, 'company.contactRoles.edges') then begin
foreach JItem in JContactRoles do
CompanyContactRoles.Add(JsonHelper.GetValueAsText(JItem, 'node.name'), CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JItem, 'node.id')));
AssignCompanyContact(ShopifyCompany.Id, ShopifyCustomer.Id, LocationId, CompanyContactRoles, false);
if Shop."Auto Create Catalog" then
CatalogAPI.CreateCatalog(LocationId, Customer.Name, ShopifyCompany, Customer);
end;
end;
end;

/// <summary>
Expand All @@ -534,7 +552,7 @@ codeunit 30286 "Shpfy Company API"
/// The procedure assumes the JSON structure matches Shopify's companyLocationCreate response format.
/// All text fields are properly truncated to match the field lengths in the table definition.
/// </remarks>
local procedure CreateCustomerLocation(JCompanyLocation: JsonObject; ShopifyCompany: Record "Shpfy Company"; CustomerId: Guid)
local procedure CreateCustomerLocation(JCompanyLocation: JsonObject; ShopifyCompany: Record "Shpfy Company"; CustomerId: Guid): BigInteger
var
CompanyLocation: Record "Shpfy Company Location";
CompanyLocationId: BigInteger;
Expand Down Expand Up @@ -564,6 +582,7 @@ codeunit 30286 "Shpfy Company API"
CompanyLocation."Shpfy Payment Terms Id" := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JCompanyLocation, 'buyerExperienceConfiguration.paymentTermsTemplate.id'));
CompanyLocation."Customer Id" := CustomerId;
CompanyLocation.Modify(true);
exit(CompanyLocationId);
end;

local procedure ExtractShopifyCompanyLocations(var ShopifyCompany: Record "Shpfy Company"; JResponse: JsonObject; var Cursor: Text; var IsDefaultCompanyLocation: Boolean): Boolean
Expand Down
Loading
Loading