Пример #1
0
        /// <summary>
        /// Shows how to get the result of a transaction after a power/link failure.
        /// </summary>
        /// <param name="session">The Vault session to use.</param>
        public void HandlePowerLinkFailure()
        {
//			VaultSession session = new VaultSession("CHECKOUT1");
//			using (VaultSession vs = new VaultSession("CHECKOUT1"))
            {
//				FinancialTransaction tx = GetCurrentTransaction();
                UnknownVaultTransaction tx = GetCurrentTransaction();
                if (tx != null)
                {
                    TransactionResult result = vs.CompleteTransaction((VaultTransaction)tx);
                    if (result == TransactionResult.Success)
                    {
                        // Close the sale - customer can leave with goods
//						Program.MsgBox("PowerLinkFailure detected, last EFTPOS transaction ACCEPTED");
                    }
                    else
                    {
                        // Leave the sale open - customer will have to retender.
//						Program.MsgBox("PowerLinkFailure detected, last EFTPOS transaction not finished, result:" + result.ToString());
                    }
                }
                else
                {
                    //				Program.MsgBox("Vault OK");
                    // There was no transaction pending during the power/link failure
                }
            }
        }
Пример #2
0
        /// <summary>
        /// This method returns the currently executing transaction (if any).
        /// </summary>
        /// <returns>Returns null if no transaction pending.</returns>
        public UnknownVaultTransaction GetCurrentTransaction()
        {
            // The code below is shows how to create the transaction object
            // ready for use in the CompleteTransaction method. In real
            // life this code would retrieve the transaction
            // ID from a persistent store.
            UnknownVaultTransaction ut = new UnknownVaultTransaction("#10");

//			if(ut.TxInfo == null)
//				return null;
            return(ut);
//			return (FinancialTransaction)ut;
        }