Skip to content

TransactionAggregate.ValidateContext rejects missing DeviceIdentifier for non-online transactions #1972

Closed

Description

@StuartFerguson

Description

TransactionAggregate.ValidateContext previously rejected a missing DeviceIdentifier for every transaction source.

That is incorrect for non-online transactions. A device identifier is required for TransactionSource.OnlineSale, but non-online sources such as FileImport may not have one.

Expected behavior

  • TransactionSource.OnlineSale with a null or empty DeviceIdentifier should return an invalid result.
  • TransactionSource.FileImport or TransactionSource.NotSet with a null or empty DeviceIdentifier should be accepted when the other context fields are valid.

Reproduction

var result = aggregate.StartTransaction(
    transactionDateTime,
    transactionNumber,
    TransactionType.Sale,
    transactionReference,
    new TransactionStartContext
    {
        EstateId = estateId,
        MerchantId = merchantId,
        DeviceIdentifier = null,
        TransactionSource = TransactionSource.FileImport
    },
    amount);

Actual behavior before the fix

The result was invalid solely because DeviceIdentifier was missing, regardless of the transaction source.

Fix coverage

Unit tests should explicitly set TransactionSource and cover both the OnlineSale rejection and the non-online success paths.

Activity

  1. changed the title [-]Aggregate test project build fails with no reported errors under .NET 10 SDK[/-] [+]TransactionAggregate.ValidateContext allows missing DeviceIdentifier for non-online transactions[/+] on Oct 13, 2026
  2. changed the title [-]TransactionAggregate.ValidateContext allows missing DeviceIdentifier for non-online transactions[/-] [+]TransactionAggregate.ValidateContext rejects missing DeviceIdentifier for non-online transactions[/+] on Oct 13, 2026
  3. linked a pull request that will close this issuefixes for file processing scenarios #1973on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions