public List<ResponseDetails> ProcessBCPTransactionPro(
            TransactionType _TT //Required
            , BankcardTransactionPro _BCtransaction //Conditional : Only used for an AuthorizeAndCapture, Authorize and ReturnUnlinked. Otherwise null
            , BankcardCapturePro _BCDifferenceData //Conditional : Only used for a Capture. Otherwise null
            , List<String> _BatchIds //Conditional : A list of one or more batch Ids to capture.
            , BankcardReturn _RDifferenceData //Conditional : Only used for a ReturnById. Otherwise null
            , Adjust _ADifferenceData //Conditional : Only used for an Adjust. Otherwise null
            , BankcardUndo _UDifferenceData //Conditional : Only used for an Undo. Otherwise null
            , List<string> _TransactionIds //Conditional : Only used for a CaptureSelective. Otherwise null
            , List<Capture> _CaptureDifferenceData //Conditional : Only used for CaptureAll and CaptureSelective. Otherwise null
            , bool _SendAcknowledge
            , bool _UseWorkflowId)
        {
            List<Response> _Response = new List<Response>();
            try
            {
                CheckTokenExpire();//Make sure the current token is valid

                string _serviceIdOrWorkflowId = _serviceId;
                if (_UseWorkflowId)
                    _serviceIdOrWorkflowId = _workflowId;

                if (_TT == TransactionType.AuthorizeAndCapture)
                {
                    if (CredentialRequired())
                        _BCtransaction.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.AuthorizeAndCapture(_sessionToken, _BCtransaction, _applicationProfileId, _merchantProfileId, _serviceIdOrWorkflowId));
                    //Always Verify that the requested amount and approved amount are the same.
                    BankcardTransactionResponsePro BCR = new BankcardTransactionResponsePro();
                    BCR = (BankcardTransactionResponsePro)_Response[0];
                    if (_BCtransaction.TransactionData.Amount != BCR.Amount)
                        MessageBox.Show("The transaction was approved for " + BCR.Amount
                            + " which is an amount not equal to the requested amount of " + _BCtransaction.TransactionData.Amount
                            + ". Please provide alternate payment to complete transaction");
                }

                if (_TT == TransactionType.Authorize)
                {
                    if (CredentialRequired())
                        _BCtransaction.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.Authorize(_sessionToken, _BCtransaction, _applicationProfileId, _merchantProfileId, _serviceIdOrWorkflowId));
                    //Always Verify that the requested amount and approved amount are the same.
                    BankcardTransactionResponsePro BCR = new BankcardTransactionResponsePro();
                    BCR = (BankcardTransactionResponsePro)_Response[0];
                    if (_BCtransaction.TransactionData.Amount != BCR.Amount)
                        MessageBox.Show("The transaction was approved for " + BCR.Amount
                            + " which is an amount not equal to than the requested amount of " + _BCtransaction.TransactionData.Amount
                            + ". Please provide alternate payment to complete transaction");
                }
                if (_TT == TransactionType.Capture)
                {
                    if (CredentialRequired())
                        _BCDifferenceData.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.Capture(_sessionToken, _BCDifferenceData, _applicationProfileId, _serviceId));
                }
                if (_TT == TransactionType.CaptureAll)
                {
                    if (CredentialRequired())
                        _BCDifferenceData.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response = Cwsbc.CaptureAll(_sessionToken, _CaptureDifferenceData, _BatchIds, _applicationProfileId,
                                                 _merchantProfileId, _serviceId);
                }
                if (_TT == TransactionType.CaptureAllAsync)
                {
                    if (CredentialRequired())
                        _BCDifferenceData.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.CaptureAllAsync(_sessionToken, _CaptureDifferenceData, _BatchIds,
                                                        _applicationProfileId, _merchantProfileId, _serviceId));
                }
                if (_TT == TransactionType.CaptureSelective)
                {
                    if (CredentialRequired())
                        _BCDifferenceData.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response = Cwsbc.CaptureSelective(_sessionToken, _TransactionIds, _CaptureDifferenceData,
                                                       _applicationProfileId, _serviceId);
                }
                if (_TT == TransactionType.CaptureSelectiveAsync)
                {
                    if (CredentialRequired())
                        _BCDifferenceData.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.CaptureSelectiveAsync(_sessionToken, _TransactionIds, _CaptureDifferenceData,
                                                              _applicationProfileId, _serviceId));
                }
                if (_TT == TransactionType.ReturnById)
                {
                    if (CredentialRequired())
                        _RDifferenceData.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.ReturnById(_sessionToken, _RDifferenceData, _applicationProfileId, _serviceId));
                }
                if (_TT == TransactionType.Return)
                {
                    if (CredentialRequired())
                        _BCtransaction.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.ReturnUnlinked(_sessionToken, _BCtransaction, _applicationProfileId, _merchantProfileId, _serviceId));
                }
                if (_TT == TransactionType.Adjust)
                {
                    if (CredentialRequired())
                        _ADifferenceData.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.Adjust(_sessionToken, _ADifferenceData, _applicationProfileId, _serviceId));
                }
                if (_TT == TransactionType.Undo)
                {
                    if (CredentialRequired())
                        _UDifferenceData.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.Undo(_sessionToken, _UDifferenceData, _applicationProfileId, _serviceId));
                }
                if (_TT == TransactionType.QueryAccount)
                {
                    if (CredentialRequired())
                        _BCtransaction.Addendum = CredentialsRequired(_serviceId, _credUserName, _credPassword);
                    _Response.Add(Cwsbc.QueryAccount(_sessionToken, _BCtransaction, _applicationProfileId,
                                                     _merchantProfileId, _serviceId));
                }
                if (_TT == TransactionType.Verify)
                    _Response.Add(Cwsbc.Verify(_sessionToken, _BCtransaction, _applicationProfileId, _merchantProfileId, _serviceId));

                List<ResponseDetails> RD = new List<ResponseDetails>();//Convert the response to response details so that we can report on the UI
                if (_Response != null)
                {
                    foreach (Response r in _Response)
                    {
                        if (_SendAcknowledge && r.TransactionId.Length > 0)
                            Cwsbc.Acknowledge(_sessionToken, r.TransactionId, _applicationProfileId, _serviceId);

                        ResponseDetails RDN = new ResponseDetails(0.00M, r, _TT.ToString(), _serviceIdOrWorkflowId, _merchantProfileId, true, TypeCardType.NotSet, "");
                        MessageBox.Show(ProcessResponse(ref RDN));//Pass as reference so we can extract more values from the response
                        RD.Add(RDN);
                    }
                }

                return RD;
            }
            catch (EndpointNotFoundException)
            {
                //In this case the SvcEndpoint was not available. Try the same logic again with the alternate Endpoint
                try
                {
                    SetTxnEndpoint();//Change the endpoint to use the backup.

                    //TODO : Add a copy of the code above once fully tested out.

                    return null;

                }
                catch (EndpointNotFoundException)
                {
                    MessageBox.Show("Neither the primary or secondary endpoints are available. Unable to process.");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unable to AuthorizeAndCapture\r\nError Message : " + ex.Message, "AuthorizeAndCapture Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (System.TimeoutException te)
            {
                //A timeout has occured. Prompt the user if they'd like to query for the last transaction submitted
                if(_BCtransaction != null)
                {
                    DialogResult Result;
                    Result = MessageBox.Show("A timeout has occured. Would you like to query 'RequestTransaction' to obtain transactions with the exact same TenderData? To avoid duplicate charges your code will need to reconcile transactions.",
                                "Request Transaction", MessageBoxButtons.YesNo);
                    if (Result == DialogResult.Yes)
                    {
                        RequestTransaction(_BCtransaction.TenderData);
                    }
                    else { throw te; }
                }
                else{throw te;}
            }
            catch (Exception ex)
            {
                string strErrorId;
                string strErrorMessage;
                if (_FaultHandler.handleTxnFault(ex, out strErrorId, out strErrorMessage))
                { MessageBox.Show(strErrorId + " : " + strErrorMessage); }
                else { MessageBox.Show(ex.Message); }
            }

            return null;
        }
        private string ProcessBankcardTransactionResponsePro(ref ResponseDetails _Response)
        {
            BankcardTransactionResponsePro _BCResponse = new BankcardTransactionResponsePro();
            _BCResponse = (BankcardTransactionResponsePro)_Response.Response;
            string strMessage = "";

            //Set the amount reference
            _Response.TxnAmount = _BCResponse.Amount;

            //Note : IMPORTANT Always verify the approved amount was the same as the requested approval amount for "AuthorizeAndCapture" as well as "Authorize"
            if (_Response.TransactionType == "AuthorizeAndCapture" | _Response.TransactionType == "Authorize")

                if (!_Response.Verbose)
                {// In this case don't present to the user all of the data.
                    if (_BCResponse.Status == Status.Successful)//The transaction was approved
                    {
                        //NOTE : Please reference the developers guide for a more complete explination of the return fields
                        strMessage = "Your '" + _Response.TransactionType + "' transaction was APPROVED"
                            //Note Highly recommended to save
                        + "\r\nTransactionId : " + _BCResponse.TransactionId //The unique id of the transaction. TransactionId is required for all subsequent transactions such as Return, Undo, etc.
                        + "\r\nWorkflowId : " + _Response.WorkflowId
                        + "\r\nMerchantProfileId : " + _Response.MerchantProfileId //Must be stored with the TransactionId in order to identify which merchant sent which transaction. Required to support multi-merchant.
                            //Note Optional but recommended to save
                        + "\r\nStatus Code : " + _BCResponse.StatusCode //Status code generated by the Service Provider. This code should be displayed to the user as verification of the transaction.
                        + "\r\nStatus Message : " + _BCResponse.StatusMessage //Explains the StatusCode which is generated by the Service Provider. This message should be displayed to the user as verification of the transaction.
                        + "\r\nApprovalCode : " + _BCResponse.ApprovalCode //A value returned when a transaction is approved. This value should be printed on the receipt, and also recorded for every off-line transaction, such as a voice authorization. This same data element and value must be provided during settlement. Required.
                        + "\r\nAmount : " + _BCResponse.Amount //Specifies the authorization amount of the transaction. This is the actual amount authorized.
                        ;
                    }
                    if (_BCResponse.Status == Status.Failure)//The transaction was declined
                    {
                        //NOTE : Please reference the developers guide for a more complete explination of the return fields
                        strMessage = "Your '" + _Response.TransactionType + "' transaction was DECLINED"
                            //Note Highly recommended to save
                        + "\r\nTransactionId : " + _BCResponse.TransactionId //The unique id of the transaction. TransactionId is required for all subsequent transactions such as Return, Undo, etc.
                        + "\r\nWorkflowId : " + _Response.WorkflowId
                        + "\r\nMerchantProfileId : " + _Response.MerchantProfileId //Must be stored with the TransactionId in order to identify which merchant sent which transaction. Required to support multi-merchant.
                            //Note Optional but recommended to save
                        + "\r\nStatus Code : " + _BCResponse.StatusCode //Status code generated by the Service Provider. This code should be displayed to the user as verification of the transaction.
                        + "\r\nStatus Message : " + _BCResponse.StatusMessage //Explains the StatusCode which is generated by the Service Provider. This message should be displayed to the user as verification of the transaction.
                        ;
                    }
                    return strMessage;
                }
            if (_BCResponse.Status == Status.Successful)//The transaction was approved
            {
                //NOTE : Please reference the developers guide for a more complete explination of the return fields
                strMessage = "Your '" + _Response.TransactionType + "' transaction was APPROVED"
                    //Note Highly recommended to save
                + "\r\nTransactionId : " + _BCResponse.TransactionId //The unique id of the transaction. TransactionId is required for all subsequent transactions such as Return, Undo, etc.
                + "\r\nWorkflowId : " + _Response.WorkflowId
                + "\r\nMerchantProfileId : " + _Response.MerchantProfileId //Must be stored with the TransactionId in order to identify which merchant sent which transaction. Required to support multi-merchant.
                    //Note Highly recommended to save if Tokenization will be used
                    //+ "\r\nPaymentAccountDataToken : " + _BCResponse.PaymentAccountDataToken //If tokenization purchased this field represents the actual token returned in the transaction for future use.
                    //Note Optional but recommended to save
                + "\r\nStatus Code : " + _BCResponse.StatusCode //Status code generated by the Service Provider. This code should be displayed to the user as verification of the transaction.
                + "\r\nStatus Message : " + _BCResponse.StatusMessage //Explains the StatusCode which is generated by the Service Provider. This message should be displayed to the user as verification of the transaction.
                + "\r\nApprovalCode : " + _BCResponse.ApprovalCode //A value returned when a transaction is approved. This value should be printed on the receipt, and also recorded for every off-line transaction, such as a voice authorization. This same data element and value must be provided during settlement. Required.
                + "\r\nAmount : " + _BCResponse.Amount //Specifies the authorization amount of the transaction. This is the actual amount authorized.
                    //Note Optional but recommended if AVS is supported
                    //+ "\r\nAVSResult ActualResult : " + _BCResponse.AVSResult.ActualResult //Specifies the actual result of AVS from the Service Provider.
                    //+ "\r\nAVSResult AddressResult : " + _BCResponse.AVSResult.AddressResult //Specifies the result of AVS as it pertains to Address matching
                    //+ "\r\nAVSResult PostalCodeResult : " + _BCResponse.AVSResult.PostalCodeResult //Specifies the result of AVS as it pertains to Postal Code matching
                    //Note Optional but recommended if CV data is supported
                + "\r\nCVResult : " + _BCResponse.CVResult //Response code returned by the card issuer indicating the result of Card Verification (CVV2/CVC2/CID).
                    //Note Optional
                + "\r\nPrepaidCard : " + _BCResponse.PrepaidCard // Enumeration of NotSet, Yes, No.  Indicates if this is a pre-paid card
                + "\r\nBatchId : " + _BCResponse.BatchId //A unique ID used to identify a specific batch settlement
                + "\r\nDowngradeCode : " + _BCResponse.DowngradeCode //Indicates downgrade reason.
                + "\r\nFeeAmount : " + _BCResponse.FeeAmount //Fee amount charged for the transaction.
                + "\r\nFinalBalance : " + _BCResponse.FinalBalance //Fee amount charged for the transaction.
                + "\r\nResubmit : " + _BCResponse.Resubmit //Specifies whether resubmission is supported for PIN Debit transactions.
                + "\r\nServiceTransactionId : " + _BCResponse.ServiceTransactionId
                    //+ "\r\nSettlementDate : " + _BCResponse.SettlementDate //Settlement date. Conditional, if present in the authorization response, this same data element and value must be provided during settlement
                ;
            }
            if (_BCResponse.Status == Status.Failure)//The transaction was declined
            {
                //NOTE : Please reference the developers guide for a more complete explination of the return fields
                strMessage = "Your '" + _Response.TransactionType + "' transaction was DECLINED"
                    //Note Highly recommended to save
                + "\r\nTransactionId : " + _BCResponse.TransactionId //The unique id of the transaction. TransactionId is required for all subsequent transactions such as Return, Undo, etc.
                + "\r\nWorkflowId : " + _Response.WorkflowId
                + "\r\nMerchantProfileId : " + _Response.MerchantProfileId //Must be stored with the TransactionId in order to identify which merchant sent which transaction. Required to support multi-merchant.
                    //Note Optional but recommended to save
                + "\r\nStatus Code : " + _BCResponse.StatusCode //Status code generated by the Service Provider. This code should be displayed to the user as verification of the transaction.
                + "\r\nStatus Message : " + _BCResponse.StatusMessage //Explains the StatusCode which is generated by the Service Provider. This message should be displayed to the user as verification of the transaction.
                    //Note Optional but recommended if CV data is supported
                + "\r\nCVResult : " + _BCResponse.CVResult //Response code returned by the card issuer indicating the result of Card Verification (CVV2/CVC2/CID).
                    //Note Optional
                + "\r\nServiceTransactionId : " + _BCResponse.ServiceTransactionId
                ;
            }
            return strMessage;
        }