예제 #1
0
        /// <summary>
        /// Encodes all the string Member properties as Base64 strings
        /// </summary>
        public void Encode()
        {
            if (IsEncoded)
            {
                return;
            }

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

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


            IsEncoded = true;
        }
        public void Encode()
        {
            if (!string.IsNullOrEmpty(MerchantID))
            {
                MerchantID = EncodingUtils.Base64Encode(MerchantID);
            }
            if (!string.IsNullOrEmpty(Account))
            {
                Account = EncodingUtils.Base64Encode(Account);
            }
            if (!string.IsNullOrEmpty(Amount))
            {
                Amount = EncodingUtils.Base64Encode(Amount);
            }
            if (!string.IsNullOrEmpty(AuthCode))
            {
                AuthCode = EncodingUtils.Base64Encode(AuthCode);
            }
            if (!string.IsNullOrEmpty(BatchID))
            {
                BatchID = EncodingUtils.Base64Encode(BatchID);
            }
            if (!string.IsNullOrEmpty(CAVV))
            {
                CAVV = EncodingUtils.Base64Encode(CAVV);
            }
            if (!string.IsNullOrEmpty(CVNResult))
            {
                CVNResult = EncodingUtils.Base64Encode(CVNResult);
            }
            if (!string.IsNullOrEmpty(ECI))
            {
                ECI = EncodingUtils.Base64Encode(ECI);
            }
            if (!string.IsNullOrEmpty(Comment1))
            {
                Comment1 = EncodingUtils.Base64Encode(Comment1);
            }
            if (!string.IsNullOrEmpty(Comment2))
            {
                Comment2 = EncodingUtils.Base64Encode(Comment2);
            }
            if (!string.IsNullOrEmpty(Message))
            {
                Message = EncodingUtils.Base64Encode(Message);
            }
            if (!string.IsNullOrEmpty(PASRef))
            {
                PASRef = EncodingUtils.Base64Encode(PASRef);
            }
            if (!string.IsNullOrEmpty(Hash))
            {
                Hash = EncodingUtils.Base64Encode(Hash);
            }
            if (!string.IsNullOrEmpty(Result))
            {
                Result = EncodingUtils.Base64Encode(Result);
            }
            if (!string.IsNullOrEmpty(XID))
            {
                XID = EncodingUtils.Base64Encode(XID);
            }
            if (!string.IsNullOrEmpty(OrderID))
            {
                OrderID = EncodingUtils.Base64Encode(OrderID);
            }
            if (!string.IsNullOrEmpty(Timestamp))
            {
                Timestamp = EncodingUtils.Base64Encode(Timestamp);
            }


            if (TSS != null && TSS.Keys.Count > 0)
            {
                foreach (string k in TSS.Keys)
                {
                    TSS[k] = EncodingUtils.Base64Encode(TSS[k]);
                }
            }

            if (SupplementaryData != null && SupplementaryData.Keys.Count > 0)
            {
                foreach (string k in SupplementaryData.Keys)
                {
                    SupplementaryData[k] = EncodingUtils.Base64Encode(SupplementaryData[k]);
                }
            }
            IsEncoded = true;
        }
 public TmsAuthenticationRequest(string username, string password)
 {
     UserName = username;
     Password = EncodingUtils.Base64Encode(password);
     Otp      = Jwt = string.Empty;
 }