Ejemplo n.º 1
0
        public TransactionResult Void(TransactionDoneResult transactionResult)
        {
            TransactionFailedResult txFailed = new TransactionFailedResult(TransactionType.Void, DateTime.Now);

            txFailed.CustomerDisplayText      = "";
            txFailed.OperatorDisplayText      = "Not implemented";
            txFailed.ReceiptPrintoutMandatory = false;
            txFailed.Receipts      = new Receipts();
            txFailed.RejectionCode = 23;
            return(txFailed);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Performs the Debit operation.
        /// </summary>
        /// <param name="transactionData"></param>
        /// <param name="card"></param>
        /// <returns></returns>
        public override TransactionResult Debit(TransactionData transactionData, Card card)
        {
            #region Perform debit operation
            // clear the response.
            response = null;
            // convert the Amount to the terminal format.
            string amount = convertAmount(transactionData.Amount);
            // create request message.
            requestMessage = new RequestMessage(amount);
            requestMessage.createCompleteMessage(requestMessage);
            //this.OnTrace(TraceLevel.Info, "Req message: " + requestMessage.message);
            // send message to the terminal.
            serialPort.SendMessage(requestMessage.finalMessage);
            // wait for ther terminal to reply.
            Thread.Sleep(20000);
            // create the response message.
            string trimmed = cleanMessage(response);
            responseMessage = new ResponseMessage(trimmed);
            // clear response buffer.
            response = null;
            // verify if LRC is valid.
            bool validLRC = responseMessage.verifyResponseLRC(responseMessage);
            #endregion


            #region Create Result Data
            // if debit operation not OK.
            if (!validLRC)
            {
                TransactionFailedResult txFailed = new TransactionFailedResult(TransactionType.Debit, DateTime.Now);
                return(txFailed);
            }
            else
            {
                //If valid
                if (responseMessage.hostResponse == "C10100")
                {
                    TransactionDoneResult txSucceed = new TransactionDoneResult(TransactionType.Debit, DateTime.Now);
                    txSucceed.Amount = responseMessage.amountAuthorized; // requestMessage.amount; ???
                    txSucceed.AuthorizationNumber = responseMessage.authorizationCode;
                    //txSucceed.ServiceCode

                    return(txSucceed);
                }
            }
            #endregion
        }
Ejemplo n.º 3
0
        public TransactionResult GetLastTransaction()
        {
            TransactionResult trRes = new TransactionDoneResult(TransactionType.Debit, DateTime.Now);

            return(trRes);
        }