/// <summary> /// Конструктор, использующийся для инициализации WebMoneyAccessor ключом Keeper Classic /// </summary> public WebMoneyAccessor() { var wmAccountDictionary = WebMoneyUtil.Instance.GetWmAccountSettings(); if (wmAccountDictionary == null) { Logger.Error("WebMoneyAccessor() - не удалось прочитать необходимые для инициализировать WebMoney параметры (wmId, purseNumber и др.)"); return; } keeperKeyValue = wmAccountDictionary["WmKeeperKeyValue"].ToString(); targetPurseNumber = (ulong)wmAccountDictionary["WmTargetPurseNumber"]; wmId = (WmId)(ulong)wmAccountDictionary["WmId"]; var targetPurseType = WebMoneyUtil.StrToCurrency(wmAccountDictionary["WmPurseCurrency"].ToString()); purse = new Purse { Number = targetPurseNumber, Type = targetPurseType }; var keeperKey = new KeeperKey(keeperKeyValue); initializer = new Initializer(wmId, keeperKey) { StartDate = new DateTime(1983, 1, 1).ToUniversalTime() }; initializer.Apply(); wmServerTimeDifference = (WmDateTime.ServerTime2UtcTime(DateTime.Now).Hour - DateTime.Now.ToUniversalTime().Hour); }
public WmDateTime?SelectWmDateTimeIfExists(string xPath) { if (string.IsNullOrEmpty(xPath)) { throw new ArgumentNullException(nameof(xPath)); } var text = TrySelectNotEmptyString(xPath); if (null == text) { return(null); } if (text.Equals("0000-00-00 00:00:00", StringComparison.OrdinalIgnoreCase)) { return(default(DateTime)); } if (!WmDateTime.TryParseServerString(text, out var wmDateTime)) { throw new FormatException(string.Format(CultureInfo.InvariantCulture, "The value '{0}' of the element '{1}' is not in a correct format.", text, xPath)); } return(wmDateTime); }
protected override void Fill(WmXmlPackage wmXmlPackage) { if (null == wmXmlPackage) { throw new ArgumentNullException(nameof(wmXmlPackage)); } PrimaryId = wmXmlPackage.SelectInt64("ininvoice/@id"); SecondaryId = wmXmlPackage.SelectInt64("ininvoice/@ts"); State = (InvoiceState)wmXmlPackage.SelectUInt32("ininvoice/state"); UpdateTime = wmXmlPackage.SelectWmDateTime("ininvoice/dateupd"); }
internal void Fill(WmXmlPackage wmXmlPackage) { if (null == wmXmlPackage) { throw new ArgumentNullException(nameof(wmXmlPackage)); } WmId = wmXmlPackage.SelectWmId("@wmid"); Alias = wmXmlPackage.SelectString("@nickname"); Description = wmXmlPackage.SelectString("@info"); RegistrationDate = wmXmlPackage.SelectWmDateTime("@datereg"); }
protected override void Fill(WmXmlPackage wmXmlPackage) { if (null == wmXmlPackage) { throw new ArgumentNullException(nameof(wmXmlPackage)); } Id = wmXmlPackage.SelectUInt32("operation/@id"); Ts = wmXmlPackage.SelectUInt32("operation/@ts"); TransferType = (TransferType)wmXmlPackage.SelectInt32("operation/opertype"); UpdateTime = wmXmlPackage.SelectWmDateTime("operation/dateupd"); }
protected override void Fill(WmXmlPackage wmXmlPackage) { if (null == wmXmlPackage) { throw new ArgumentNullException(nameof(wmXmlPackage)); } Id = wmXmlPackage.SelectUInt32("message/@id"); WmId = wmXmlPackage.SelectWmId("message/receiverwmid"); Subject = (Description)wmXmlPackage.SelectString("message/msgsubj"); Content = (Message)wmXmlPackage.SelectNotEmptyString("message/msgtext"); CreateTime = wmXmlPackage.SelectWmDateTime("message/datecrt"); }
protected override void Fill(WmXmlPackage wmXmlPackage) { if (null == wmXmlPackage) { throw new ArgumentNullException(nameof(wmXmlPackage)); } Id = wmXmlPackage.SelectUInt32("operation/@id"); Ts = wmXmlPackage.SelectUInt32("operation/@ts"); OperationId = wmXmlPackage.SelectUInt32("operation/inwmtranid"); SourcePurse = wmXmlPackage.SelectPurse("operation/pursesrc"); TargetPurse = wmXmlPackage.SelectPurse("operation/pursedest"); Amount = wmXmlPackage.SelectAmount("operation/amount"); Commission = wmXmlPackage.SelectAmount("operation/comiss"); Description = (Description)wmXmlPackage.SelectString("operation/desc"); CreateTime = wmXmlPackage.SelectWmDateTime("operation/datecrt"); UpdateTime = wmXmlPackage.SelectWmDateTime("operation/dateupd"); }
public static DateTime GetServerTime(this WmDateTime time) { var str = time.ToServerString(); return(DateTime.ParseExact(str, "yyyyMMdd HH:mm:ss", CultureInfo.InvariantCulture)); }
public OutgoingInvoiceFilter(Purse purse, WmDateTime startTime, WmDateTime finishTime) { Purse = purse; StartTime = startTime; FinishTime = finishTime; }
public IncomingInvoiceFilter(WmId wmId, WmDateTime startTime, WmDateTime finishTime) { WmId = wmId; StartTime = startTime; FinishTime = finishTime; }
public TransferFilter(Purse purse, WmDateTime startTime, WmDateTime finishTime) { Purse = purse; StartTime = startTime; FinishTime = finishTime; }
protected override void Inspect(XmlPackage xmlPackage) { if (null == xmlPackage) { throw new ArgumentNullException(nameof(xmlPackage)); } var wmXmlPackage = (WmXmlPackage)xmlPackage; int errorNumber = wmXmlPackage.SelectInt32("retval"); if (0 != errorNumber) { MerchantOperationObtainerException.ErrorExtendedInfo errorExtendedInfo = null; if (wmXmlPackage.Exists("errorlog/err_code")) { string extendedErrorNumberValue = wmXmlPackage.SelectString("errorlog/err_code"); if (!string.IsNullOrEmpty(extendedErrorNumberValue)) { errorExtendedInfo = new MerchantOperationObtainerException.ErrorExtendedInfo { ExtendedErrorNumber = int.Parse(extendedErrorNumberValue, CultureInfo.InvariantCulture.NumberFormat), StorePurse = wmXmlPackage.SelectPurse("errorlog/@lmi_payee_purse"), OrderId = wmXmlPackage.SelectInt32("errorlog/@lmi_payment_no"), PaymentInfoCreateTime = wmXmlPackage.SelectWmDateTime("errorlog/datecrt"), PaymentInfoUpdateTime = wmXmlPackage.SelectWmDateTime("errorlog/dateupd") }; var enterTimeValue = wmXmlPackage.SelectString("errorlog/date_s"); if (!string.IsNullOrEmpty(enterTimeValue)) { errorExtendedInfo.EnterTime = WmDateTime.ParseServerString(enterTimeValue); } var authorizationTimeValue = wmXmlPackage.SelectString("errorlog/date_pc"); if (!string.IsNullOrEmpty(authorizationTimeValue)) { errorExtendedInfo.AuthorizationTime = WmDateTime.ParseServerString(authorizationTimeValue); } var confirmationTimeValue = wmXmlPackage.SelectString("errorlog/date_pd"); if (!string.IsNullOrEmpty(confirmationTimeValue)) { errorExtendedInfo.ConfirmationTime = WmDateTime.ParseServerString(confirmationTimeValue); } errorExtendedInfo.SiteId = wmXmlPackage.SelectInt32("errorlog/siteid"); // TODO: [L] Расшифровать errorlog/siteid errorExtendedInfo.PaymentMethod = wmXmlPackage.SelectString("errorlog/att"); // TODO: [L] Расшифровать errorlog/att } } throw new MerchantOperationObtainerException(errorNumber, xmlPackage.SelectString("retdesc")) { ExtendedInfo = errorExtendedInfo }; } }