Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ codeunit 30206 "Shpfy GQL NextOpenOrdToImport" implements "Shpfy IGraphQL"

internal procedure GetGraphQL(): Text
begin
exit('{"query": "{orders(first:150, after:\"{{After}}\", query: \"status:open updated_at:>''{{Time}}''\"){pageInfo{hasNextPage} edges{cursor node{legacyResourceId name createdAt updatedAt channel { name } test fullyPaid unpaid displayFinancialStatus displayFulfillmentStatus subtotalLineItemsQuantity totalPriceSet{shopMoney{amount currencyCode}} customAttributes{key value} tags risk { assessments { riskLevel }} displayAddress { countryCodeV2 } shippingAddress { countryCodeV2 } billingAddress { countryCodeV2 } totalTaxSet { presentmentMoney { amount } shopMoney { amount } } purchasingEntity { ... on PurchasingCompany { company { id }}}}}}}"}');
exit('{"query": "{orders(first:150, after:\"{{After}}\", query: \"status:open updated_at:>''{{Time}}''\"){pageInfo{hasNextPage} edges{cursor node{legacyResourceId name createdAt updatedAt channel { name } test fullyPaid unpaid displayFinancialStatus displayFulfillmentStatus subtotalLineItemsQuantity totalPriceSet{shopMoney{amount currencyCode}} customAttributes{key value} tags risk { assessments { riskLevel }} displayAddress { countryCodeV2 } shippingAddress { countryCodeV2 } billingAddress { countryCodeV2 } totalTaxSet { presentmentMoney { amount } shopMoney { amount } } taxLines { channelLiable } purchasingEntity { ... on PurchasingCompany { company { id }}}}}}}"}');
end;

internal procedure GetExpectedCost(): Integer
begin
exit(602);
exit(612);
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ codeunit 30138 "Shpfy GQL NextOrdersToImport" implements "Shpfy IGraphQL"
/// <returns>Return value of type Text.</returns>
internal procedure GetGraphQL(): Text
begin
exit('{"query": "{orders(first:25, after:\"{{After}}\", query: \"updated_at:>''{{Time}}''\"){ pageInfo { hasNextPage } edges { cursor node { legacyResourceId name createdAt updatedAt channel { name } test fullyPaid unpaid closed displayFinancialStatus displayFulfillmentStatus subtotalLineItemsQuantity totalPriceSet { shopMoney { amount currencyCode } } customAttributes { key value } tags risk { assessments { riskLevel }} displayAddress { countryCodeV2 } shippingAddress { countryCodeV2 } billingAddress { countryCodeV2 } totalTaxSet { presentmentMoney { amount } shopMoney { amount } } purchasingEntity { ... on PurchasingCompany { company { id }}}}}}}"}');
exit('{"query": "{orders(first:25, after:\"{{After}}\", query: \"updated_at:>''{{Time}}''\"){ pageInfo { hasNextPage } edges { cursor node { legacyResourceId name createdAt updatedAt channel { name } test fullyPaid unpaid closed displayFinancialStatus displayFulfillmentStatus subtotalLineItemsQuantity totalPriceSet { shopMoney { amount currencyCode } } customAttributes { key value } tags risk { assessments { riskLevel }} displayAddress { countryCodeV2 } shippingAddress { countryCodeV2 } billingAddress { countryCodeV2 } totalTaxSet { presentmentMoney { amount } shopMoney { amount } } taxLines { channelLiable } purchasingEntity { ... on PurchasingCompany { company { id }}}}}}}"}');
end;

/// <summary>
Expand All @@ -27,6 +27,6 @@ codeunit 30138 "Shpfy GQL NextOrdersToImport" implements "Shpfy IGraphQL"
/// <returns>Return value of type Integer.</returns>
internal procedure GetExpectedCost(): Integer
begin
exit(153);
exit(159);
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ codeunit 30222 "Shpfy GQL NextShipmentLines" implements "Shpfy IGraphQL"
{
internal procedure GetGraphQL(): Text
begin
exit('{"query":"{order(id: \"gid://shopify/Order/{{OrderId}}\") {shippingLines(first: 10, after:\"{{After}}\") { pageInfo { endCursor hasNextPage } nodes { id title code source discountAllocations { allocatedAmountSet { presentmentMoney { amount } shopMoney { amount }}} originalPriceSet { presentmentMoney { amount } shopMoney { amount }} discountedPriceSet { presentmentMoney { amount } shopMoney { amount }} taxLines { title rate ratePercentage priceSet { presentmentMoney { amount } shopMoney {amount}}}}}}}"}');
exit('{"query":"{order(id: \"gid://shopify/Order/{{OrderId}}\") {shippingLines(first: 10, after:\"{{After}}\") { pageInfo { endCursor hasNextPage } nodes { id title code source discountAllocations { allocatedAmountSet { presentmentMoney { amount } shopMoney { amount }}} originalPriceSet { presentmentMoney { amount } shopMoney { amount }} discountedPriceSet { presentmentMoney { amount } shopMoney { amount }} taxLines { channelLiable title rate ratePercentage priceSet { presentmentMoney { amount } shopMoney {amount}}}}}}}"}');
end;

internal procedure GetExpectedCost(): Integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ codeunit 30205 "Shpfy GQL OpenOrdersToImport" implements "Shpfy IGraphQL"

internal procedure GetGraphQL(): Text
begin
exit('{"query": "{orders(first:25, query: \"status:open updated_at:>''{{Time}}''\"){ pageInfo { hasNextPage } edges { cursor node { legacyResourceId name createdAt updatedAt channel { name } test fullyPaid unpaid displayFinancialStatus displayFulfillmentStatus subtotalLineItemsQuantity totalPriceSet { shopMoney { amount currencyCode } } customAttributes { key value } tags risk { assessments { riskLevel }} displayAddress { countryCodeV2 } shippingAddress { countryCodeV2 } billingAddress { countryCodeV2 } totalTaxSet { presentmentMoney { amount } shopMoney { amount } } purchasingEntity { ... on PurchasingCompany { company { id }}}}}}}"}');
exit('{"query": "{orders(first:25, query: \"status:open updated_at:>''{{Time}}''\"){ pageInfo { hasNextPage } edges { cursor node { legacyResourceId name createdAt updatedAt channel { name } test fullyPaid unpaid displayFinancialStatus displayFulfillmentStatus subtotalLineItemsQuantity totalPriceSet { shopMoney { amount currencyCode } } customAttributes { key value } tags risk { assessments { riskLevel }} displayAddress { countryCodeV2 } shippingAddress { countryCodeV2 } billingAddress { countryCodeV2 } totalTaxSet { presentmentMoney { amount } shopMoney { amount } } taxLines { channelLiable } purchasingEntity { ... on PurchasingCompany { company { id }}}}}}}"}');
end;

internal procedure GetExpectedCost(): Integer
begin
exit(152);
exit(158);
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ codeunit 30145 "Shpfy GQL OrdersToImport" implements "Shpfy IGraphQL"
/// <returns>Return value of type Text.</returns>
internal procedure GetGraphQL(): Text
begin
exit('{"query": "{orders(first:25, query: \"updated_at:>''{{Time}}''\"){pageInfo{hasNextPage} edges{cursor node{legacyResourceId name createdAt updatedAt channel { name } test fullyPaid unpaid closed displayFinancialStatus displayFulfillmentStatus subtotalLineItemsQuantity totalPriceSet{shopMoney{amount currencyCode}} customAttributes{key value} tags risk { assessments { riskLevel }} displayAddress { countryCodeV2 } shippingAddress { countryCodeV2 } billingAddress { countryCodeV2 } totalTaxSet { presentmentMoney { amount } shopMoney { amount } } purchasingEntity { ... on PurchasingCompany { company { id }}}}}}}"}');
exit('{"query": "{orders(first:25, query: \"updated_at:>''{{Time}}''\"){pageInfo{hasNextPage} edges{cursor node{legacyResourceId name createdAt updatedAt channel { name } test fullyPaid unpaid closed displayFinancialStatus displayFulfillmentStatus subtotalLineItemsQuantity totalPriceSet{shopMoney{amount currencyCode}} customAttributes{key value} tags risk { assessments { riskLevel }} displayAddress { countryCodeV2 } shippingAddress { countryCodeV2 } billingAddress { countryCodeV2 } totalTaxSet { presentmentMoney { amount } shopMoney { amount } } taxLines { channelLiable } purchasingEntity { ... on PurchasingCompany { company { id }}}}}}}"}');
end;

/// <summary>
Expand All @@ -27,6 +27,6 @@ codeunit 30145 "Shpfy GQL OrdersToImport" implements "Shpfy IGraphQL"
/// <returns>Return value of type Integer.</returns>
internal procedure GetExpectedCost(): Integer
begin
exit(153);
exit(159);
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ codeunit 30216 "Shpfy GQL ShipmentLines" implements "Shpfy IGraphQL"
{
internal procedure GetGraphQL(): Text
begin
exit('{"query":"{order(id: \"gid://shopify/Order/{{OrderId}}\") {shippingLines(first: 10) { pageInfo { endCursor hasNextPage } nodes { id title code source discountAllocations { allocatedAmountSet { presentmentMoney { amount } shopMoney { amount }}} originalPriceSet { presentmentMoney { amount } shopMoney { amount }} discountedPriceSet { presentmentMoney { amount } shopMoney { amount }} taxLines { title rate ratePercentage priceSet { presentmentMoney { amount } shopMoney {amount}}}}}}}"}');
exit('{"query":"{order(id: \"gid://shopify/Order/{{OrderId}}\") {shippingLines(first: 10) { pageInfo { endCursor hasNextPage } nodes { id title code source discountAllocations { allocatedAmountSet { presentmentMoney { amount } shopMoney { amount }}} originalPriceSet { presentmentMoney { amount } shopMoney { amount }} discountedPriceSet { presentmentMoney { amount } shopMoney { amount }} taxLines { channelLiable title rate ratePercentage priceSet { presentmentMoney { amount } shopMoney {amount}}}}}}}"}');
end;

internal procedure GetExpectedCost(): Integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ codeunit 30161 "Shpfy Import Order"
JsonHelper.GetValueIntoField(JToken, 'ratePercentage', RecordRef, OrderTaxLine.FieldNo("Rate %"));
JsonHelper.GetValueIntoField(JToken, 'priceSet.shopMoney.amount', RecordRef, OrderTaxLine.FieldNo(Amount));
JsonHelper.GetValueIntoField(JToken, 'priceSet.presentmentMoney.amount', RecordRef, OrderTaxLine.FieldNo("Presentment Amount"));
JsonHelper.GetValueIntoField(JToken, 'channelLiable', RecordRef, OrderTaxLine.FieldNo("Channel Liable"));
RecordRef.Insert(true);
RecordRef.Close();
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ codeunit 30165 "Shpfy Orders API"
OrdersToImport.Tags := CopyStr(Tags.ToText(), 2, MaxStrLen(OrdersToImport.Tags));
end;
OrdersToImport."High Risk" := IsHighRiskOrder(JNode);
OrdersToImport."Channel Liable Taxes" := ContainsChannelLiableTax(JNode);
OrderHeader.SetRange("Shopify Order Id", Id);
if OrderHeader.IsEmpty then
OrdersToImport."Import Action" := OrdersToImport."Import Action"::New
Expand Down Expand Up @@ -307,4 +308,22 @@ codeunit 30165 "Shpfy Orders API"
exit(true);
end;
end;
}

local procedure ContainsChannelLiableTax(JOrder: JsonObject): Boolean
var
JTaxLines: JsonArray;
JTaxLine: JsonToken;
begin
if not JsonHelper.GetJsonArray(JOrder, JTaxLines, 'taxLines') then
exit(false);

if JTaxLines.Count() = 0 then
exit(false);

if not JTaxLines.Get(0, JTaxLine) then
exit(false);

// Shopify keeps channelLiable consistent across tax lines, so checking the first entry is sufficient.
exit(JsonHelper.GetValueAsBoolean(JTaxLine, 'channelLiable'));
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,13 @@ page 30113 "Shpfy Order"
ApplicationArea = All;
ToolTip = 'Specifies if tax is included in the unit price.';
}
field("Channel Liable Taxes"; Rec."Channel Liable Taxes")
{
ApplicationArea = All;
Editable = false;
ToolTip = 'Specifies if any tax line on the order is liable to be charged by the sales channel.';
}

field(CurrencyCode; Rec."Currency Code")
{
ApplicationArea = All;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ page 30168 "Shpfy Order Tax Lines"
ApplicationArea = All;
ToolTip = 'Specifies the rate percentage of the tax line.';
}
field("Channel Liable"; Rec."Channel Liable")
{
ApplicationArea = All;
ToolTip = 'Specifies if the channel that submitted the tax line is liable for remitting.';
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ page 30115 "Shpfy Orders"
ToolTip = 'Specifies the name of the app used by the channel where you sell your products. A channel can be a platform or a marketplace such as an online store or POS.';
Visible = false;
}
field("Channel Liable Taxes"; Rec."Channel Liable Taxes")
{
ApplicationArea = All;
ToolTip = 'Specifies if any tax line on the order is liable to be charged by the channel.';
Visible = false;
}
field(CancelReason; Rec."Cancel Reason")
{
ApplicationArea = All;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ page 30121 "Shpfy Orders to Import"
ApplicationArea = All;
ToolTip = 'Specifies the order''s status in terms of fulfilled line items. Valid values are: Fulfilled, null, partial, restocked.';
}
field("Channel Liable Taxes"; Rec."Channel Liable Taxes")
{
ApplicationArea = All;
ToolTip = 'Specifies if any tax line on the order is liable to be collected by the sales channel.';
}
field(ChannelName; Rec."Channel Name")
{
ApplicationArea = All;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ report 30104 "Shpfy Sync Orders from Shopify"
{
DataItemLink = "Shop Code" = field(Code);
DataItemLinkReference = Shop;
RequestFilterFields = "Fully Paid", "Financial Status", "Fulfillment Status", Confirmed, "Import Action", "Attribute Key Filter", "Attribute Key Exists", "Channel Name", "Order No.", "High Risk", "Sell-to Country/Region Code", "Ship-to Country/Region Code", "Bill-to Country/Region Code", "VAT Amount";
RequestFilterFields = "Fully Paid", "Financial Status", "Fulfillment Status", Confirmed, "Import Action", "Attribute Key Filter", "Attribute Key Exists", "Channel Name", "Channel Liable Taxes", "Order No.", "High Risk", "Sell-to Country/Region Code", "Ship-to Country/Region Code", "Bill-to Country/Region Code", "VAT Amount";

trigger OnPreDataItem()
var
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,13 @@ table 30118 "Shpfy Order Header"
AutoFormatType = 1;
AutoFormatExpression = "Currency Code";
}
field(134; "Channel Liable Taxes"; Boolean)
{
Caption = 'Channel Liable Taxes';
Editable = false;
FieldClass = FlowField;
CalcFormula = exist("Shpfy Order Tax Line" where("Parent Id" = field("Shopify Order Id"), "Channel Liable" = const(true)));
}
field(500; "Shop Code"; Code[20])
{
Caption = 'Shop Code';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ table 30122 "Shpfy Order Tax Line"
Editable = false;
AutoFormatType = 0;
}
field(9; "Channel Liable"; Boolean)
{
Caption = 'Channel Liable';
DataClassification = SystemMetadata;
Editable = false;
}
}
keys
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ table 30121 "Shpfy Orders to Import"
AutoFormatType = 1;
AutoFormatExpression = "Currency Code";
}
field(30; "Channel Liable Taxes"; Boolean)
{
Caption = 'Channel Liable Taxes';
DataClassification = SystemMetadata;
Editable = false;
}
field(100; "Import Action"; Enum "Shpfy Import Action")
{
Caption = 'Import Action';
Expand Down
Loading
Loading