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] - Different Shipping Charges Types Tests #27575

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ codeunit 30166 "Shpfy Process Order"
/// </summary>
/// <param name="SalesHeader">Parameter of type Record "Sales Header".</param>
/// <param name="ShopifyOrderHeader">Parameter of type Record "Shopify Order Header".</param>
local procedure CreateHeaderFromShopifyOrder(var SalesHeader: Record "Sales Header"; ShopifyOrderHeader: Record "Shpfy Order Header")
internal procedure CreateHeaderFromShopifyOrder(var SalesHeader: Record "Sales Header"; ShopifyOrderHeader: Record "Shpfy Order Header")
var
ShopifyTaxArea: Record "Shpfy Tax Area";
DocLinkToBCDoc: Record "Shpfy Doc. Link To Doc.";
Expand Down Expand Up @@ -184,7 +184,7 @@ codeunit 30166 "Shpfy Process Order"
/// </summary>
/// <param name="SalesHeader">Parameter of type Record "Sales Header".</param>
/// <param name="ShopifyOrderHeader">Parameter of type Record "Shopify Order Header".</param>
local procedure CreateLinesFromShopifyOrder(var SalesHeader: Record "Sales Header"; ShopifyOrderHeader: Record "Shpfy Order Header")
internal procedure CreateLinesFromShopifyOrder(var SalesHeader: Record "Sales Header"; ShopifyOrderHeader: Record "Shpfy Order Header")
var
Item: Record Item;
SalesLine: Record "Sales Line";
Expand Down Expand Up @@ -432,6 +432,11 @@ codeunit 30166 "Shpfy Process Order"
SalesHeader.Delete(true);
end;

internal procedure SetShopifyShop(Shop: Record "Shpfy Shop")
begin
ShopifyShop := Shop;
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnInsertShipmentHeaderOnAfterTransferfieldsToSalesShptHeader', '', false, false)]
local procedure TransferShopifyOrderNoToShipmentHeader(SalesHeader: Record "Sales Header"; var SalesShptHeader: Record "Sales Shipment Header")
begin
Expand Down
15 changes: 11 additions & 4 deletions Apps/W1/Shopify/test/Base/ShpfyInitializeTest.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ codeunit 139561 "Shpfy Initialize Test"

internal procedure CreateShop(): Record "Shpfy Shop"
var
GLAccount: Record "G/L Account";
RefundGLAccount: Record "G/L Account";
Shop: Record "Shpfy Shop";
VATPostingSetup: Record "VAT Posting Setup";
Expand All @@ -43,8 +42,6 @@ codeunit 139561 "Shpfy Initialize Test"
exit(Shop);

Code := Any.AlphabeticText(MaxStrLen(Code));
GLAccount.SetRange("Direct Posting", true);
GLAccount.FindLast();

LibraryERM.CreateVATPostingSetupWithAccounts(VATPostingSetup,
VATPostingSetup."VAT Calculation Type"::"Normal VAT", LibraryRandom.RandDecInDecimalRange(10, 25, 0));
Expand All @@ -65,7 +62,7 @@ codeunit 139561 "Shpfy Initialize Test"
CreateVATPostingSetup(PostingGroupCode, PostingGroupCode);
CreateVATPostingSetup(PostingGroupCode, '');
CreateVATPostingSetup(PostingGroupCode, RefundGLAccount."VAT Prod. Posting Group");
Shop."Shipping Charges Account" := GLAccount."No.";
Shop."Shipping Charges Account" := CreateShippingChargesGLAcc(VATPostingSetup, GenPostingType);
Shop."Customer Posting Group" := PostingGroupCode;
Shop."Gen. Bus. Posting Group" := PostingGroupCode;
Shop."VAT Bus. Posting Group" := PostingGroupCode;
Expand Down Expand Up @@ -376,4 +373,14 @@ codeunit 139561 "Shpfy Initialize Test"
end;
end;

local procedure CreateShippingChargesGLAcc(var VATPostingSetup: Record "VAT Posting Setup"; GenPostingType: Enum "General Posting Type"): Code[20]
var
ShippingChargesGLAccount: Record "G/L Account";
begin
ShippingChargesGLAccount.Get(LibraryERM.CreateGLAccountWithVATPostingSetup(VATPostingSetup, GenPostingType::Sale));
ShippingChargesGLAccount."Direct Posting" := true;
ShippingChargesGLAccount.Modify(false);
exit(ShippingChargesGLAccount."No.");
end;

}
2 changes: 1 addition & 1 deletion Apps/W1/Shopify/test/Base/ShpfyTestShopify.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ codeunit 139563 "Shpfy Test Shopify"
local procedure SetupKeyVaultExpiryDate(ApiVersion: Text)
var
AzureKeyVaultTestLibrary: Codeunit "Azure Key Vault Test Library";
MockAzureKeyvaultSecretProvider: DotNet MockAzureKeyVaultSecretProvider;
// MockAzureKeyvaultSecretProvider: DotNet MockAzureKeyVaultSecretProvider;
JesperSchulz marked this conversation as resolved.
Show resolved Hide resolved
begin
MockAzureKeyvaultSecretProvider := MockAzureKeyvaultSecretProvider.MockAzureKeyVaultSecretProvider();
MockAzureKeyvaultSecretProvider.AddSecretMapping('ShopifyApiVersionExpiryDate', '{"' + ApiVersion + '": "' + Format(CurrentDateTime().Date().Year, 0, 9) + '-' + Format(CurrentDateTime().Date().Month, 0, 9) + '-' + Format(CurrentDateTime().Date().Day, 0, 9) + '"}');
Expand Down
Loading
Loading