コード例 #1
0
        //-----------------------------------------------------------------------------------------
        // CardReleaseAuth - Releases a previously held authorization.
        //  Returns the tranactionCode for the request.
        //-----------------------------------------------------------------------------------------
        public string CardReleaseAuth(string authTransCode, System.Windows.Forms.TextBox tbResults)
        {
            var transCode = "";
            var svc       = GetPaymentEngineService();

            try
            {
                CardReleaseRequest request = new CardReleaseRequest
                {
                    TransactionCode = authTransCode
                };

                CardResponse response = svc.CardRelease(_accessKey, _storeCode, _deviceCode, request);  // StoreCode and DeviceCode are not required if you are using a device AccessKey.

                List <string> msg = new List <string>();
                if (response.Status == CardRequestStatus.Approved)
                {
                    transCode = response.TransactionCode;

                    msg.Add(string.Format("CardRelease() succeeded.  Transaction Code:{0}", response.TransactionCode));
                    msg.Add(string.Format("    Current Balance={0}, Available Balance={1} ", response.CurrentBalance, response.AvailableBalance));
                }
                else
                {
                    msg.Add(string.Format("CardRelease() FAILED.  Status={0} ", response.Status));
                    msg.Add(string.Format("    Message:{0} ", response.Message));
                }
                tbResults.Lines = msg.ToArray();

                svc.Close(); // Closes the transport channel.
                svc = null;
            }
            catch (bLoyal.Connectors.ApiException ex)
            {
                if (ex != null && !string.IsNullOrWhiteSpace(ex.Code) && ex.Code == "ServiceRedirect")
                {
                    ServiceURLHelper.IsbLoyalServiceUrlDown = true;
                }
                _logger.WriteLogError(ex, "CardReleaseAuth in PaymentEngineConnector");
            }
            catch (Exception ex)
            {
                _logger.WriteLogError(ex, "CardReleaseAuth in PaymentEngineConnector");
            }
            finally
            {
                if (svc != null)
                {
                    svc.Abort();
                }
            }
            return(transCode);
        }
コード例 #2
0
        //-----------------------------------------------------------------------------------------
        // CardReleaseAuth - Releases a previously held authorization.
        //  Returns the tranactionCode for the request.
        //-----------------------------------------------------------------------------------------
        public string CardReleaseAuth(string authTransCode, System.Windows.Forms.TextBox tbResults)
        {
            var transCode = "";
            var svc       = GetPaymentEngineService();

            try
            {
                CardReleaseRequest request = new CardReleaseRequest();

                request.TransactionCode = authTransCode;

                CardResponse  response = svc.CardRelease(_accessKey, _storeCode, _deviceCode, request); // StoreCode and DeviceCode are not required if you are using a device AccessKey.
                List <string> msg      = new List <string>();
                if (response.Status == CardRequestStatus.Approved)
                {
                    transCode = response.TransactionCode;

                    msg.Add(string.Format("CardRelease() succeeded.  Transaction Code:{0}", response.TransactionCode));
                    msg.Add(string.Format("    Current Balance={0}, Available Balance={1} ", response.CurrentBalance, response.AvailableBalance));
                }
                else
                {
                    msg.Add(string.Format("CardRelease() FAILED.  Status={0} ", response.Status));
                    msg.Add(string.Format("    Message:{0} ", response.Message));
                }
                tbResults.Lines = msg.ToArray();

                svc.Close(); // Closes the transport channel.
                svc = null;
            }
            catch (System.Exception ex)
            {
                tbResults.Text = string.Format("CardRelease() failed.  Exception: {0}", ex.ToString());
            }
            finally
            {
                if (svc != null)
                {
                    svc.Abort();
                }
            }
            return(transCode);
        }