示例#1
0
        public InitiateTxResult InitiateCancelTx(string posRefId, string preauthId)
        {
            var msg = new PreauthCancelRequest(preauthId, posRefId).ToMessage();
            var tfs = new TransactionFlowState(
                posRefId, TransactionType.Preauth, 0, msg,
                $"Waiting for EFTPOS connection to make preauth cancellation request");
            var sentMsg = $"Asked EFTPOS to make preauth cancellation request";

            return(_initiatePreauthTx(tfs, sentMsg));
        }
示例#2
0
        public InitiateTxResult InitiateCompletionTx(string posRefId, string preauthId, int amountCents)
        {
            var msg = new PreauthCompletionRequest(preauthId, amountCents, posRefId).ToMessage();
            var tfs = new TransactionFlowState(
                posRefId, TransactionType.Preauth, amountCents, msg,
                $"Waiting for EFTPOS connection to make preauth completion request for ${amountCents / 100.0:.00}");
            var sentMsg = $"Asked EFTPOS to make preauth completion for ${amountCents / 100.0:.00}";

            return(_initiatePreauthTx(tfs, sentMsg));
        }
示例#3
0
        public InitiateTxResult InitiateAccountVerifyTx(string posRefId)
        {
            var verifyMsg = new AccountVerifyRequest(posRefId).ToMessage();
            var tfs       = new TransactionFlowState(
                posRefId, TransactionType.AccountVerify, 0, verifyMsg,
                $"Waiting for EFTPOS connection to make account verify request");
            var sentMsg = $"Asked EFTPOS to verify account";

            return(_initiatePreauthTx(tfs, sentMsg));
        }
示例#4
0
        public SchemeSettlementEntry[] GetSchemeSettlementEntries(TransactionFlowState txState)
        {
            var settleResponse = new Settlement(txState.Response);
            var schemes        = settleResponse.GetSchemeSettlementEntries();
            var schemeList     = new List <SchemeSettlementEntry>();

            foreach (var s in schemes)
            {
                schemeList.Add(s);
            }

            return(schemeList.ToArray());
        }
示例#5
0
        public InitiateTxResult InitiatePartialCancellationTx(string posRefId, string preauthId, int amountCents, TransactionOptions options)
        {
            var msg = new PreauthPartialCancellationRequest(preauthId, amountCents, posRefId)
            {
                Config  = Config,
                Options = options
            }.ToMessage();

            var tfs = new TransactionFlowState(
                posRefId, TransactionType.Preauth, amountCents, msg,
                $"Waiting for EFTPOS connection to make preauth partial cancellation request for ${amountCents / 100.0:.00}");
            var sentMsg = $"Asked EFTPOS to make preauth partial cancellation for ${amountCents / 100.0:.00}";

            return(_initiatePreauthTx(tfs, sentMsg));
        }
示例#6
0
        public InitiateTxResult InitiateExtendTx(string posRefId, string preauthId, TransactionOptions options)
        {
            var msg = new PreauthExtendRequest(preauthId, posRefId)
            {
                Config  = Config,
                Options = options
            }.ToMessage();

            var tfs = new TransactionFlowState(
                posRefId, TransactionType.Preauth, 0, msg,
                $"Waiting for EFTPOS connection to make preauth Extend request");
            var sentMsg = $"Asked EFTPOS to make preauth Extend request";

            return(_initiatePreauthTx(tfs, sentMsg));
        }
示例#7
0
        private InitiateTxResult _initiatePreauthTx(TransactionFlowState tfs, string sentMsg)
        {
            if (_spi.CurrentStatus == SpiStatus.Unpaired)
            {
                return(new InitiateTxResult(false, "Not Paired"));
            }

            lock (_txLock)
            {
                if (_spi.CurrentFlow != SpiFlow.Idle)
                {
                    return(new InitiateTxResult(false, "Not Idle"));
                }

                _spi.CurrentFlow        = SpiFlow.Transaction;
                _spi.CurrentTxFlowState = tfs;
                if (_spi._send(tfs.Request))
                {
                    _spi.CurrentTxFlowState.Sent(sentMsg);
                }
            }
            _spi._txFlowStateChanged(this, _spi.CurrentTxFlowState);
            return(new InitiateTxResult(true, "Preauth Initiated"));
        }
示例#8
0
 private void OnTxFlowStateChanged(object sender, TransactionFlowState txState)
 {
     callBackTxState(txState);
 }