Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3e81f6a
add EDocument app workspace
Dec 11, 2024
f4c11e2
add code analyzers settings to code workspace
Dec 12, 2024
26753b9
Merge pull request #1 from GMatuleviciute/dev/pmi/EDocumentWorkspace
GMatuleviciute Dec 12, 2024
d89a2a0
extending the Core app with payments
AdeleStankeviciute Jan 6, 2025
be90cbf
remove direction filter, add small fixes
AdeleStankeviciute Jan 9, 2025
9672d29
add automated tests
AdeleStankeviciute Jan 14, 2025
8f89380
fixes
AdeleStankeviciute Jan 21, 2025
0768d7d
fixes
AdeleStankeviciute Jan 21, 2025
9809c08
modify permission sets
AdeleStankeviciute Jan 22, 2025
ac0892d
Format fixes
GMatuleviciute Jan 22, 2025
185f95a
Merge branch 'dev/asm/86422' of https://github.com/GMatuleviciute/ALA…
GMatuleviciute Jan 22, 2025
89e251c
change automated tests
AdeleStankeviciute Jan 22, 2025
aee7aea
Merge branch 'dev/asm/86422' of https://github.com/GMatuleviciute/ALA…
AdeleStankeviciute Jan 22, 2025
d6774b8
Removed workspace
GMatuleviciute Jan 22, 2025
67671f4
Merge branch 'main' of https://github.com/GMatuleviciute/ALAppExtensions
GMatuleviciute Feb 10, 2025
498825b
Merge branch 'main' of https://github.com/GMatuleviciute/ALAppExtensions
GMatuleviciute Feb 13, 2025
b24c215
Merge branch 'main' into dev/asm/86422
AdeleStankeviciute Feb 13, 2025
3cf281c
change objects ids
AdeleStankeviciute Feb 13, 2025
96b6d3c
Merge branch 'main' into dev/asm/86422
AdeleStankeviciute Feb 13, 2025
d8c4999
Merge branch 'main' of https://github.com/GMatuleviciute/ALAppExtensions
GMatuleviciute Feb 14, 2025
e3ed73f
Merge branch 'main' into dev/asm/86422
AdeleStankeviciute Feb 17, 2025
75d29ac
remove not used namespace
AdeleStankeviciute Feb 17, 2025
710a8e8
change test codeunit ids to avoid conflicts
AdeleStankeviciute Feb 17, 2025
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
7 changes: 1 addition & 6 deletions Apps/W1/EDocument/app/src/Document/EDocument.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,6 @@ page 6121 "E-Document"

EDocImport.ProcessEDocPendingOrderMatch(Rec);

if (Rec.Direction = Rec.Direction::Incoming) then
Rec.SetRange("Payment Direction Filter", "E-Document Direction"::Outgoing)
else
Rec.SetRange("Payment Direction Filter", "E-Document Direction"::Incoming);

this.SetPaymentStatus();
end;

Expand Down Expand Up @@ -646,7 +641,7 @@ page 6121 "E-Document"
if Rec."Paid Amount" < Rec."Amount Incl. VAT" then
this.PaymentStatus := this.PaymentStatus::"Partially Paid"
else
this.PaymentStatus := this.PaymentStatus::"Paid In Full"
this.PaymentStatus := this.PaymentStatus::Paid
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.PaymentStatus := this.PaymentStatus::Paid; ( ; is missing)

end;

local procedure ReceivePaymentsForEDoc()
Expand Down
8 changes: 1 addition & 7 deletions Apps/W1/EDocument/app/src/Document/EDocument.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,7 @@ table 6121 "E-Document"
Caption = 'Paid Amount';
Editable = false;
FieldClass = FlowField;
CalcFormula = sum("E-Document Payment".Amount where("E-Document Entry No." = field("Entry No"), Direction = field("Payment Direction Filter")));
}
field(33; "Payment Direction Filter"; Enum "E-Document Direction")
{
Caption = 'Payment Direction Filter';
Editable = false;
FieldClass = FlowFilter;
CalcFormula = sum("E-Document Payment".Amount where("E-Document Entry No." = field("Entry No")));
}
}
keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ codeunit 6115 "E-Document Error Helper"
begin
ErrorMessage.SetRange("Context Record ID", EDocument.RecordId());
ErrorMessage.SetRange("Table Number", Database::"E-Document Payment");
ErrorMessage.DeleteAll();
ErrorMessage.DeleteAll(false);
end;

internal procedure GetTelemetryImplErrLbl(): Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using Microsoft.eServices.EDocument.Payments;
using System.Utilities;

/// <summary>
/// This codeunit is used to implement the "Document Payment Handler" interface. It is used to provide a default implementation for the "Action Invoker" interface.
/// This codeunit is used to provide a default implementation for the "Document Payment Handler" interface.
/// </summary>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action Invoker?

codeunit 6105 "Empty Payment Handler" implements IDocumentPaymentHandler
{
Expand All @@ -20,14 +20,17 @@ codeunit 6105 "Empty Payment Handler" implements IDocumentPaymentHandler

procedure Send(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; PaymentContext: Codeunit PaymentContext)
begin
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, preference: I prefer to see a // Do nothing comment within these placeholder implementations as it makes it clear this is intentionally empty.

// This method serves as a placeholder implementation for the IDocumentPaymentHandler interface.
end;

procedure Receive(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; var PaymentsMetadata: Codeunit "Temp Blob List"; PaymentContext: Codeunit PaymentContext)
begin
// This method serves as a placeholder implementation for the IDocumentPaymentHandler interface.
end;

procedure GetDetails(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; PaymentMetadata: Codeunit "Temp Blob"; PaymentContext: Codeunit PaymentContext)
begin
// This method serves as a placeholder implementation for the IDocumentPaymentHandler interface.
end;

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using Microsoft.eServices.EDocument.Integration.Payments;
using System.Utilities;

/// <summary>
/// Interface for sending and receiving paymnet information for E-Documents using E-Document service
/// Interface for sending and receiving payment information for E-Documents using E-Document service
/// </summary>
interface IDocumentPaymentHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ codeunit 6117 "Payment Integration Management"
exit;

Payment.Init();
Payment."E-Document Entry No." := EDocument."Entry No";
Payment.Direction := Payment.Direction::Incoming;
Payment.Validate("E-Document Entry No.", EDocument."Entry No");
Payment.Date := PaymentContext.GetDate();
Payment.Validate(Amount, PaymentContext.GetAmount());
Payment.Status := PaymentContext.GetPaymentStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ using Microsoft.eServices.EDocument.Payments;

codeunit 6116 "Send Payment"
{
Access = Internal;
InherentEntitlements = X;
InherentPermissions = X;

trigger OnRun()
begin
this.EDocumentService.TestField(Code);
Expand Down
36 changes: 30 additions & 6 deletions Apps/W1/EDocument/app/src/Payments/EDocumentPayment.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,29 @@ table 6101 "E-Document Payment"
{
Caption = 'E-Document Entry No.';
TableRelation = "E-Document"."Entry No";
AllowInCustomizations = Always;

trigger OnValidate()
begin
this.SetPaymentDirection();
end;
}
field(2; "Payment No."; Integer)
{
Caption = 'Payment No.';
AutoIncrement = true;
AllowInCustomizations = Always;
}
field(20; "Date"; Date)
{
Caption = 'Date';
ToolTip = 'Specifies the value of the Date field.';
}
field(21; Amount; Decimal)
{
Caption = 'Amount';
DecimalPlaces = 2;
ToolTip = 'Specifies the value of the Amount field.';

trigger OnValidate()
begin
Expand All @@ -43,21 +52,31 @@ table 6101 "E-Document Payment"
{
Caption = 'VAT Base';
DecimalPlaces = 2;
Editable = false;
ToolTip = 'Specifies the value of the VAT Base field.';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add more meaningful tooltips.

}
field(23; "VAT Amount"; Decimal)
{
Caption = 'VAT Amount';
DecimalPlaces = 2;
Editable = false;
ToolTip = 'Specifies the value of the VAT Amount field.';
}
field(24; Status; Enum "Payment Status")
{
Caption = 'Status';
Editable = false;
InitValue = Created;
ToolTip = 'Specifies the value of the Status field.';
}
field(25; Direction; Enum "E-Document Direction")
{
Caption = 'Direction';
Editable = false;
ToolTip = 'Specifies the value of the Direction field.';
}
}

keys
{
key(PK; "E-Document Entry No.", "Payment No.")
Expand All @@ -66,12 +85,6 @@ table 6101 "E-Document Payment"
}
}

trigger OnInsert()
begin
if Rec.Status = Rec.Status::" " then
Rec.Status := Rec.Status::Created;
end;

local procedure CalculateVAT()
var
EDocument: Record "E-Document";
Expand All @@ -86,4 +99,15 @@ table 6101 "E-Document Payment"
Rec."VAT Base" := Rec.Amount / (EDocument."Amount Incl. VAT" / EDocument."Amount Excl. VAT");
Rec."VAT Amount" := Rec.Amount - Rec."VAT Base";
end;

local procedure SetPaymentDirection()
var
EDocument: Record "E-Document";
begin
EDocument.Get(Rec."E-Document Entry No.");
if EDocument.Direction = EDocument.Direction::Outgoing then
Rec.Direction := Rec.Direction::Incoming
else
Rec.Direction := Rec.Direction::Outgoing;
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum 6104 "E-Document Payment Progress"
{
Caption = 'Partially Paid';
}
value(3; "Paid In Full")
value(3; Paid)
{
Caption = 'Paid In Full';
}
Expand Down
15 changes: 7 additions & 8 deletions Apps/W1/EDocument/app/src/Payments/EDocumentPayments.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,40 @@ page 6101 "E-Document Payments"
field("Date"; Rec."Date")
{
ApplicationArea = All;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove redundant application area, move tooltips to the table level

ToolTip = 'Specifies the value of the Date field.';
Editable = this.PaymentEditable;
}
field(Amount; Rec.Amount)
{
ApplicationArea = All;
ToolTip = 'Specifies the value of the Amount field.';
Editable = this.PaymentEditable;
}
field("VAT Base"; Rec."VAT Base")
{
ApplicationArea = All;
ToolTip = 'Specifies the value of the VAT Base field.';
Visible = false;
}
field("VAT Amount"; Rec."VAT Amount")
{
ApplicationArea = All;
ToolTip = 'Specifies the value of the VAT Amount field.';
Visible = false;
}
field(Status; Rec.Status)
{
ApplicationArea = All;
ToolTip = 'Specifies the value of the Status field.';
}
field(Direction; Rec.Direction)
{
ApplicationArea = All;
ToolTip = 'Specifies the value of the Direction field.';
}
}
}
}

trigger OnNewRecord(BelowxRec: Boolean)
var
PaymentEditable: Boolean;

trigger OnAfterGetRecord()
begin
Evaluate(Rec.Direction, Rec.GetFilter("Direction"));
this.PaymentEditable := Rec.Status <> Rec.Status::Sent;
end;
}