Skip to content

Handle Issue Voucher Failure #713

@StuartFerguson

Description

@StuartFerguson

In ProcessSaleMessage of the Voucher Management Proxy when the Issue Voucher Command is dispatched the result is handled as follows:

`if (result.IsSuccess) {
// Build the response metadata
Dictionary<String, String> additionalTransactionResponseMetadata = new Dictionary<String, String>();
additionalTransactionResponseMetadata.Add("VoucherCode", result.Data.VoucherCode);
additionalTransactionResponseMetadata.Add("VoucherMessage", result.Data.Message);
additionalTransactionResponseMetadata.Add("VoucherExpiryDate", result.Data.ExpiryDate.ToString("yyyy-MM-dd"));

return Result.Success(new OperatorResponse
{
    TransactionId = transactionId.ToString("N"),
    ResponseCode = "0000",
    ResponseMessage = "SUCCESS",
    // This may contain the voucher details to be logged with the transaction, and for possible receipt email/print
    AdditionalTransactionResponseMetadata = additionalTransactionResponseMetadata,
    AuthorisationCode = "ABCD1234",
    IsSuccessful = true
});

}

// TODO: handle a failed issue case
return null;`

Some handling needs added to ensure that of the issue command fails that at minimum something useful is logged.

Need to also consider if the voucher has actually been issued (e.g. written to EventStore) as the transaction will be declined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs and error-prone code

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions