diff --git a/src/Apps/W1/Shopify/App/src/GraphQL/Codeunits/ShpfyGQLNextOpenFFOrderLines.Codeunit.al b/src/Apps/W1/Shopify/App/src/GraphQL/Codeunits/ShpfyGQLNextOpenFFOrderLines.Codeunit.al index 0f23d32578..fee6a16f0f 100644 --- a/src/Apps/W1/Shopify/App/src/GraphQL/Codeunits/ShpfyGQLNextOpenFFOrderLines.Codeunit.al +++ b/src/Apps/W1/Shopify/App/src/GraphQL/Codeunits/ShpfyGQLNextOpenFFOrderLines.Codeunit.al @@ -15,7 +15,7 @@ codeunit 30237 "Shpfy GQL NextOpenFFOrderLines" implements "Shpfy IGraphQL" /// Return value of type Text. internal procedure GetGraphQL(): Text begin - exit('{"query":"{fulfillmentOrder(id: \"gid:\/\/shopify\/FulfillmentOrder\/{{FulfillmentOrderId}}\") {lineItems(first: 25, after:\"{{After}}\") {pageInfo {hasNextPage} edges {cursor node {id totalQuantity remainingQuantity lineItem {product {legacyResourceId} variant {legacyResourceId}}}}}}}"}'); + exit('{"query":"{fulfillmentOrder(id: \"gid:\/\/shopify\/FulfillmentOrder\/{{FulfillmentOrderId}}\") {lineItems(first: 25, after:\"{{After}}\") {pageInfo {hasNextPage} edges {cursor node {id totalQuantity remainingQuantity lineItem {id product {legacyResourceId} variant {legacyResourceId}}}}}}}"}'); end; /// diff --git a/src/Apps/W1/Shopify/App/src/GraphQL/Codeunits/ShpfyGQLOpenFulfillmOrdLines.Codeunit.al b/src/Apps/W1/Shopify/App/src/GraphQL/Codeunits/ShpfyGQLOpenFulfillmOrdLines.Codeunit.al index 31334a79ac..7e913fce20 100644 --- a/src/Apps/W1/Shopify/App/src/GraphQL/Codeunits/ShpfyGQLOpenFulfillmOrdLines.Codeunit.al +++ b/src/Apps/W1/Shopify/App/src/GraphQL/Codeunits/ShpfyGQLOpenFulfillmOrdLines.Codeunit.al @@ -15,7 +15,7 @@ codeunit 30235 "Shpfy GQL OpenFulfillmOrdLines" implements "Shpfy IGraphQL" /// Return value of type Text. internal procedure GetGraphQL(): Text begin - exit('{"query":"{fulfillmentOrder(id: \"gid:\/\/shopify\/FulfillmentOrder\/{{FulfillmentOrderId}}\") {lineItems(first: 25) {pageInfo {hasNextPage} edges {cursor node {id totalQuantity remainingQuantity lineItem {product {legacyResourceId} variant {legacyResourceId}}}}}}}"}'); + exit('{"query":"{fulfillmentOrder(id: \"gid:\/\/shopify\/FulfillmentOrder\/{{FulfillmentOrderId}}\") {lineItems(first: 25) {pageInfo {hasNextPage} edges {cursor node {id totalQuantity remainingQuantity lineItem {id product {legacyResourceId} variant {legacyResourceId}}}}}}}"}'); end; /// diff --git a/src/Apps/W1/Shopify/App/src/Order Fulfillments/Codeunits/ShpfyFulfillmentOrdersAPI.Codeunit.al b/src/Apps/W1/Shopify/App/src/Order Fulfillments/Codeunits/ShpfyFulfillmentOrdersAPI.Codeunit.al index 4eaf787e78..f1768932e9 100644 --- a/src/Apps/W1/Shopify/App/src/Order Fulfillments/Codeunits/ShpfyFulfillmentOrdersAPI.Codeunit.al +++ b/src/Apps/W1/Shopify/App/src/Order Fulfillments/Codeunits/ShpfyFulfillmentOrdersAPI.Codeunit.al @@ -126,6 +126,7 @@ codeunit 30238 "Shpfy Fulfillment Orders API" FulfillmentOrderLine."Shopify Order Id" := FulfillmentOrderHeader."Shopify Order Id"; FulfillmentOrderLine."Shopify Location Id" := FulfillmentOrderHeader."Shopify Location Id"; FulfillmentOrderLine."Delivery Method Type" := FulfillmentOrderHeader."Delivery Method Type"; + FulfillmentOrderLine."Line Item Id" := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JNode, 'lineItem.id')); FulfillmentOrderLine."Shopify Product Id" := JsonHelper.GetValueAsBigInteger(JNode, 'lineItem.product.legacyResourceId'); FulfillmentOrderLine."Shopify Variant Id" := JsonHelper.GetValueAsBigInteger(JNode, 'lineItem.variant.legacyResourceId'); FulfillmentOrderLine."Total Quantity" := JsonHelper.GetValueAsDecimal(JNode, 'totalQuantity'); @@ -143,6 +144,10 @@ codeunit 30238 "Shpfy Fulfillment Orders API" Modified := true; FulfillmentOrderLine."Shopify Location Id" := FulfillmentOrderHeader."Shopify Location Id"; end; + if FulfillmentOrderLine."Line Item Id" <> CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JNode, 'lineItem.id')) then begin + Modified := true; + FulfillmentOrderLine."Line Item Id" := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JNode, 'lineItem.id')); + end; if FulfillmentOrderLine."Delivery Method Type" <> FulfillmentOrderHeader."Delivery Method Type" then begin Modified := true; FulfillmentOrderLine."Delivery Method Type" := FulfillmentOrderHeader."Delivery Method Type"; diff --git a/src/Apps/W1/Shopify/App/src/Order Fulfillments/Tables/ShpfyFulFillmentOrderLine.Table.al b/src/Apps/W1/Shopify/App/src/Order Fulfillments/Tables/ShpfyFulFillmentOrderLine.Table.al index 343068a53b..6b7188b52e 100644 --- a/src/Apps/W1/Shopify/App/src/Order Fulfillments/Tables/ShpfyFulFillmentOrderLine.Table.al +++ b/src/Apps/W1/Shopify/App/src/Order Fulfillments/Tables/ShpfyFulFillmentOrderLine.Table.al @@ -69,6 +69,11 @@ table 30144 "Shpfy FulFillment Order Line" { DataClassification = CustomerContent; } + field(12; "Line Item Id"; BigInteger) + { + Caption = 'Line Item Id'; + DataClassification = SystemMetadata; + } } keys { @@ -82,5 +87,8 @@ table 30144 "Shpfy FulFillment Order Line" key(Key3; "Shopify Order Id", "Shopify Variant Id", "Fulfillment Status") { } + key(Key4; "Shopify Order Id", "Line Item Id") + { + } } } \ No newline at end of file diff --git a/src/Apps/W1/Shopify/App/src/Order handling/Codeunits/ShpfyImportOrder.Codeunit.al b/src/Apps/W1/Shopify/App/src/Order handling/Codeunits/ShpfyImportOrder.Codeunit.al index 8ef77af2ce..0f9baddf9a 100644 --- a/src/Apps/W1/Shopify/App/src/Order handling/Codeunits/ShpfyImportOrder.Codeunit.al +++ b/src/Apps/W1/Shopify/App/src/Order handling/Codeunits/ShpfyImportOrder.Codeunit.al @@ -904,9 +904,9 @@ codeunit 30161 "Shpfy Import Order" begin FulfillmentOrderLine.Reset(); FulfillmentOrderLine.SetRange("Shopify Order Id", OrderLine."Shopify Order Id"); - FulfillmentOrderLine.SetRange("Shopify Variant Id", OrderLine."Shopify Variant Id"); + FulfillmentOrderLine.SetRange("Line Item Id", OrderLine."Line Id"); FulfillmentOrderLine.SetFilter("Fulfillment Status", '<>%1', 'CLOSED'); - if FulfillmentOrderLine.FindSet() then + if not FulfillmentOrderLine.IsEmpty() then UpdateLocationIdAndDeliveryMethodOnOrderLines(OrderLine, FulfillmentOrderLine) else begin FulfillmentOrderLine.SetRange("Fulfillment Status"); diff --git a/src/Apps/W1/Shopify/App/src/PermissionSets/ShpfyObjects.PermissionSet.al b/src/Apps/W1/Shopify/App/src/PermissionSets/ShpfyObjects.PermissionSet.al index a95327891b..3b9322a1c9 100644 --- a/src/Apps/W1/Shopify/App/src/PermissionSets/ShpfyObjects.PermissionSet.al +++ b/src/Apps/W1/Shopify/App/src/PermissionSets/ShpfyObjects.PermissionSet.al @@ -495,6 +495,5 @@ permissionset 30104 "Shpfy - Objects" page "Shpfy Tax Areas" = X, page "Shpfy Transaction Gateways" = X, page "Shpfy Transactions" = X, - page "Shpfy Variants" = X, - query "Shpfy Shipment Location" = X; + page "Shpfy Variants" = X; } \ No newline at end of file diff --git a/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al b/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al index 6160dcd402..5c022e6431 100644 --- a/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al +++ b/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al @@ -31,18 +31,6 @@ codeunit 30190 "Shpfy Export Shipments" /// Parameter of type Record "Sales Shipment Header". /// Parameter of type Dictionary of [BigInteger, Code[20]]. internal procedure CreateShopifyFulfillment(var SalesShipmentHeader: Record "Sales Shipment Header"; var AssignedFulfillmentOrderIds: Dictionary of [BigInteger, Code[20]]); - var - ShipmentLocation: Query "Shpfy Shipment Location"; - begin - if (SalesShipmentHeader."Shpfy Order Id" <> 0) and (SalesShipmentHeader."Shpfy Fulfillment Id" = 0) then begin - ShipmentLocation.SetRange(No, SalesShipmentHeader."No."); - if ShipmentLocation.Open() then - while ShipmentLocation.Read() do - CreateShopifyFulfillment(SalesShipmentHeader, ShipmentLocation.LocationId, ShipmentLocation.DeliveryMethodType, AssignedFulfillmentOrderIds); - end; - end; - - local procedure CreateShopifyFulfillment(var SalesShipmentHeader: Record "Sales Shipment Header"; LocationId: BigInteger; DeliveryMethodType: Enum "Shpfy Delivery Method Type"; var AssignedFulfillmentOrderIds: Dictionary of [BigInteger, Code[20]]); var Shop: Record "Shpfy Shop"; ShopifyOrderHeader: Record "Shpfy Order Header"; @@ -55,37 +43,40 @@ codeunit 30190 "Shpfy Export Shipments" FulfillmentId: BigInteger; FulfillmentOrderRequests: List of [Text]; begin - if ShopifyOrderHeader.Get(SalesShipmentHeader."Shpfy Order Id") then begin - ShopifyCommunicationMgt.SetShop(ShopifyOrderHeader."Shop Code"); - Shop.Get(ShopifyOrderHeader."Shop Code"); - FulfillmentOrderRequests := CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, LocationId, DeliveryMethodType, AssignedFulfillmentOrderIds); - if FulfillmentOrderRequests.Count <> 0 then - foreach FulfillmentOrderRequest in FulfillmentOrderRequests do begin - JResponse := ShopifyCommunicationMgt.ExecuteGraphQL(FulfillmentOrderRequest); - JFulfillment := JsonHelper.GetJsonToken(JResponse, 'data.fulfillmentCreate.fulfillment'); - if (JFulfillment.IsObject) then begin - FulfillmentId := OrderFulfillments.ImportFulfillment(SalesShipmentHeader."Shpfy Order Id", JFulfillment); - if SalesShipmentHeader."Shpfy Fulfillment Id" <> -1 then // partial fulfillment errors - SalesShipmentHeader."Shpfy Fulfillment Id" := FulfillmentId; - end else begin - SkippedRecord.LogSkippedRecord(SalesShipmentHeader."Shpfy Order Id", SalesShipmentHeader.RecordId, NoFulfillmentCreatedInShopifyLbl, Shop); - SalesShipmentHeader."Shpfy Fulfillment Id" := -1; - end; - end - else begin - SkippedRecord.LogSkippedRecord(SalesShipmentHeader."Shpfy Order Id", SalesShipmentHeader.RecordId, NoCorrespondingFulfillmentLinesLbl, Shop); - SalesShipmentHeader."Shpfy Fulfillment Id" := -1; - end; - SalesShipmentHeader.Modify(true); + if (SalesShipmentHeader."Shpfy Order Id" = 0) or (SalesShipmentHeader."Shpfy Fulfillment Id" <> 0) then + exit; + + if not ShopifyOrderHeader.Get(SalesShipmentHeader."Shpfy Order Id") then + exit; + + ShopifyCommunicationMgt.SetShop(ShopifyOrderHeader."Shop Code"); + Shop.Get(ShopifyOrderHeader."Shop Code"); + FulfillmentOrderRequests := CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, AssignedFulfillmentOrderIds); + if FulfillmentOrderRequests.Count <> 0 then + foreach FulfillmentOrderRequest in FulfillmentOrderRequests do begin + JResponse := ShopifyCommunicationMgt.ExecuteGraphQL(FulfillmentOrderRequest); + JFulfillment := JsonHelper.GetJsonToken(JResponse, 'data.fulfillmentCreate.fulfillment'); + if (JFulfillment.IsObject) then begin + FulfillmentId := OrderFulfillments.ImportFulfillment(SalesShipmentHeader."Shpfy Order Id", JFulfillment); + if SalesShipmentHeader."Shpfy Fulfillment Id" <> -1 then // partial fulfillment errors + SalesShipmentHeader."Shpfy Fulfillment Id" := FulfillmentId; + end else begin + SkippedRecord.LogSkippedRecord(SalesShipmentHeader."Shpfy Order Id", SalesShipmentHeader.RecordId, NoFulfillmentCreatedInShopifyLbl, Shop); + SalesShipmentHeader."Shpfy Fulfillment Id" := -1; + end; + end + else begin + SkippedRecord.LogSkippedRecord(SalesShipmentHeader."Shpfy Order Id", SalesShipmentHeader.RecordId, NoCorrespondingFulfillmentLinesLbl, Shop); + SalesShipmentHeader."Shpfy Fulfillment Id" := -1; end; + SalesShipmentHeader.Modify(true); end; - internal procedure CreateFulfillmentOrderRequest(SalesShipmentHeader: Record "Sales Shipment Header"; Shop: Record "Shpfy Shop"; LocationId: BigInteger; DeliveryMethodType: Enum "Shpfy Delivery Method Type"; var AssignedFulfillmentOrderIds: Dictionary of [BigInteger, Code[20]]) Requests: List of [Text]; + internal procedure CreateFulfillmentOrderRequest(SalesShipmentHeader: Record "Sales Shipment Header"; Shop: Record "Shpfy Shop"; var AssignedFulfillmentOrderIds: Dictionary of [BigInteger, Code[20]]) Requests: List of [Text]; var SalesShipmentLine: Record "Sales Shipment Line"; ShippingAgent: Record "Shipping Agent"; FulfillmentOrderLine: Record "Shpfy FulFillment Order Line"; - OrderLine: Record "Shpfy Order Line"; TempFulfillmentOrderLine: Record "Shpfy FulFillment Order Line" temporary; TrackingCompany: Enum "Shpfy Tracking Companies"; PrevFulfillmentOrderId: BigInteger; @@ -107,30 +98,14 @@ codeunit 30190 "Shpfy Export Shipments" SalesShipmentLine.SetFilter(Quantity, '>%1', 0); if SalesShipmentLine.FindSet() then begin repeat - if OrderLine.Get(SalesShipmentHeader."Shpfy Order Id", SalesShipmentLine."Shpfy Order Line Id") then - if (OrderLine."Location Id" = LocationId) and (OrderLine."Delivery Method Type" = DeliveryMethodType) then - if FindFulfillmentOrderLine(SalesShipmentHeader, SalesShipmentLine, FulfillmentOrderLine) then begin - FulfillmentOrderLine."Quantity to Fulfill" += Round(SalesShipmentLine.Quantity, 1, '='); - FulfillmentOrderLine."Remaining Quantity" := FulfillmentOrderLine."Remaining Quantity" - Round(SalesShipmentLine.Quantity, 1, '='); - FulfillmentOrderLine.Modify(); - - if TempFulfillmentOrderLine.Get(FulfillmentOrderLine."Shopify Fulfillment Order Id", FulfillmentOrderLine."Shopify Fulfillm. Ord. Line Id") then begin - TempFulfillmentOrderLine."Quantity to Fulfill" += Round(SalesShipmentLine.Quantity, 1, '='); - TempFulfillmentOrderLine.Modify(); - end else begin - TempFulfillmentOrderLine := FulfillmentOrderLine; - TempFulfillmentOrderLine."Quantity to Fulfill" := Round(SalesShipmentLine.Quantity, 1, '='); - TempFulfillmentOrderLine.Insert(); - end; - // Accept pending fulfillment request before creating fulfillment - AcceptPendingFulfillmentRequests(Shop, FulfillmentOrderLine."Shopify Fulfillment Order Id", AssignedFulfillmentOrderIds); - end; + FindFulfillmentOrderLines(SalesShipmentHeader, SalesShipmentLine, Shop, FulfillmentOrderLine, TempFulfillmentOrderLine, AssignedFulfillmentOrderIds); until SalesShipmentLine.Next() = 0; TempFulfillmentOrderLine.Reset(); + TempFulfillmentOrderLine.SetCurrentKey("Shopify Fulfillment Order Id"); if TempFulfillmentOrderLine.FindSet() then begin GraphQuery.Append('{"query": "mutation {fulfillmentCreate( fulfillment: {'); - if GetNotifyCustomer(Shop, SalesShipmentHeader, LocationId) then + if GetNotifyCustomer(Shop, SalesShipmentHeader, TempFulfillmentOrderLine."Shopify Location Id") then GraphQuery.Append('notifyCustomer: true, ') else GraphQuery.Append('notifyCustomer: false, '); @@ -217,21 +192,46 @@ codeunit 30190 "Shpfy Export Shipments" end; end; - local procedure FindFulfillmentOrderLine(SalesShipmentHeader: Record "Sales Shipment Header"; SalesShipmentLine: Record "Sales Shipment Line"; var FulfillmentOrderLine: Record "Shpfy FulFillment Order Line"): Boolean + local procedure FindFulfillmentOrderLines(SalesShipmentHeader: Record "Sales Shipment Header"; SalesShipmentLine: Record "Sales Shipment Line"; Shop: Record "Shpfy Shop"; var FulfillmentOrderLine: Record "Shpfy FulFillment Order Line"; var TempFulfillmentOrderLine: Record "Shpfy FulFillment Order Line" temporary; var AssignedFulfillmentOrderIds: Dictionary of [BigInteger, Code[20]]) var - OrderLine: Record "Shpfy Order Line"; + RemainingQtyToFulfill: Decimal; + QtyToFulfillOnLine: Decimal; begin - if OrderLine.Get(SalesShipmentHeader."Shpfy Order Id", SalesShipmentLine."Shpfy Order Line Id") then begin - FulfillmentOrderLine.Reset(); - FulfillmentOrderLine.SetRange("Shopify Order Id", OrderLine."Shopify Order Id"); - FulfillmentOrderLine.SetRange("Shopify Variant Id", OrderLine."Shopify Variant Id"); - FulfillmentOrderLine.SetRange("Shopify Location Id", OrderLine."Location Id"); - FulfillmentOrderLine.SetRange("Delivery Method Type", OrderLine."Delivery Method Type"); - FulfillmentOrderLine.SetFilter("Remaining Quantity", '>=%1', Round(SalesShipmentLine.Quantity, 1, '=')); - FulfillmentOrderLine.SetFilter("Fulfillment Status", '<>%1', 'CLOSED'); - if FulfillmentOrderLine.FindFirst() then - exit(true); - end; + FulfillmentOrderLine.Reset(); + FulfillmentOrderLine.SetRange("Shopify Order Id", SalesShipmentHeader."Shpfy Order Id"); + FulfillmentOrderLine.SetRange("Line Item Id", SalesShipmentLine."Shpfy Order Line Id"); + FulfillmentOrderLine.SetFilter("Fulfillment Status", '<>%1', 'CLOSED'); + FulfillmentOrderLine.SetFilter("Remaining Quantity", '>%1', 0); + if not FulfillmentOrderLine.FindSet() then + exit; + + RemainingQtyToFulfill := Round(SalesShipmentLine.Quantity, 1, '='); + repeat + if RemainingQtyToFulfill <= 0 then + break; + + if FulfillmentOrderLine."Remaining Quantity" >= RemainingQtyToFulfill then + QtyToFulfillOnLine := RemainingQtyToFulfill + else + QtyToFulfillOnLine := FulfillmentOrderLine."Remaining Quantity"; + + FulfillmentOrderLine."Quantity to Fulfill" += QtyToFulfillOnLine; + FulfillmentOrderLine."Remaining Quantity" -= QtyToFulfillOnLine; + FulfillmentOrderLine.Modify(); + + if TempFulfillmentOrderLine.Get(FulfillmentOrderLine."Shopify Fulfillment Order Id", FulfillmentOrderLine."Shopify Fulfillm. Ord. Line Id") then begin + TempFulfillmentOrderLine."Quantity to Fulfill" += QtyToFulfillOnLine; + TempFulfillmentOrderLine.Modify(); + end else begin + TempFulfillmentOrderLine := FulfillmentOrderLine; + TempFulfillmentOrderLine."Quantity to Fulfill" := QtyToFulfillOnLine; + TempFulfillmentOrderLine.Insert(); + end; + + AcceptPendingFulfillmentRequests(Shop, FulfillmentOrderLine."Shopify Fulfillment Order Id", AssignedFulfillmentOrderIds); + + RemainingQtyToFulfill -= QtyToFulfillOnLine; + until FulfillmentOrderLine.Next() = 0; end; local procedure CanFulfillOrder(FulfillmentOrderLine: Record "Shpfy FulFillment Order Line"; Shop: Record "Shpfy Shop"; var UnfulfillableOrders: List of [BigInteger]): Boolean diff --git a/src/Apps/W1/Shopify/App/src/Shipping/Queries/ShpfyShipmentLocation.Query.al b/src/Apps/W1/Shopify/App/src/Shipping/Queries/ShpfyShipmentLocation.Query.al deleted file mode 100644 index 02613caa53..0000000000 --- a/src/Apps/W1/Shopify/App/src/Shipping/Queries/ShpfyShipmentLocation.Query.al +++ /dev/null @@ -1,45 +0,0 @@ -// ------------------------------------------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// ------------------------------------------------------------------------------------------------ - -namespace Microsoft.Integration.Shopify; - -using Microsoft.Sales.History; - -query 30100 "Shpfy Shipment Location" -{ - Access = Internal; - Caption = 'Shopify Shipment Location'; - QueryType = Normal; - - elements - { - dataitem(SalesShipmentHeader; "Sales Shipment Header") - { - column(No; "No.") { } - - dataitem(SalesShipmentLine; "Sales Shipment Line") - { - DataItemLink = "Document No." = SalesShipmentHeader."No."; - DataItemTableFilter = Type = const(Item), Quantity = filter('>0'); - SqlJoinType = InnerJoin; - - dataitem(OrderLine; "Shpfy Order Line") - { - DataItemLink = "Line Id" = SalesShipmentLine."Shpfy Order Line Id"; - SqlJoinType = InnerJoin; - - column(LocationId; "Location Id") { } - - column(DeliveryMethodType; "Delivery Method Type") { } - - column(NoOfLines) - { - Method = Count; - } - } - } - } - } -} diff --git a/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingHelper.Codeunit.al b/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingHelper.Codeunit.al index aa323f00d2..0c71d5728a 100644 --- a/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingHelper.Codeunit.al +++ b/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingHelper.Codeunit.al @@ -84,6 +84,7 @@ codeunit 139559 "Shpfy Shipping Helper" FulfillmentOrderLine."Remaining Quantity" := OrderLine.Quantity; FulfillmentOrderLine."Shopify Location Id" := OrderLine."Location Id"; FulfillmentOrderLine."Delivery Method Type" := DeliveryMethodType; + FulfillmentOrderLine."Line Item Id" := OrderLine."Line Id"; FulfillmentOrderLine.Insert(); until OrderLine.Next() = 0; diff --git a/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al index 2aa63a294f..aed3d9d21d 100644 --- a/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al +++ b/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al @@ -50,7 +50,7 @@ codeunit 139606 "Shpfy Shipping Test" ShippingHelper.CreateRandomSalesShipment(SalesShipmentHeader, ShopifyOrderId); // [WHEN] Invoke the function CreateFulfillmentRequest() - FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, LocationId, DeliveryMethodType, AssignedFulfillmentOrderIds); + FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, AssignedFulfillmentOrderIds); // [THEN] We must find the correct fulfilment data in the json token LibraryAssert.AreEqual(1, FulfillmentRequests.Count, 'FulfillmentRequest count check'); @@ -93,7 +93,7 @@ codeunit 139606 "Shpfy Shipping Test" ShippingHelper.CreateRandomSalesShipment(SalesShipmentHeader, ShopifyOrderId); // [WHEN] Invoke the function CreateFulfillmentRequest() - FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, LocationId, DeliveryMethodType, AssignedFulfillmentOrderIds); + FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, AssignedFulfillmentOrderIds); // [THEN] We must find the correct fulfilment data in the json token LibraryAssert.AreEqual(2, FulfillmentRequests.Count(), 'FulfillmentRequest count check'); @@ -135,7 +135,7 @@ codeunit 139606 "Shpfy Shipping Test" FulfillmentOrderHeader.Modify(); // [WHEN] Invoke the function CreateFulfillmentRequest() - FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, LocationId, DeliveryMethodType, AssignedFulfillmentOrderIds); + FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, AssignedFulfillmentOrderIds); // [THEN] We must find the correct fulfilment data in the json token LibraryAssert.AreEqual(1, FulfillmentRequests.Count, 'FulfillmentRequest count check'); @@ -178,7 +178,7 @@ codeunit 139606 "Shpfy Shipping Test" ShippingHelper.CreateRandomSalesShipment(SalesShipmentHeader, ShopifyOrderId); // [WHEN] Invoke the function CreateFulfillmentOrderRequest() - FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, LocationId, DeliveryMethodType, AssignedFulfillmentOrderIds); + FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, AssignedFulfillmentOrderIds); // [THEN] We must find no fulfilment data in the json token as the location is for a third-party fulfillment service LibraryAssert.AreEqual(0, FulfillmentRequests.Count, 'FulfillmentRequest count check');