Orchardcore downloads

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore downloads is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for the CrestApps Orchard Core Digital Downloads commerce module. Covers the DigitalFilesPart, the private protected file area IProtectedFileStore<DigitalDownloadFiles> (formerly IDigitalFileStore) under the tenant App_Data scanned through the Orchard Core file creation pipeline, DownloadEntit

How to use this skill

Skill file

Orchard Core Digital Downloads - Prompt Templates

Deliver Digital Products

You are an Orchard Core expert. Generate accurate setup, recipes and extension guidance for the CrestApps Digital Downloads module, which keeps a product's files privately, grants them to buyers when an order is paid, and serves them through signed, expiring links.

Guidelines

Feature and Services

| Item | Value |

|---|---|

| Feature ID | CrestApps.OrchardCore.Downloads |

| Content part | DigitalFilesPart (Files, DownloadLimit, LinkLifetimeDays) |

| File store | IProtectedFileStore<DigitalDownloadFiles> (CrestApps.OrchardCore.FileStorage: SaveAsync, FindAsync, OpenAsync, DeleteAsync, returning ProtectedFile), registered with services.AddProtectedFileArea<DigitalDownloadFiles>(DownloadsConstants.StoreFolder); folder App_Data/.../DigitalFiles/{fileId}/{fileName}. IDigitalFileStore, DigitalFileStore and StoredDigitalFile were removed; stored files are unchanged |

| Entitlements | DownloadEntitlement in collection Downloads, DownloadEntitlementIndex |

| Service | DownloadService (GrantAsync, ListAsync, CreateUrlAsync, ResolveAsync, RecordDownloadAsync, RevokeOrderAsync, RevokeAsync, ResetAsync) |

| Site settings | DownloadSettings (group downloads, Settings > Commerce > Downloads): DownloadLimit 5, LinkLifetimeDays 30 |

| Order seams | DownloadOrderEventHandler (OrderLineGrantHandlerBase<DigitalFilesPart>), IOrderEmailSectionProvider, OrderDownloadsDisplayDriver |

| Permission | ManageDigitalDownloads ("Manage digital files and downloads"; Administrator, Store manager), also guards the settings group |

| Recipe step | DigitalFiles (needs OrchardCore.Recipes.Core) |

| Report | Downloads under Reports > Commerce and the Digital Downloads dashboard widget (with CrestApps.OrchardCore.Reports) |

| Report Builder | Downloads data source (Downloads) with DownloadEntitlements (ManageDigitalDownloads; file store ids and links never exposed); recipe DownloadsReportBuilderReports adds an editable copy to the Store group |

| Sample recipe | Digital downloads sample: a Digital Product type, two ebooks with PDFs, an Ebooks listing, coupons WELCOME10 and EBOOKS5 |

The Part and Settings

DigitalFilesPart.Files holds DigitalFile items (FileId, FileName, Size). DownloadLimit and LinkLifetimeDays override the site settings when set; 0 means no limit or links that never expire.

The part editor uploads each file straight to the store through POST /Admin/downloads/files/upload (up to 1 GB, ManageDigitalDownloads), then saving the product keeps the ids the store knows. GET /Admin/downloads/files/{fileId} opens a stored file for staff. Removing a file from a product does not delete it, so past orders keep their downloads.

When an IFileEventHandler refuses a file, or the scanner cannot be reached, nothing is kept and the upload answers 400 with the reason.

Granting and Revoking

DownloadOrderEventHandler derives from OrderLineGrantHandlerBase<DigitalFilesPart> (Orders.Core), which reads each line's files from the product version the order bought (IContentManager.GetPurchasedAsync(line)), so editing the product later does not change what a buyer gets:

From the order's admin page, staff can Take back one file (DownloadsRevoke) or Give downloads back (DownloadsReset), which resets the count, extends the link by the site lifetime and restores a revoked right.

Links

Buyers see their links on their order page, in the confirmation email (Your downloads, through DownloadEmailSectionProvider) and on account/downloads (AccountDownloads).

Ship Files with a Recipe

Each file names its product and gives its bytes as Base64, or Text for a small text file, up to 10 MB. A product that already has a file of that name keeps it, so rerunning adds nothing. Place the step after the Content step that creates the products.

{
  "steps": [
    {
      "name": "DigitalFiles",
      "Files": [
        { "ProductId": "4dgtlprod0trailguide00000a", "FileName": "trail-field-guide.pdf", "Base64": "JVBERi0xLjQK..." },
        { "ProductId": "4dgtlprod0notes0000000000a", "FileName": "read-me.txt", "Text": "Thanks for buying." }
      ]
    }
  ]
}

A product type for downloads uses ProductPart with product type Digital plus DigitalFilesPart. An order of digital products only has no shipping step.

Extending

Troubleshooting

| Symptom | Check |

|---|---|

| Upload answers 400 | An IFileEventHandler (antivirus) refused the file or the scanner is unreachable |

| No links in the confirmation email | The order must be paid; the product version bought must have files |

| Email links point to the wrong host | Set the site Base URL |

| Link answers 410 | The entitlement expired, was used up, or the order was canceled or fully refunded. Use Give downloads back |

| Guest gets no links | Enable Customers so checkout collects the guest's email |

| DigitalFiles step error | The product must exist (run after Content), bytes must be valid base64 and at most 10 MB |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.