Hi,
I am building a custom payment Gateway and I wondered if any of you smart people had already solved a problem I have.
I need to create a unique transaction ID. I have previously used (in other applications) the order number and the number of payments, such as 12345-2.
How might I do this with Able? Is there a better way? Should I use the OrderID or OrderNumber?
Any help greatly appreciated.
Thanks.
Rob.
Generating a unique transaction ID
Re: Generating a unique transaction ID
I decided on this
this will give me the ordernum (obviously) + the count of transactions, so if they are retried due to failed attempts or part shipments / payments each of the transIds on our providers side will be unique and marry up with the actual tranaction.
Rob.
Code: Select all
/// <summary>
/// Gets the transaction ID.
/// </summary>
/// <param name="order">The order.</param>
/// <returns>a string containing a unique tranaction ID</returns>
private string GetTransactionID(Order order)
{
return string.Format("{0}-{1}", order.OrderNumber.ToString(), order.Payments.LastPayment.Transactions.Count);
}
Rob.