### Register Connector Setup Classes Source: https://docs.litium.dev/add-ons/add-ons-as-extensions/connectors-product-extensions/litium-voyado-connector/voyado-connector-v5/develop/app-building Registers setup classes for connector installation during application startup. Use this to add initial configurations for the connector. ```csharp public void Install(IAppBuilder appBuilder) { appBuilder .AddConnector(Constants.ConnectorName, (connectorRegistration) => { connectorRegistration .AddSetup() .AddSetup(); }); } ``` -------------------------------- ### Start Storefront Proxy for Local Litium and Storefront Source: https://docs.litium.dev/platform/get-started/developer-tools/storefront-cli/proxy Use this command to start the storefront proxy when your Litium installation is local and your headless storefront is also running locally. Ensure you specify the correct URLs for both. ```bash litium-storefront proxy --litium https://litium.localtest.me:5001 --storefront http://localhost:3000 ``` -------------------------------- ### Start Litium Storefront Proxy Source: https://docs.litium.dev/accelerators/react-accelerator/get-started Run this command to start the Litium storefront proxy, which connects the Litium installation to your storefront application. Specify the URLs for both Litium and the storefront. ```shell litium-storefront proxy --litium https://litium.localtest.me:5001/ --storefront http://localhost:3000/ ``` -------------------------------- ### Configure Consola with WinstonReporter (Consola v2) Source: https://docs.litium.dev/cloud/serverless/guides/artifacts/logging-for-nodejs-and-nuxtjs This example shows how to set up Consola to use the WinstonReporter, ensuring logs are processed by Winston. It includes conditional logic to only apply changes during the 'start' npm lifecycle event. ```javascript import consola, { WinstonReporter } from 'consola'; import logger from './utils/logger'; if (process.env.npm_lifecycle_event === 'start') { consola.setReporters([new WinstonReporter(logger)]); if (process.env.NODE_ENV === 'production') { consola.wrapAll(); } else { consola.wrapConsole(); } } ``` -------------------------------- ### Start Production Server Source: https://docs.litium.dev/accelerators/react-accelerator/get-started After building the production version, run this command to start the web server. ```shell yarn start ``` -------------------------------- ### AppSetting.json Configuration Example Source: https://docs.litium.dev/add-ons/get-started/app-development-guide/using-the-app-management-package This JSON file defines the metadata, permissions, event subscriptions, and configuration file references required for installing an app in Litium. It includes logging settings, connection strings, and app-specific configurations. ```json { "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "ConnectionStrings": { // "Database": "" // Need to be commented out to avoid problem in production }, "AllowedHosts": "*", "AppMetadata": { "Id": "SampleApp", "DisplayName": "Sample Litium app", "RequestedPermissions": [ "Function/Connect/" ], "Subscribers": [ { "Url": "/api/webhook/capturetransaction", "Event": "Litium.Connect.Payments.Events.CaptureTransaction" }, { "Url": "/api/webhook/canceltransaction", "Event": "Litium.Connect.Payments.Events.CancelTransaction" }, { "Url": "/api/webhook/refundtransaction", "Event": "Litium.Connect.Payments.Events.RefundTransaction" } ], "ConfigFiles": [ { "Id": "AppConfiguration.json", "DisplayName": "Configuration file", "Description": "configuration for the Sample app." } ] }, "SampleAppConfig": { "SampleAppShippingOptions": [ ] } } ``` -------------------------------- ### Start Storefront Proxy for Remote Litium and Local Storefront Source: https://docs.litium.dev/platform/get-started/developer-tools/storefront-cli/proxy This command is used to start the storefront proxy when connecting to a remote Litium installation while your headless storefront is running locally. Verify the remote Litium URL and the local storefront URL. ```bash litium-storefront proxy --litium https://demo.litium.com --storefront http://localhost:3000 ``` -------------------------------- ### Install React Accelerator Source: https://docs.litium.dev/accelerators/react-accelerator/get-started Run this command in the desired folder to install the React accelerator. Ensure the template package is installed first. ```shell dotnet new litreactacc ``` -------------------------------- ### Install Octopus CLI Source: https://docs.litium.dev/add-ons/get-started/app-development-guide/deployment-in-lcc Installs the Octopus CLI as a global .NET Core tool. This is a one-time setup per machine. ```bash dotnet tool install --global Octopus.DotNet.Cli ``` -------------------------------- ### Start Development Environment Source: https://docs.litium.dev/accelerators/react-accelerator/get-started Run this command to start the project in development mode. The page will auto-update as you make changes. ```shell yarn dev ``` -------------------------------- ### Install Project Dependencies Source: https://docs.litium.dev/accelerators/mvc-accelerator/develop/setting-up-the-development-environment Use this command to install all dependent packages for the project. Ensure NPM or Yarn is installed, with Yarn recommended. ```bash yarn install ``` -------------------------------- ### Sample Folder Service Implementation Source: https://docs.litium.dev/platform/guides/data-modelling/how-to-create-a-folder-field-template An example service that uses SampleMediaService to create a folder field template and a media folder. It runs automatically on startup. ```csharp using System.Threading; using System.Threading.Tasks; using Litium.Runtime; using Litium.Security; namespace Litium.Docs.Samples.Media { [Autostart] public class SampleFolderService : IAsyncAutostart { private readonly SampleMediaService _sampleMediaService; private readonly SecurityContextService _securityContextService; public SampleFolderService(SampleMediaService sampleMediaService, SecurityContextService securityContextService) { _sampleMediaService = sampleMediaService; _securityContextService = securityContextService; } public ValueTask StartAsync(CancellationToken cancellationToken) { using (_securityContextService.ActAsSystem()) { var folderTemplate = _sampleMediaService.GetOrCreateFolderFieldTemplate("SampleFolderTemplate"); var mediaFolder = _sampleMediaService.GetOrCreateFolder("SampleFolder", folderTemplate.SystemId); } return ValueTask.CompletedTask; } } } ``` -------------------------------- ### Token Usage Example Request Source: https://docs.litium.dev/platform/architecture/web-api/overview Example HTTP GET request demonstrating how to use the obtained JWT access token in the Authorization header as a Bearer token. ```text GET /api/example/productlist HTTP/1.1 Host: domain Content-Type: application/json Authorization: Bearer J4HlhawWVlIse-7-CwlqlFLVBtS1YBw01sXLzFuLehJt6JVWkJjQ236EbyRw7L5cSDC5opv9AmS7eu7fZRFUQ2Jy9 dyGbZiI3MahSYQTjoZ3NsaRwNL6NYF2SRqZlxKk7Hf8pjgca2eui2mEbo4u2qFowzWrP6I8PNckyFB91t-6oM6fNqwB08DOCzvPxYQNKMFB6hz 1BHvv7xswFvrVRl_8fFTy5pRPN5cbCEButL-lJIJqm0fl193g2g9I_HvBDc6FFlcfx6t_ecG-V3xpmfInFjROm1o8yA6h8nCfsxbnQm2Q0aVYw Lye22tCienKME3dL9yJy1cmRYXkJ7BH-rvaqlnG4BSc948GtjIxI3k6P1kWLG1hYskFGS0oancj ``` -------------------------------- ### Download Storefront Proxy Manifest Example Source: https://docs.litium.dev/cloud/serverless/apps/public-apps/litium-storefront-proxy Download a manifest example to configure the Litium Storefront Proxy app. ```powershell litium-cloud marketplace manifest --app litium-storefront-proxy -f enter-any-name.yaml ``` -------------------------------- ### Litium Storefront Proxy App Manifest Example Source: https://docs.litium.dev/cloud/serverless/apps/public-apps/litium-storefront-proxy An example YAML manifest for installing the Litium Storefront Proxy app, specifying the storefront internal domain. ```yaml kind: app resource: id: litium-storefront-proxy spec: type: litium-storefront-proxy version: 1.0.0 properties: - name: storefront_internal_domain valueFrom: appRef: name: storefront-app key: internal_domain_name ``` -------------------------------- ### Install App using Manifest Source: https://docs.litium.dev/cloud/serverless/get-started/subscription-environment-and-app Use the `apply` command with the generated manifest file to install an app into a specific subscription and environment. Replace `litium-cdn.yml`, `your-subscription`, and `your-environment` with your actual values. ```powershell litium-cloud apply -f litium-cdn.yml --subscription your-subscription --environment your-environment ``` -------------------------------- ### Product Media Mapper Configuration Example Source: https://docs.litium.dev/add-ons/add-ons-as-extensions/connectors-product-extensions/product-media-mapper/product-media-mapper-v8/configure A basic configuration example for the Product Media Mapper, defining media root folder, article name match length, allowed image types, and field mappers. ```json "ProductMediaMapper": { "MediaRootFolder": "ArticleFiles", "ArticleNameMatchLength": 1, "AllowedImageTypes": [ "gif", "jpg", "png" ], "FieldImageMappers": [ { "Prefix": "", "Suffix": "", "TemplateFieldName": "File01" }, { "Prefix": "", "Suffix": "_1", "TemplateFieldName": "File02" }, { "Prefix": "", "Suffix": "_2", "TemplateFieldName": "File03" } ], "DisplayImageMappers": [ { "Prefix": "", "Suffix": "", "TemplateFieldName": "Image01" }, { "Prefix": "", "Suffix": "_1", "TemplateFieldName": "Image02" }, { "Prefix": "", "Suffix": "_2", "TemplateFieldName": "Image03" } ] } ``` -------------------------------- ### Get Author Field Value Source: https://docs.litium.dev/platform/get-started/customization-guide/field-and-validation Retrieves the Guid value of the 'AuthorField' from a BaseProduct entity. ```csharp var authorPageId = entity.Fields.GetValue("AuthorField"); ``` -------------------------------- ### Install Litium Connect ERP Template Package Source: https://docs.litium.dev/apis/connect-apis/domain-areas/erp-domain/erp-app-sdk/install-litium-connect-erp-template Installs the Litium Connect ERP template package using the .NET CLI. Run this command to get the latest version of the template. ```powershell dotnet new --install "Litium.Connect.Erp.Templates" ``` -------------------------------- ### Run .NET Upgrade Assistant Source: https://docs.litium.dev/platform/guides/upgrade-to-litium-8/upgrade-the-platform-solution/upgrade-solution-steps Initiates the upgrade process for your project or solution. Replace the placeholder with the actual path to your project or solution file. ```bash upgrade-assistant upgrade ``` -------------------------------- ### C# Example for Refund Action Source: https://docs.litium.dev/apis/connect-apis/domain-areas/erp-domain/business-processes/order-return-management-process This snippet demonstrates the prerequisite note for the Refund money endpoint. If the sroId variable is empty, it will get its value from the response of the Get Sales Return Order endpoint. ```csharp /** * If the sroId variable is empty, the sroId variable will get value from the response of the Get Sales Return Order end-point. */ let sroId = ""; ``` -------------------------------- ### Define GUID Generator Widget Source: https://docs.litium.dev/platform/areas/dashboard/how-to-create-custom-dashboard-widgets Inherit from WidgetDefinitionBase to define a widget's data model, settings, icon, component name, and data loading logic. This example shows a widget that generates a list of GUIDs. ```csharp public class GuidGeneratorWidgetDefinition : WidgetDefinitionBase { public override string IconClass => "fa-gift widget-icon--blue"; public override string ComponentName => "Accelerator#GuidGeneratorWidget"; public override int SortOrder => 1500; public async override Task LoadDataAsync(SettingsModel settings, IWidgetRequest request = null) { settings = settings ?? new SettingsModel(); var data = new DataModel(); for (int i = 0; i < settings.Count; i++) { data.Guids.Add(Guid.NewGuid()); } return data; } public class DataModel : IWidgetData { public IList Guids { get; set; } = new List(); } public class SettingsModel : IWidgetSettings { public string Name { get; set; } public int Count { get; set; } = 5; } } ``` -------------------------------- ### Lookup SystemId for Currency using KeyLookupService Source: https://docs.litium.dev/apis/dot-net-api/overview Use Litium.Common.KeyLookupService for high-performance lookup between Id and SystemId. This example shows how to get the SystemId for a currency from its Id. ```csharp _keyLookupService.TryGetId(entity.CurrencySystemId, out id) ``` -------------------------------- ### Example Project File for Litium Test Project Source: https://docs.litium.dev/platform/get-started/setting-up-a-test-project This XML project file configures a Litium test project, specifying target framework, output type, and necessary NuGet package references. It also includes a reference to the website project and defines the Litium application startup class. ```xml net6.0 Litium.Accelerator exe runtime; build; native; contentfiles; analyzers all Litium.Accelerator.Mvc.Startup ``` -------------------------------- ### Get Litium Platform Marketplace Manifest Source: https://docs.litium.dev/cloud/serverless/apps/public-apps/litium-platform/overview Use this command to retrieve a detailed list of available properties for the Litium platform app. This is useful for understanding configuration options before installation or deployment. ```powershell litium-cloud marketplace manifest --app litium-platform ``` -------------------------------- ### Postman Example for Sales Return Order ID Source: https://docs.litium.dev/apis/connect-apis/domain-areas/erp-domain/business-processes/order-return-management-process This snippet shows how to set the sroId variable in Postman. If the sroId is empty, it will be populated from the Get Sales Return Order endpoint response. ```javascript let sroId = ""; ``` -------------------------------- ### Install Klarna Core and UI NuGet Packages Source: https://docs.litium.dev/add-ons/add-ons-as-extensions/payment-extensions/klarna/install-v3 Install the main Klarna add-on package and its UI component using the Package Manager Console. ```powershell Install-Package Litium.AddOns.Klarna Install-Package Litium.AddOns.Klarna.UI ``` -------------------------------- ### Gets the import report. Source: https://docs.litium.dev/api-reference/imports/gets-the-import-report Retrieves the import report for a given import report ID. This endpoint provides details about the import process, including its status, start and end times, and any records or error messages. ```APIDOC ## GET /Litium/api/connect/erp/imports/{importReportId} ### Description Retrieves the import report for a specific import operation identified by its unique ID. ### Method GET ### Endpoint /Litium/api/connect/erp/imports/{importReportId} ### Parameters #### Path Parameters - **importReportId** (string) - Required - The import request identifier (UUID). #### Query Parameters - **api-version** (string) - Optional - Specifies the API version. Defaults to '2.6'. #### Header Parameters - **api-version** (string) - Optional - Specifies the API version. Defaults to '2.6'. ### Response #### Success Response (200) - **systemId** (string) - The system identifier (UUID) of the import report. - **userAgent** (string) - The user-agent string associated with the import request. - **serviceAccountId** (string) - The service account ID used for the import. - **importRequestedUtc** (string) - The date and time when the import was requested. - **importStartedUtc** (string) - The date and time when the import started (nullable). - **importCompletedUtc** (string) - The date and time when the import completed (nullable). - **status** (string) - The status of the import (e.g., notStarted, inProgress, completed, completedWithErrors, failed). - **importRecords** (array) - A list of import records associated with the operation (nullable). - **errorMessage** (string) - An error message if the import failed or completed with errors (nullable). #### Error Response (400, 401, 403, 404) - The response will be a ProblemDetails object detailing the error. ``` -------------------------------- ### Starting Litium Apps with Docker Compose Source: https://docs.litium.dev/add-ons/litium-apps/overview Use this command to start all defined Litium app services. Ensure your docker-compose.yaml file is correctly configured. ```bash docker-compose up ``` -------------------------------- ### Build Production Source: https://docs.litium.dev/accelerators/react-accelerator/get-started Execute this command to create a production build of the project in the .next folder. ```shell yarn build ``` -------------------------------- ### Async Autostart for Non-Blocking Initialization Source: https://docs.litium.dev/platform/architecture/application-lifecycle Implement IAsyncAutostart and use the Autostart attribute for classes that need to perform startup operations asynchronously without blocking the DI engine. Ensure any registered listeners are properly disposed of during application shutdown. ```csharp using System.Threading; using System.Threading.Tasks; using Litium.Runtime; namespace Litium.Application.Examples { [Autostart] public class EventBrokerApplicationLifestyleAsyncExample : IAsyncAutostart { private readonly EventBroker _eventBroker; private readonly IApplicationLifetime _applicationLifetime; public EventBrokerApplicationLifestyleAsyncExample(EventBroker eventBroker, IApplicationLifetime applicationLifetime) { _eventBroker = eventBroker; _applicationLifetime = applicationLifetime; } public ValueTask StartAsync(CancellationToken cancellationToken) { var subscription = _eventBroker.Subscribe(ev => { // Execute code when the event is raised. }); _applicationLifetime.ApplicationStopping.Register(() => { // application is about to shutdown, unregister the event listener subscription.Dispose(); }); return ValueTask.CompletedTask; } } } ``` -------------------------------- ### Configure Storefront App with SMTP Relay Source: https://docs.litium.dev/cloud/serverless/apps/public-apps/smtp-relay-app Example of how to configure a Litium Storefront app to use the installed SMTP relay app. This involves setting runtime configurations for SMTP host, port, security, username, and password. ```yaml kind: app resource: id: storefront spec: type: litium-nextjs-web # or nextjs-web configurations: - name: RUNTIME_SMTP_HOST valueFrom: appRef: name: smtp key: smtp_host - name: RUNTIME_SMTP_PORT valueFrom: appRef: name: smtp key: smtp_port - name: RUNTIME_SMTP_SECURE value: "false" - name: RUNTIME_SMTP_AUTH_USER valueFrom: appRef: name: smtp key: smtp_auth_username - name: RUNTIME_SMTP_AUTH_PASS valueFrom: appRef: name: smtp key: smtp_auth_password ``` -------------------------------- ### Basic Scheduled Task Configuration for InRiver Data Integrity Check Source: https://docs.litium.dev/add-ons/add-ons-as-extensions/connectors-product-extensions/litium-inriver-connector/inriver-connector-v-5/configure/integrity-checks-and-error-reports Configure the Litium scheduled task to run the inRiver data integrity check. This basic setup defines the task type, start time, and interval. ```xml ``` -------------------------------- ### Example appsettings.json for Qliro Payment App Source: https://docs.litium.dev/add-ons/litium-apps/qliro-payment/docker-template This is an example appsettings.json file for configuring the Qliro payment app within a Docker container. It includes database connection strings, application metadata, Litium API URLs, and callback configurations. ```json { "ConnectionStrings": { "Database": "Pooling=true;User Id=XX;Password=XX;Database=XX;Server=XX;TrustServerCertificate=true;Connection Timeout=600;Command Timeout=600" //Configure database string, replace XX with actual values }, "AllowedHosts": "*", "AppMetadata": { "Id": "QliroPayment", ".": "Url for this application", "AppUrl": "https://public-visible-app-url/", //Url to qliro app., should be publicly visible to outside world. "DisplayName": "Qliro payment app", "RequestedPermissions": [ "Function/Connect/Payments" ], "Subscribers": [ { "Url": "/api/webhook/capturetransaction", "Event": "Litium.Connect.Payments.Events.CaptureTransaction" }, { "Url": "/api/webhook/canceltransaction", "Event": "Litium.Connect.Payments.Events.CancelTransaction" }, { "Url": "/api/webhook/refundtransaction", "Event": "Litium.Connect.Payments.Events.RefundTransaction" }, { "Url": "/api/webhook/executeTransactions", "Event": "Litium.Connect.Payments.Events.ExecuteTransactions" } ], "ConfigFiles": [ { "Id": "AppConfiguration.json", "DisplayName": "Configuration file", "Description": "Configuration for the Qliro payment app." } ], "SupportedOperations": [ ] }, "LitiumApi": { ".": "Litium installation that we should connect to", "ApiUrl": "https://Litium-url/" //Litium installation app connects to. }, "Qliro": { "PaymentAccounts": [ ] }, "AppConfiguration": { "DisableCallbacks": "false", "CallbacksDomain": "https://public-visible-app-url" //Url to qliro app., should be publicly visible to outside world. }, "Logging": { "LogLevel": { "Default": "Trace", "Microsoft": "Warning", "Microsoft.AspNetCore": "Warning", "Microsoft.AspNetCore.Hosting.Diagnostics": "Information", "Microsoft.EntityFrameworkCore": "None", "Microsoft.Extensions.Caching.Memory.MemoryCache": "None", "Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService": "Information", "Microsoft.Extensions.Hosting.Internal.Host": "Debug", "Microsoft.Extensions.Http": "Warning", "Microsoft.Hosting.Lifetime": "Information", "System.Net.Http.HttpClient": "Trace" } } } ``` -------------------------------- ### Replace Blob Sync Methods with Async Source: https://docs.litium.dev/platform/guides/upgrade-to-litium-8/upgrade-to-litium-8-31 Update custom blob providers or call sites by replacing removed sync methods with their async equivalents. Examples include `Delete`, `OpenRead`, `OpenWrite`, `Get`, `Create`, and `Delete` operations. ```csharp | Removed | Replacement | | ---------------------------------------------------- | ------------------------------------------------------------------- | | `blob.Delete()` | `await blob.DeleteAsync()` | | `blob.OpenRead()` | `await blob.OpenReadAsync()` | | `blob.OpenWrite()` | `await blob.OpenWriteAsync()` | | `Blob Get(string name)` on BlobContainer | `Task GetAsync(string name)` | | `Blob GetDefault()` on BlobContainer | `Task GetDefaultAsync()` | | `BlobContainer Create(string, Guid?)` on BlobService | `Task CreateAsync(string, Guid?, CancellationToken)` | | `void Delete(BlobContainer)` on BlobService | `Task DeleteAsync(BlobContainer, CancellationToken)` | | `BlobContainer Get(Uri)` on BlobService | `Task GetAsync(Uri, CancellationToken)` | ``` -------------------------------- ### Product Media Mapper Configuration Example Source: https://docs.litium.dev/add-ons/add-ons-as-extensions/connectors-product-extensions/product-media-mapper/product-media-mapper-v7-and-before/configure This XML snippet shows a complete configuration for the Product Media Mapper, including allowed file types and mappings for custom fields and display images. It demonstrates how file names are matched to article numbers. ```xml ``` -------------------------------- ### Get Order Endpoint Example Source: https://docs.litium.dev/apis/connect-apis/domain-areas/erp-domain/business-processes/order-return-management-process This endpoint retrieves order details. It can be used to specify article numbers for shipment creation or retrieve all article numbers if the variable is empty. The response populates the shipmentRows variable for the Create Shipment endpoint. ```csharp Step 01 Get Order end-point. /** * If the articleNumbers variable is having some article numbers, this end-point will execute and receive a response then create a shipmentRows variable which contained these article numbers. * If the articleNumbers variable is empty, this end-point will execute and receive a response then create a shipmentRows variable which contained all article numbers of this sales order. * The shipmentRows variable will be automatical to pass to the Create Shipment end-point for creating one shipment contained these article numbers when the Create Shipment end-point executed. * We can change or add these article numbers and quantity to be suitable to each testing case. * Example for the articleNumbers variable is having some article numbers: * var articleNumbers = [ { ArticleNumber: "courtdress-l-001-638022225859406387", Quantity: 1 } ]; */ var articleNumbers = []; ``` -------------------------------- ### Show Available Plans for .NET Web App Source: https://docs.litium.dev/cloud/serverless/apps/private-apps/pricing An example of using the 'litium-cloud marketplace show' command to list plans for a .NET web application. ```powershell litium-cloud marketplace show --app dotnet-web ``` -------------------------------- ### List Installed Apps Source: https://docs.litium.dev/cloud/serverless/get-started/install-nextjs-storefront-app/overview Optional command to view all installed apps within your subscription and environment. Useful for verifying the installation. ```powershell litium-cloud app list --subscription enter-subscription-id --environment enter-environment-id ``` -------------------------------- ### Install Qliro NuGet Packages Source: https://docs.litium.dev/add-ons/add-ons-as-extensions/payment-extensions/qliro/install Install the necessary Qliro NuGet packages using the Package Manager Console in Visual Studio. Ensure the web application project is set as the default project. ```powershell Install-Package Litium.AddOns.Qliro -PreRelease Install-Package Litium.AddOns.Qliro.UI -PreRelease ``` -------------------------------- ### List Available Apps Source: https://docs.litium.dev/cloud/serverless/get-started/subscription-environment-and-app Use the `marketplace list` command to view all apps available for installation in an environment. ```powershell litium-cloud marketplace list ```