コード例 #1
0
        public void Decode()
        {
            if (!string.IsNullOrEmpty(MerchantID))
            {
                MerchantID = EncodingUtils.Base64Decode(MerchantID);
            }
            if (!string.IsNullOrEmpty(Account))
            {
                Account = EncodingUtils.Base64Decode(Account);
            }
            if (!string.IsNullOrEmpty(Amount))
            {
                Amount = EncodingUtils.Base64Decode(Amount);
            }
            if (!string.IsNullOrEmpty(AuthCode))
            {
                AuthCode = EncodingUtils.Base64Decode(AuthCode);
            }
            if (!string.IsNullOrEmpty(BatchID))
            {
                BatchID = EncodingUtils.Base64Decode(BatchID);
            }
            if (!string.IsNullOrEmpty(CAVV))
            {
                CAVV = EncodingUtils.Base64Decode(CAVV);
            }
            if (!string.IsNullOrEmpty(CVNResult))
            {
                CVNResult = EncodingUtils.Base64Decode(CVNResult);
            }
            if (!string.IsNullOrEmpty(ECI))
            {
                ECI = EncodingUtils.Base64Decode(ECI);
            }
            if (!string.IsNullOrEmpty(Comment1))
            {
                Comment1 = EncodingUtils.Base64Decode(Comment1);
            }
            if (!string.IsNullOrEmpty(Comment2))
            {
                Comment2 = EncodingUtils.Base64Decode(Comment2);
            }
            if (!string.IsNullOrEmpty(Message))
            {
                Message = EncodingUtils.Base64Decode(Message);
            }
            if (!string.IsNullOrEmpty(PASRef))
            {
                PASRef = EncodingUtils.Base64Decode(PASRef);
            }
            if (!string.IsNullOrEmpty(Hash))
            {
                Hash = EncodingUtils.Base64Decode(Hash);
            }
            if (!string.IsNullOrEmpty(Result))
            {
                Result = EncodingUtils.Base64Decode(Result);
            }
            if (!string.IsNullOrEmpty(XID))
            {
                XID = EncodingUtils.Base64Decode(XID);
            }
            if (!string.IsNullOrEmpty(OrderID))
            {
                OrderID = EncodingUtils.Base64Decode(OrderID);
            }
            if (!string.IsNullOrEmpty(Timestamp))
            {
                Timestamp = EncodingUtils.Base64Decode(Timestamp);
            }


            if (TSS != null && TSS.Keys.Count > 0)
            {
                var newTSS = TSS.Select(kpv => new KeyValuePair <string, string>(kpv.Key, EncodingUtils.Base64Decode(kpv.Value))).ToList <KeyValuePair <string, string> >();
                TSS.Clear();
                foreach (KeyValuePair <string, string> kpv in newTSS)
                {
                    TSS.Add(kpv.Key, kpv.Value);
                }
            }

            if (SupplementaryData != null && SupplementaryData.Keys.Count > 0)
            {
                var newTSS = SupplementaryData.Select(kpv => new KeyValuePair <string, string>(kpv.Key, EncodingUtils.Base64Decode(kpv.Value))).ToList <KeyValuePair <string, string> >();
                SupplementaryData.Clear();
                foreach (KeyValuePair <string, string> kpv in newTSS)
                {
                    SupplementaryData.Add(kpv.Key, kpv.Value);
                }
            }


            IsEncoded = false;
        }
コード例 #2
0
        /// <summary>
        /// Decodes all the string Member properties from Base64 strings
        /// </summary>
        public void Decode()
        {
            if (!IsEncoded)
            {
                return;
            }

            if (!string.IsNullOrEmpty(MerchantID))
            {
                MerchantID = EncodingUtils.Base64Decode(MerchantID);
            }
            if (!string.IsNullOrEmpty(Account))
            {
                Account = EncodingUtils.Base64Decode(Account);
            }
            if (!string.IsNullOrEmpty(Channel))
            {
                Channel = EncodingUtils.Base64Decode(Channel);
            }
            if (!string.IsNullOrEmpty(OrderID))
            {
                OrderID = EncodingUtils.Base64Decode(OrderID);
            }
            if (!string.IsNullOrEmpty(Amount))
            {
                Amount = EncodingUtils.Base64Decode(Amount);
            }
            if (!string.IsNullOrEmpty(Currency))
            {
                Currency = EncodingUtils.Base64Decode(Currency);
            }
            if (!string.IsNullOrEmpty(Timestamp))
            {
                Timestamp = EncodingUtils.Base64Decode(Timestamp);
            }
            if (!string.IsNullOrEmpty(Hash))
            {
                Hash = EncodingUtils.Base64Decode(Hash);
            }
            if (!string.IsNullOrEmpty(AutoSettleFlag))
            {
                AutoSettleFlag = EncodingUtils.Base64Decode(AutoSettleFlag);
            }
            if (!string.IsNullOrEmpty(Comment1))
            {
                Comment1 = EncodingUtils.Base64Decode(Comment1);
            }
            if (!string.IsNullOrEmpty(Comment2))
            {
                Comment2 = EncodingUtils.Base64Decode(Comment2);
            }
            if (!string.IsNullOrEmpty(ReturnTSS))
            {
                ReturnTSS = EncodingUtils.Base64Decode(ReturnTSS);
            }
            if (!string.IsNullOrEmpty(ShippingCode))
            {
                ShippingCode = EncodingUtils.Base64Decode(ShippingCode);
            }
            if (!string.IsNullOrEmpty(ShippingCountry))
            {
                ShippingCountry = EncodingUtils.Base64Decode(ShippingCountry);
            }
            if (!string.IsNullOrEmpty(BillingCode))
            {
                BillingCode = EncodingUtils.Base64Decode(BillingCode);
            }
            if (!string.IsNullOrEmpty(BillingCountry))
            {
                BillingCountry = EncodingUtils.Base64Decode(BillingCountry);
            }
            if (!string.IsNullOrEmpty(CardPaymentButtonText))
            {
                CardPaymentButtonText = EncodingUtils.Base64Decode(CardPaymentButtonText);
            }
            if (!string.IsNullOrEmpty(CustomerNumber))
            {
                CustomerNumber = EncodingUtils.Base64Decode(CustomerNumber);
            }
            if (!string.IsNullOrEmpty(VariableReference))
            {
                VariableReference = EncodingUtils.Base64Decode(VariableReference);
            }
            if (!string.IsNullOrEmpty(ProductID))
            {
                ProductID = EncodingUtils.Base64Decode(ProductID);
            }
            if (!string.IsNullOrEmpty(Language))
            {
                Language = EncodingUtils.Base64Decode(Language);
            }
            if (!string.IsNullOrEmpty(CardStorageEnable))
            {
                CardStorageEnable = EncodingUtils.Base64Decode(CardStorageEnable);
            }
            if (!string.IsNullOrEmpty(OfferSaveCard))
            {
                OfferSaveCard = EncodingUtils.Base64Decode(OfferSaveCard);
            }
            if (!string.IsNullOrEmpty(PayerReference))
            {
                PayerReference = EncodingUtils.Base64Decode(PayerReference);
            }
            if (!string.IsNullOrEmpty(PaymentReference))
            {
                PaymentReference = EncodingUtils.Base64Decode(PaymentReference);
            }
            if (!string.IsNullOrEmpty(PayerExists))
            {
                PayerExists = EncodingUtils.Base64Decode(PayerExists);
            }
            if (!string.IsNullOrEmpty(DCCEnable))
            {
                DCCEnable = EncodingUtils.Base64Decode(DCCEnable);
            }
            if (!string.IsNullOrEmpty(HPPFraudFilterMode))
            {
                HPPFraudFilterMode = EncodingUtils.Base64Decode(HPPFraudFilterMode);
            }
            if (!string.IsNullOrEmpty(HPPVersion))
            {
                HPPVersion = EncodingUtils.Base64Decode(HPPVersion);
            }
            if (!string.IsNullOrEmpty(HPPSelectStoredCard))
            {
                HPPSelectStoredCard = EncodingUtils.Base64Decode(HPPSelectStoredCard);
            }

            if (SupplementaryData != null && SupplementaryData.Keys.Count > 0)
            {
                var decoded = SupplementaryData.Select(kpv => new KeyValuePair <string, string>(kpv.Key, EncodingUtils.Base64Decode(kpv.Value))).ToList <KeyValuePair <string, string> >();
                SupplementaryData.Clear();
                foreach (KeyValuePair <string, string> kpv in decoded)
                {
                    SupplementaryData.Add(kpv.Key, kpv.Value);
                }
            }


            IsEncoded = false;
        }