Exemple #1
0
        private string GetString(CyberSource.ICSReply csReply, string key)
        {
            string Value = csReply[key];

            if ((Value == null) || (Value.Length == 0))
            {
                return("");
            }
            if (Value[Value.Length - 1] == 0x0000)
            {
                Value = Value.Substring(0, Value.Length - 1);
            }
            return(Value);
        }
Exemple #2
0
        private decimal GetAmount(CyberSource.ICSReply csReply, string key)
        {
            string Value = csReply[key];

            if ((Value == null) || (Value.Length == 0))
            {
                return(0);
            }
            if (Value[Value.Length - 1] == 0x0000)
            {
                Value = Value.Substring(0, Value.Length - 1);
            }
            return(Convert.ToDecimal(Value));
        }
Exemple #3
0
        internal CyberResponse(CyberSource.ICSReply csReply, ServiceRequest Request, int ID)
        {
            RequestID     = GetString(csReply, "request_id");
            ReturnCode    = GetString(csReply, "ics_rcode");
            Message       = GetString(csReply, "ics_rmsg");
            ActualMessage = GetString(csReply, "ics_rmsg");
            Flag          = GetString(csReply, "ics_rflag");
            AuthCode      = GetString(csReply, "auth_auth_code");
            switch (Request.Operation)
            {
            case ServiceOperation.Auth:
                _Amount       = GetAmount(csReply, "auth_auth_amount");
                _Trans_Ref_No = GetString(csReply, "auth_trans_ref_no");
                if (!IsRequestSuccessful && !this.IsReauthCandidate)
                {
                    _IsComplete = true;
                }
                break;

            case ServiceOperation.Bill:
                _Amount       = GetAmount(csReply, "bill_bill_amount");
                _Trans_Ref_No = GetString(csReply, "bill_trans_ref_no");
                if (IsRequestSuccessful)
                {
                    _IsComplete = true;
                }
                break;

            case ServiceOperation.Credit:
                _Amount       = GetAmount(csReply, "credit_credit_amount");
                _Trans_Ref_No = GetString(csReply, "credit_trans_ref_no");
                if (IsRequestSuccessful)
                {
                    _IsComplete = true;
                }
                break;

            case ServiceOperation.Process:
                _Amount       = GetAmount(csReply, "bill_bill_amount");
                _Trans_Ref_No = GetString(csReply, "bill_trans_ref_no");
                if (IsRequestSuccessful)
                {
                    _IsComplete = true;
                }
                break;

            case ServiceOperation.ReAuth:
                _Amount       = GetAmount(csReply, "auth_auth_amount");
                _Trans_Ref_No = GetString(csReply, "auth_trans_ref_no");
                break;

            case ServiceOperation.Reverse:
                _Amount       = GetAmount(csReply, "auth_reversal_amount");
                _Trans_Ref_No = "";
                break;
            }
            if (!IsRequestSuccessful)
            {
                string msg = Config.Setting("EM_" + Flag);
                if (msg.Length == 0)
                {
                    msg = Config.Setting("EM_DEFAULT");
                }
                if (msg.Length > 0)
                {
                    Message = msg + "\r\n\r\n(Error Code: " + Flag + ")";
                }
                ReturnCode = String.Empty;
            }
            _ID = ID;
        }