Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -77,6 +77,7 @@ codeunit 148455 "Automated Billing Test"
var
CustomerSubscriptionContract: Record "Customer Subscription Contract";
SubscriptionHeader: Record "Subscription Header";
SubscriptionLine: Record "Subscription Line";
BillingTemplate: Record "Billing Template";
BillingLine: Record "Billing Line";
SalesHeader: Record "Sales Header";
Expand All @@ -87,8 +88,16 @@ codeunit 148455 "Automated Billing Test"
// [GIVEN] A Billing Template with automation settings
CreateBillingTemplateWithAutomation(BillingTemplate);

// [WHEN] Bill the contracts automatically
// [GIVEN] A contract with subscription lines starting today
ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerSubscriptionContract, SubscriptionHeader, '');
SubscriptionLine.SetRange("Subscription Header No.", SubscriptionHeader."No.");
SubscriptionLine.FindSet();
repeat
SubscriptionLine.Validate("Subscription Line Start Date", Today());
SubscriptionLine.Modify(true);
until SubscriptionLine.Next() = 0;

// [WHEN] Bill the contracts automatically
BillingTemplate.BillContractsAutomatically();

// [THEN] Verify that Sales Header is created for the billed contract
Expand Down Expand Up @@ -118,8 +127,15 @@ codeunit 148455 "Automated Billing Test"
CreateBillingTemplateWithAutomation(BillingTemplate);
ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerSubscriptionContract, SubscriptionHeader, '');

// [GIVEN]Remove Item UOM to cause error during billing
// [GIVEN] Subscription lines starting today
SubscriptionLine.SetRange("Subscription Header No.", SubscriptionHeader."No.");
SubscriptionLine.FindSet();
repeat
SubscriptionLine.Validate("Subscription Line Start Date", Today());
SubscriptionLine.Modify(true);
until SubscriptionLine.Next() = 0;

// [GIVEN] Remove Item UOM to cause error during billing
SubscriptionLine.FindLast();
ItemUnitOfMeasure.Get(SubscriptionLine."Invoicing Item No.", SubscriptionHeader."Unit of Measure");
ItemUnitOfMeasure.Delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ codeunit 139687 "Recurring Billing Docs Test"
end;

[Test]
[HandlerFunctions('MessageHandler,GetVendorContractLinesProducesCorrectAmountsDuringSelectionPageHandler,ExchangeRateSelectionModalPageHandler')]
[HandlerFunctions('GetVendorContractLinesProducesCorrectAmountsDuringSelectionPageHandler')]
procedure GetVendorContractLinesProducesCorrectAmountsDuringSelection()
var
Item: Record Item;
Expand All @@ -1306,7 +1306,7 @@ codeunit 139687 "Recurring Billing Docs Test"
// [GIVEN] Setup Subscription with Subscription Line and assign it to Vendor Subscription Contract
// [GIVEN] Create Purchase Invoice with Purchase Invoice Line
ContractTestLibrary.DeleteAllContractRecords();
ContractTestLibrary.CreateVendor(Vendor);
ContractTestLibrary.CreateVendorInLCY(Vendor);
ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No.");
GetVendorContractServiceCommitment(VendorContract."No.");
ServiceCommitment."Billing Rhythm" := ServiceCommitment."Billing Base Period";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ codeunit 139688 "Recurring Billing Test"
end;

[Test]
[HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')]
procedure CheckBillingLineUpdateRequiredOnModifyCustomerContractLine()
var
DiscountAmount: Decimal;
Expand All @@ -611,7 +610,7 @@ codeunit 139688 "Recurring Billing Test"
begin
Initialize();

ContractTestLibrary.CreateCustomer(Customer);
ContractTestLibrary.CreateCustomerInLCY(Customer);
ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No.");
ContractTestLibrary.CreateBillingProposal(BillingTemplate, Enum::"Service Partner"::Customer);
BillingLine.Reset();
Expand Down Expand Up @@ -656,7 +655,6 @@ codeunit 139688 "Recurring Billing Test"
end;

[Test]
[HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')]
procedure CheckBillingLineUpdateRequiredOnModifyVendorContractLine()
var
DiscountAmount: Decimal;
Expand All @@ -666,7 +664,7 @@ codeunit 139688 "Recurring Billing Test"
begin
Initialize();

ContractTestLibrary.CreateVendor(Vendor);
ContractTestLibrary.CreateVendorInLCY(Vendor);
ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No.");
ContractTestLibrary.CreateBillingProposal(BillingTemplate, Enum::"Service Partner"::Vendor);
BillingLine.Reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,8 @@ codeunit 139692 "Contract Renewal Test"
Initialize();
// [GIVEN] We Create all the needed data
CreateBaseData();
CustomerContract.Validate("Currency Code", '');
CustomerContract.Modify(false);
BaseCalculationPercentage := LibraryRandom.RandDecInDecimalRange(80, 100, 2);
CalculationBaseAmount := LibraryRandom.RandDecInDecimalRange(80, 100, 2);
// [WHEN] We run the action Contract Renewal Quote and change the values on Subscription, values are tested in a ContractRenewalSelectionModalPageHandler
Expand Down
Loading
Loading