1.0 Customer Creation:
Extending a customer saving OOB process. After the customer is saved in D365, update the same record on the Annex Cloud server using a secure API.
1.1 Design Summary
A Retail Commerce Trigger has been created to update the saved customer with the Annex Cloud API. The customer is saved using an Extension Property at the Customer object level with the name Annex Status.
1.2 Commerce Runtime Customizations
| Class Name | Method | New/Modified | Note |
| Post Customer Save Trigger | On Executed (Request, Response) | New |
1.3 Helper Classes or Methods
| Class | Method |
| Common Data Helper |
|
| Service Helper |
|
| Customer Attributes Helper |
|
| Loyalty Client |
|
2.0 Customer Loyalty Attributes Update in POS.
Saving Customer attributes from values provided by the Annex Cloud API.
2.1 Design Summary
A Retail Commerce Trigger has been created to update the saved customer using the Annex Cloud API. The Customer is saved using an Extension Property at the Customer object level with the name Annex Status.
2.2 Commerce Runtime Customizations
| Class Name | Method | New/Modified | Note |
| Post Customer Save Trigger | On Executed (Request, Response) | New |
2.3 Helper Classes or Methods
| Class | Method |
| Common Data Helper |
|
| Service Helper |
|
| Customer Attributes Helper |
|
| Loyalty Client |
|
Using the D365 Commers OOB request Update Customer Request to update the Customer (along with all the attributes).
3.0 Save Transaction
Extending customer saving OOB process. After the customer is saved in D365, update the same record in the Annex Cloud server using a secure API.
3.1 Design Summary
A Retail Commerce Trigger has been created to update the saved customer with the Annex Cloud API. Thge Customer is saved using an Extension Property at the Customer object level with the name Annex Status.
3.2 Commerce Runtime Customizations
| Class Name | Method | New/Modified | Note |
| Post Customer Save Trigger | On Executed (Request, Response) | New |
3.3 Helper Classes or Methods
| Class | Method |
| Common Data Helper |
Is Loyalty Opt-in Get Configuration Parameters Get Variables Update Ext Property |
| Service Helper | Save Customer |
| Customer Attributes Helper | Update Customer Attributes (discussed in another document) |
| Loyalty Client |
Call API Generate Token Prepare Request. |
4.0 Fetching Customer Reward(s) and Redeem as Coupon Code or Assigned Amount
An option to allow the user to fetch all the available rewards from the Annex Cloud server and display them in a POS popup for selection. The Fetch Rewards button should be clicked to get the available rewards.

On selection, the discount is applied based on the discount type selected.

If there is no customer selected, the user sees the following message.

If a customer does not have enough credits, the user sees the following message.

If the reward has already been applied, the user sees the following message.

4.1 Business Logic and Process Flow
A new POS operation has been created in Dynamics 365 Commerce with Operation ID 8888.

4.2 Commerce Runtime Customizations
| Class Name | Method | New or modified | Note |
| Get Rewards Controller |
Get Rewards (Account Number) Claim Reward (Account Number, Reward ID) |
New | |
| Rewards Data Service |
Get Rewards (Get Rewards Data Request) Claim Reward (Get Reward Claim Request) |
New |
4.3 Helper Classes / Methods
| Class | Method |
| Common Data Helper |
Get Configuration Parameters Get Variables |
| Service Helper | Get Rewards |
| Loyalty Client |
Call API Generate Token Prepare Request. |
4.4 Point of Sale or TypeScript Customizations
Operation(s)
| Class Name | C. Type | Method | New/Modified | Note |
| Customer Rewards Factory | modified | function (context, operation Id, action Parameters, correlation Id) | New | |
| Customer Rewards Request | modified | constructor (correlation Id) | New | |
| Customer Rewards Response | modified | constructor () | New | |
| Customer Rewards Handler | modified | execute (Customer Rewards Request<T Response>) | New |
Components section (in manifest.json file)
…\Extensions\VSI_AnnexCloudLoyality\Pos.Extension\manifest.json
{
"create": {
"operations": [
{
"name": "CustomerRewardsOperation - Control",
"description": "CustomerRewardsOperation - Custom control",
"operationId": "8888",
"operationRequestFactoryPath": "Operations/CustomerRewardsOperationRequestFactory",
"operationRequestHandlerPath": "Operations/CustomerRewardsOperationRequestHandler"
}
]
}
} 5.0 Redeeming reward points as currency balance
An option to allow users to refresh commerce parameters that are being used in Extension.
After adding or updating any commerce parameter we must run the jobs. Once the jobs are completed, we can refresh parameters using the new Refresh Commerce Parameters button available at POS Home in operations buttons.

5.1 Design Summary
A new POS operation has been created in Dynamics 365 Commerce with Operation ID 8999.

5.2 Commerce Runtime Customizations
| Class Name | Method | New/Modified | Note |
| Get Rewards Controller | Refresh Commerce Parameters () | New | |
| Rewards Data Service | Refresh Params (Refresh Params Request) | New |
5.3 Helper Classes / Methods
| Class | Method |
| Common Data Helper | Get Configuration Parameters |
6.0 Return Transaction (Full or Partial)
- Extending Transaction Saving OOB process. After the transaction is saved in D365, update the same record on the Annex Cloud server using a secure API.
- If the transaction’s sales line contains Parasailed and amount is a negative value, initiate a returned transaction with Annex Cloud.
- Use Get Sales Order Details by Sales ID service request to get the complete parent order from the Parent Sales ID.
6.1 Design Summary
A Retail Commerce Trigger has been created to update the returned transaction using the Annex Cloud API.
6.2 Commerce Runtime Customizations
| Class Name | Method | New/Modified | Note |
| Save Sales Transaction Data Trigger | On Executed (Request, Response) | New |
6.3 Helper Classes / Methods
| Class | Method |
| Common Data Helper |
Loyalty Opt-in Get Configuration Parameters Get Variables Get Commerce Customer |
| Service Helper |
Save Transaction Get Points |
| Customer Attributes Helper | Update Customer Attributes (discussed in another document) |
| Loyalty Client |
Call API Generate Token Prepare Request |
| Extension Method |
To AC Order Get Returned Order |
7.0 Display Loyalty Dashboard in Customer Profile
An option to allow users to see Annex Cloud Loyalty Dashboard within POS.
The loyalty Dashboard button should be clicked to initiate the process.

7.1 Design Summary
A new POS operation created in Dynamics 365 Commerce with Operation ID 8899.

7.2 Commerce Runtime Customizations
| Class Name | Method | New/Modified | Note |
| Get Rewards Controller | Get Dashboard URL Request () | New | |
| Rewards Data Service | Get Dashboard URL Request (Get Dashboard URL Request) | New |
7.3 Helper Classes / Methods
| Class | Method |
| Common Data Helper |
Get Configuration Parameters Get Variables |
8.0 Refresh Commerce Parameters
An option to allow users to refresh commerce parameters that are being used in Extension.
After adding or updating any commerce parameter we must run the jobs. Once the jobs are completed, we can refresh parameters using the new Refresh Commerce Parameters Button available at POS home in Operations buttons.

8.1 Design Summary
A new POS operation created in Dynamics 365 Commerce with Operation ID 8999.

8.2 Commerce Runtime Customizations
| Class Name | Method | New/Modified | Note |
| Get Rewards Controller | Refresh Commerce Parameters () | New | |
| Rewards Data Service | Refresh Params (Refresh Params Request) | New |
8.3 Helper Classes / Methods
| Class | Method |
| Common Data Helper | Get Configuration Parameters |
8.4 Point of Sale / TypeScript Customizations
Operation(s)
| Class Name | C. Type | Method | New/Modified | Note |
| Refresh Commerce Params Factory | modified | function (context, operation Id, action Parameters, correlation Id) | New | |
| Refresh Commerce Params Request | modified | constructor (correlation Id) | New | |
| Refresh Commerce Params Response | modified | constructor () | New | |
| Refresh Commerce Params Handler | modified | execute (Refresh Commerce Params Request<T Response>) | New |
Components section (in manifest. Json file)
…\Extensions\VSI_AnnexCloudLoyality\Pos.Extension\manifest.json
{
"create": {
"operations": [
{
"name": "RefreshCommerceParamsOperation - Control",
"description": "RefreshCommerceParamsOperation - Custom control",
"operationId": "8999",
"operationRequestFactoryPath": "Operations/RefreshCommerceParamsOperationRequestFactory",
"operationRequestHandlerPath": "Operations/RefreshCommerceParamsOperationRequestHandler"
}
]
}
} 9.0 Build and Deployment
Rebuild the project “Scale Unit” and open its BIN folder.
- For Commerce Extension copy files from folder:
K:\Visionet\VCommerceSDK\src\ScaleUnit\bin\Debug\netstandard2.0\CloudScaleUnitExtensionPackage\RetailServer\Code\bin\ext.
- To folder:
K:\RetailServer\WebRoot\bin\Ext.
- For POS Extension copy folder from folder:
K:\Visionet\VCommerceSDK\src\ScaleUnit\bin\Debug\netstandard2.0\CloudScaleUnitExtensionPackage\RetailCloudPOS\Code\Extensions.
- To Folder:
K:\RetailCloudPos\WebRoot\Extensions.
If the server is changed then POS and Commerce destination folders can be found by exploring Retail Cloud Pos or the Retail Server website from IIS Manager.

10.0 POS Useful Links
- POS Extension overview
https://learn.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-extension/pos-extension-overview - Commerce Extension Project
https://github.com/microsoft/Dynamics365Commerce.ScaleUnit - OOB POS APIs
https://learn.microsoft.com/en-us/dynamics365/commerce/dev-itpro/pos-apis