forked from microsoft/ALAppExtensions
-
Notifications
You must be signed in to change notification settings - Fork 0
[E-Document Core] - Extending the Core app with payments #5
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
Open
AdeleStankeviciute
wants to merge
23
commits into
main
Choose a base branch
from
dev/asm/86422
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3e81f6a
add EDocument app workspace
petemchlk f4c11e2
add code analyzers settings to code workspace
petemchlk 26753b9
Merge pull request #1 from GMatuleviciute/dev/pmi/EDocumentWorkspace
GMatuleviciute d89a2a0
extending the Core app with payments
AdeleStankeviciute be90cbf
remove direction filter, add small fixes
AdeleStankeviciute 9672d29
add automated tests
AdeleStankeviciute 8f89380
fixes
AdeleStankeviciute 0768d7d
fixes
AdeleStankeviciute 9809c08
modify permission sets
AdeleStankeviciute ac0892d
Format fixes
GMatuleviciute 185f95a
Merge branch 'dev/asm/86422' of https://github.com/GMatuleviciute/ALA…
GMatuleviciute 89e251c
change automated tests
AdeleStankeviciute aee7aea
Merge branch 'dev/asm/86422' of https://github.com/GMatuleviciute/ALA…
AdeleStankeviciute d6774b8
Removed workspace
GMatuleviciute 67671f4
Merge branch 'main' of https://github.com/GMatuleviciute/ALAppExtensions
GMatuleviciute 498825b
Merge branch 'main' of https://github.com/GMatuleviciute/ALAppExtensions
GMatuleviciute b24c215
Merge branch 'main' into dev/asm/86422
AdeleStankeviciute 3cf281c
change objects ids
AdeleStankeviciute 96b6d3c
Merge branch 'main' into dev/asm/86422
AdeleStankeviciute d8c4999
Merge branch 'main' of https://github.com/GMatuleviciute/ALAppExtensions
GMatuleviciute e3ed73f
Merge branch 'main' into dev/asm/86422
AdeleStankeviciute 75d29ac
remove not used namespace
AdeleStankeviciute 710a8e8
change test codeunit ids to avoid conflicts
AdeleStankeviciute File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Apps/W1/EDocument/app/src/Integration/Interfaces/IDocumentPaymentHandler.Interface.al
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.eServices.EDocument.Integration.Interfaces; | ||
|
|
||
| using Microsoft.eServices.EDocument; | ||
| using Microsoft.eServices.EDocument.Integration.Payments; | ||
| using System.Utilities; | ||
|
|
||
| /// <summary> | ||
| /// Interface for sending and receiving payment information for E-Documents using E-Document service | ||
| /// </summary> | ||
| interface IDocumentPaymentHandler | ||
| { | ||
| procedure Send(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; PaymentContext: Codeunit PaymentContext) | ||
|
|
||
| procedure Receive(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; var PaymentsMetadata: Codeunit "Temp Blob List"; PaymentContext: Codeunit PaymentContext) | ||
|
|
||
| procedure GetDetails(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; PaymentMetadata: Codeunit "Temp Blob"; PaymentContext: Codeunit PaymentContext) | ||
| } |
61 changes: 61 additions & 0 deletions
61
Apps/W1/EDocument/app/src/Integration/Payments/GetPaymentDetails.Codeunit.al
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.eServices.EDocument.Integration.Payments; | ||
|
|
||
| using System.Utilities; | ||
| using Microsoft.eServices.EDocument; | ||
| using Microsoft.eServices.EDocument.Integration.Interfaces; | ||
|
|
||
| codeunit 6107 "Get Payment Details" | ||
| { | ||
| Access = Internal; | ||
| InherentEntitlements = X; | ||
| InherentPermissions = X; | ||
|
|
||
| trigger OnRun() | ||
| begin | ||
| this.EDocumentService.TestField(Code); | ||
| this.IDocumentPaymentHandler.GetDetails(this.EDocument, this.EDocumentService, this.PaymentMetadata, this.PaymentContext); | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Sets the global variable PaymentContext. | ||
| /// </summary> | ||
| /// <param name="PaymentContext">Payment context codeunit.</param> | ||
| procedure SetContext(PaymentContext: Codeunit PaymentContext) | ||
GMatuleviciute marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| begin | ||
| this.PaymentContext := PaymentContext; | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Sets the IDocumentPaymentHandler instance. | ||
| /// </summary> | ||
| /// <param name="PaymentHandler">IDocumentPaymentHandler implementation used for receiving payment details.</param> | ||
| procedure SetInstance(PaymentHandler: Interface IDocumentPaymentHandler) | ||
GMatuleviciute marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| begin | ||
| this.IDocumentPaymentHandler := PaymentHandler; | ||
| end; | ||
|
|
||
|
|
||
| /// <summary> | ||
| /// Sets the parameters for the payment information receiving. | ||
| /// </summary> | ||
| /// <param name="EDocument">Electronic document for which payment is received.</param> | ||
| /// <param name="EDocumentService">Service for receiving payments.</param> | ||
| /// <param name="PaymentMetadata">TempBlob which contains received payment information.</param> | ||
| procedure SetParameters(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; PaymentMetadata: Codeunit "Temp Blob") | ||
| begin | ||
| this.EDocument.Copy(EDocument); | ||
| this.EDocumentService.Copy(EDocumentService); | ||
| this.PaymentMetadata := PaymentMetadata; | ||
| end; | ||
|
|
||
| var | ||
| EDocument: Record "E-Document"; | ||
| EDocumentService: Record "E-Document Service"; | ||
| PaymentMetadata: Codeunit "Temp Blob"; | ||
| PaymentContext: Codeunit PaymentContext; | ||
| IDocumentPaymentHandler: Interface IDocumentPaymentHandler; | ||
| } | ||
36 changes: 36 additions & 0 deletions
36
...W1/EDocument/app/src/Integration/Payments/Implementations/EmptyPaymentHandler.Codeunit.al
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.eServices.EDocument.Integration.Payments; | ||
|
|
||
| using Microsoft.eServices.EDocument; | ||
| using Microsoft.eServices.EDocument.Integration.Interfaces; | ||
| using Microsoft.eServices.EDocument.Payments; | ||
| using System.Utilities; | ||
|
|
||
| /// <summary> | ||
| /// This codeunit is used to provide a default implementation for the "Document Payment Handler" interface. | ||
| /// </summary> | ||
| codeunit 6105 "Empty Payment Handler" implements IDocumentPaymentHandler | ||
| { | ||
| Access = Internal; | ||
| InherentEntitlements = X; | ||
| InherentPermissions = X; | ||
|
|
||
| procedure Send(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; PaymentContext: Codeunit PaymentContext) | ||
| begin | ||
| // 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; | ||
|
|
||
| } |
73 changes: 73 additions & 0 deletions
73
Apps/W1/EDocument/app/src/Integration/Payments/PaymentContext.Codeunit.al
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.eServices.EDocument.Integration.Payments; | ||
|
|
||
| using Microsoft.eServices.EDocument.Integration; | ||
| using Microsoft.eServices.EDocument.Payments; | ||
|
|
||
| codeunit 6104 PaymentContext | ||
| { | ||
| /// <summary> | ||
| /// Get the Http Message State codeunit. | ||
| /// </summary> | ||
| /// <returns>codeunit Http Message State that contains http request and response messages.</returns> | ||
| procedure Http(): Codeunit "Http Message State" | ||
| begin | ||
| exit(this.HttpMessageState); | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Retrieves the payment date. | ||
| /// </summary> | ||
| /// <returns>Date when the payment was made.</returns> | ||
| procedure GetDate(): Date | ||
| begin | ||
| exit(this.Date); | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Retrieves the payment amount. | ||
| /// </summary> | ||
| /// <returns>Amount of the payment.</returns> | ||
| procedure GetAmount(): Decimal | ||
GMatuleviciute marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| begin | ||
| exit(this.Amount); | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Sets the payment date and amount. | ||
| /// </summary> | ||
| /// <param name="Date">Date when the payment was made.</param> | ||
| /// <param name="Amount">Amount of the payment.</param> | ||
| procedure SetPaymentInformation(Date: Date; Amount: Decimal) | ||
| begin | ||
| this.Date := Date; | ||
| this.Amount := Amount; | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Retrieves the payment status. | ||
| /// </summary> | ||
| /// <returns>Current payment status.</returns> | ||
| procedure GetPaymentStatus(): Enum "Payment Status" | ||
| begin | ||
| exit(this.PaymentStatus); | ||
| end; | ||
|
|
||
| /// <summary> | ||
| /// Sets the payment status. | ||
| /// </summary> | ||
| /// <param name="NewPaymentStatus">New payment status.</param> | ||
| procedure SetPaymentStatus(NewPaymentStatus: Enum "Payment Status") | ||
| begin | ||
| this.PaymentStatus := NewPaymentStatus; | ||
| end; | ||
|
|
||
| var | ||
| HttpMessageState: Codeunit "Http Message State"; | ||
| PaymentStatus: Enum "Payment Status"; | ||
| Date: Date; | ||
| Amount: Decimal; | ||
| } | ||
19 changes: 19 additions & 0 deletions
19
Apps/W1/EDocument/app/src/Integration/Payments/PaymentIntegration.Enum.al
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
| namespace Microsoft.eServices.EDocument.Integration.Payments; | ||
|
|
||
| using Microsoft.eServices.EDocument.Integration.Interfaces; | ||
GMatuleviciute marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| enum 6105 "Payment Integration" implements IDocumentPaymentHandler | ||
| { | ||
| Extensible = true; | ||
| Access = Public; | ||
|
|
||
| value(0; "No Integration") | ||
| { | ||
| Caption = 'No Integration'; | ||
| Implementation = IDocumentPaymentHandler = "Empty Payment Handler"; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.