void CreateInstanceFromYookassa(string[] data, PaymentByCardOnlineFrom paymentFrom)
        {
            var culture = CultureInfo.CreateSpecificCulture("ru-RU");

            culture.NumberFormat.NumberDecimalSeparator = ".";

            if (!decimal.TryParse(data[1].Trim(), NumberStyles.AllowDecimalPoint, culture.NumberFormat, out paymentRUR))
            {
                paymentRUR = 0m;
            }

            DateAndTime = ParseDate(data[4].Trim());

            if (!int.TryParse(GetNumberFromDescription(data[6], ref paymentFrom), out paymentNr))
            {
                paymentNr = 0;
            }

            //Проверяем дополнительно здесь, т.к. по одной из касс прилетают оплаты трех форматов
            if (paymentNr < 1000000 && paymentFrom == PaymentByCardOnlineFrom.FromSMS)
            {
                paymentFrom = PaymentByCardOnlineFrom.FromVodovozWebSite;
            }

            PaymentByCardFrom = paymentFrom;

            PaymentStatus = PaymentStatus.CONFIRMED;

            Email = GetEmailFromDescription(data[6]);
        }
 private void TryMatchPaymentFrom(string data, ref PaymentByCardOnlineFrom paymentByCardFrom)
 {
     if (data == VodovozString || data == VodovozString2)
     {
         paymentByCardFrom = PaymentByCardOnlineFrom.FromSMS;
     }
     else if (data == ShopVodovozString)
     {
         paymentByCardFrom = PaymentByCardOnlineFrom.FromEShop;
     }
     else if (data == ShopVodovozUberserverString)
     {
         paymentByCardFrom = PaymentByCardOnlineFrom.FromVodovozWebSite;
     }
     else
     {
         throw new ArgumentException("Невозможно определить откуда оплата.");
     }
 }
Example #3
0
        void CreateInstanceFromYookassa(string[] data, PaymentByCardOnlineFrom paymentFrom)
        {
            var culture = CultureInfo.CreateSpecificCulture("ru-RU");

            culture.NumberFormat.NumberDecimalSeparator = ".";

            if (!decimal.TryParse(data[1].Trim(), NumberStyles.AllowDecimalPoint, culture.NumberFormat, out paymentRUR))
            {
                paymentRUR = 0m;
            }

            DateAndTime = ParseDate(data[4].Trim());

            if (!int.TryParse(GetNumberFromDescription(data[6], ref paymentFrom), out paymentNr))
            {
                paymentNr = 0;
            }

            PaymentByCardFrom = paymentFrom;

            PaymentStatus = PaymentStatus.CONFIRMED;

            Email = GetEmailFromDescription(data[6]);
        }
 public PaymentByCardOnline(string[] data, PaymentByCardOnlineFrom paymentFrom)
 {
     CreateInstanceFromYookassa(data, paymentFrom);
 }