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)); }
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)); }
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)); }
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()); }
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)); }
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)); }
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")); }
private void OnTxFlowStateChanged(object sender, TransactionFlowState txState) { callBackTxState(txState); }