protected override void BuildXmlHead(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartDocument();

            xmlRequestBuilder.WriteStartElement("merchant.request"); // <merchant.request>

            xmlRequestBuilder.WriteStartElement("signtags");         // <signtags>

            xmlRequestBuilder.WriteElement("wmid", Initializer.Id.ToString());
            xmlRequestBuilder.WriteElement("validityperiodinhours", Lifetime.ToString(CultureInfo.InvariantCulture));

            ulong requestNumber = Initializer.GetRequestNumber();

            switch (Initializer.Mode)
            {
            case AuthorizationMode.Merchant:
                xmlRequestBuilder.WriteElement(
                    "md5", Utilities.CryptographyUtility.ComputeHash(BuildMessage(requestNumber) + Initializer.SecretKey));
                break;

            case AuthorizationMode.Classic:
                xmlRequestBuilder.WriteElement("sign", Initializer.Sign(BuildMessage(requestNumber)));
                break;

            default:
                throw new InvalidOperationException("Initializer.Mode=" + Initializer.Mode);
            }

            xmlRequestBuilder.WriteEndElement(); // </signtags>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("trust"); // <trust>

            xmlRequestBuilder.AppendAttribute("inv", InvoiceAllowed ? 1 : 0);
            xmlRequestBuilder.AppendAttribute("trans", TransferAllowed ? 1 : 0);
            xmlRequestBuilder.AppendAttribute("purse", BalanceAllowed ? 1 : 0);
            xmlRequestBuilder.AppendAttribute("transhist", HistoryAllowed ? 1 : 0);

            xmlRequestBuilder.WriteElement("masterwmid", Master.ToString());
            xmlRequestBuilder.WriteElement("slavewmid", Initializer.Id.ToString());
            xmlRequestBuilder.WriteElement("purse", Purse.ToString());

            xmlRequestBuilder.WriteElement("limit", Limit.ToString());
            xmlRequestBuilder.WriteElement("daylimit", DayLimit.ToString());
            xmlRequestBuilder.WriteElement("weeklimit", WeekLimit.ToString());
            xmlRequestBuilder.WriteElement("monthlimit", MonthLimit.ToString());

            xmlRequestBuilder.WriteEndElement(); // </trust>
        }
Exemple #3
0
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("invoice"); // <invoice>

            xmlRequestBuilder.WriteElement("orderid", OrderId);
            xmlRequestBuilder.WriteElement("customerwmid", SourceWmId.ToString());
            xmlRequestBuilder.WriteElement("storepurse", TargetPurse.ToString());
            xmlRequestBuilder.WriteElement("amount", Amount.ToString());
            xmlRequestBuilder.WriteElement("desc", Description);
            xmlRequestBuilder.WriteElement("address", Address);
            xmlRequestBuilder.WriteElement("period", Period);
            xmlRequestBuilder.WriteElement("expiration", Expiration);
            xmlRequestBuilder.WriteElement("onlyauth", Force ? 0 : 1);

            if (null != ShopId)
            {
                xmlRequestBuilder.WriteElement("lmi_shop_id", ShopId.Value);
            }

            xmlRequestBuilder.WriteEndElement(); // </invoice>
        }
Exemple #4
0
        protected override void WriteContent(XmlWriter xmlWriter)
        {
            if (null == xmlWriter)
            {
                throw new ArgumentNullException(nameof(xmlWriter));
            }

            var xmlRequestBuilder = new XmlRequestBuilder(xmlWriter);

            xmlRequestBuilder.WriteStartElement("trustlimits"); // <trustlimits>
            xmlRequestBuilder.WriteStartElement("getlevels");   // <getlevels>

            xmlRequestBuilder.WriteElement("wmid", WmId.ToString());

            xmlRequestBuilder.WriteEndElement(); // </getlevels>
            xmlRequestBuilder.WriteEndElement(); // </trustlimits>
        }
Exemple #5
0
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("paymer2purse"); // <paymer2purse>

            xmlRequestBuilder.WriteElement("purse", Purse.ToString());

            xmlRequestBuilder.WriteStartElement("paymer"); // <paymer>
            xmlRequestBuilder.WriteElement("number", Number);
            xmlRequestBuilder.WriteElement("code", Code);
            xmlRequestBuilder.WriteEndElement(); // </paymer>

            xmlRequestBuilder.WriteEndElement(); // </paymer2purse>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("rejectprotect"); // <rejectprotect>

            xmlRequestBuilder.WriteElement("wmtranid", OperationId);

            xmlRequestBuilder.WriteEndElement(); // </rejectprotect>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("getpurses"); // <getpurses>

            xmlRequestBuilder.WriteElement("wmid", WmId.ToString());

            xmlRequestBuilder.WriteEndElement(); // </getpurses>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("invoicerefuse"); // <invoicerefuse>

            xmlRequestBuilder.WriteElement("wmid", WmId.ToString());
            xmlRequestBuilder.WriteElement("wminvid", InvoiceId);

            xmlRequestBuilder.WriteEndElement(); // </invoicerefuse>
        }
Exemple #9
0
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("message"); // <message>

            xmlRequestBuilder.WriteElement("receiverwmid", WmId.ToString());
            xmlRequestBuilder.WriteElement("msgsubj", Subject);
            xmlRequestBuilder.WriteElement("msgtext", Content);

            xmlRequestBuilder.WriteEndElement(); // </message>
        }
        protected override void WriteContent(XmlWriter xmlWriter)
        {
            if (null == xmlWriter)
            {
                throw new ArgumentNullException(nameof(xmlWriter));
            }

            var xmlRequestBuilder = new XmlRequestBuilder(xmlWriter);

            xmlRequestBuilder.WriteStartElement("WMIDLevel.request"); // <WMIDLevel.request>

            xmlRequestBuilder.WriteElement("wmid", WmId.ToString());

            xmlRequestBuilder.WriteEndElement(); // </WMIDLevel.request>
        }
Exemple #11
0
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("testsign"); // <testsign>

            xmlRequestBuilder.WriteElement("wmid", WmId.ToString());
            xmlRequestBuilder.WriteElement("plan", Message);
            xmlRequestBuilder.WriteElement("sign", Signature);

            xmlRequestBuilder.WriteEndElement(); // </testsign>
        }
Exemple #12
0
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("trans"); // <trans>

            xmlRequestBuilder.WriteElement("inwmtranid", OperationId);
            xmlRequestBuilder.WriteElement("amount", Amount.ToString());
            xmlRequestBuilder.WriteElement("moneybackphone", Phone.ToString());

            xmlRequestBuilder.WriteEndElement(); // </trans>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("createpurse"); // <createpurse>

            xmlRequestBuilder.WriteElement("wmid", WmId.ToString());
            xmlRequestBuilder.WriteElement("pursetype", Purse.CurrencyToLetter(PurseType).ToString());
            xmlRequestBuilder.WriteElement("desc", Description);

            xmlRequestBuilder.WriteEndElement(); // </createpurse>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("getininvoices"); // <getininvoices>

            xmlRequestBuilder.WriteElement("wmid", WmId.ToString());
            xmlRequestBuilder.WriteElement("wminvid", InvoiceId);
            xmlRequestBuilder.WriteElement("datestart", StartTime.ToServerString());
            xmlRequestBuilder.WriteElement("datefinish", FinishTime.ToServerString());

            xmlRequestBuilder.WriteEndElement(); // </getininvoices>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteElement("passportwmid", WmId.ToString());

            xmlRequestBuilder.WriteStartElement("params"); // <params>

            xmlRequestBuilder.WriteElement("dict", 0);
            xmlRequestBuilder.WriteElement("info", 1);
            xmlRequestBuilder.WriteElement("mode", AuthorizationMode.Classic == Initializer.Mode ? 1 : 0);

            xmlRequestBuilder.WriteEndElement(); // </params>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("getoperations"); // <getoperations>

            xmlRequestBuilder.WriteElement("purse", Purse.ToString());
            xmlRequestBuilder.WriteElement("wmtranid", OperationId);
            xmlRequestBuilder.WriteElement("tranid", TransferId);
            xmlRequestBuilder.WriteElement("wminvid", InvoiceId);
            xmlRequestBuilder.WriteElement("orderid", OrderId);
            xmlRequestBuilder.WriteElement("datestart", StartTime.ToServerString());
            xmlRequestBuilder.WriteElement("datefinish", FinishTime.ToServerString());

            xmlRequestBuilder.WriteEndElement(); // </getoperations>
        }
        protected override void BuildXmlHead(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartDocument();

            ulong requestNumber = Initializer.GetRequestNumber();

            xmlRequestBuilder.WriteStartElement("request"); // <request>
            xmlRequestBuilder.WriteElement("wmid", Initializer.Id.ToString());

            xmlRequestBuilder.WriteElement("sign",
                                           AuthorizationMode.Classic == Initializer.Mode
                    ? Initializer.Sign(BuildMessage(requestNumber))
                    : string.Empty);
        }
        protected override void WriteContent(XmlWriter xmlWriter)
        {
            if (null == xmlWriter)
            {
                throw new ArgumentNullException(nameof(xmlWriter));
            }

            var xmlRequestBuilder = new XmlRequestBuilder(xmlWriter);

            xmlRequestBuilder.WriteStartElement("cards.webmoney.request"); // <cards.webmoney.request>

            var wmId = Initializer.Id;

            xmlRequestBuilder.WriteElement("wmid", wmId.ToString());
            xmlRequestBuilder.WriteElement("signstr", Initializer.Sign($"{wmId}{wmId}"));
            xmlRequestBuilder.WriteElement("clientwmid", wmId.ToString());

            xmlRequestBuilder.WriteEndElement(); // </cards.webmoney.request>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("paymenttags"); // <paymenttags>

            xmlRequestBuilder.WriteElement("lmi_payee_purse", StorePurse.ToString());
            xmlRequestBuilder.WriteElement("lmi_payment_amount", Amount.ToString());
            xmlRequestBuilder.WriteElement("lmi_payment_no", OrderId);
            xmlRequestBuilder.WriteElement("lmi_payment_desc", Description);

            // Добавочные
            xmlRequestBuilder.WriteElement("lmi_payment_desc", Description);

            xmlRequestBuilder.WriteEndElement(); // </paymenttags>
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("testwmpurse"); // <testwmpurse>

            if (WmId.HasValue)
            {
                xmlRequestBuilder.WriteElement("wmid", WmId.ToString());
            }

            if (Purse.HasValue)
            {
                xmlRequestBuilder.WriteElement("purse", Purse.ToString());
            }

            xmlRequestBuilder.WriteEndElement(); // </testwmpurse>
        }
Exemple #21
0
        protected virtual void BuildXmlHead(XmlRequestBuilder requestBuilder)
        {
            if (null == requestBuilder)
            {
                throw new ArgumentNullException(nameof(requestBuilder));
            }

            requestBuilder.WriteStartDocument();

            requestBuilder.WriteStartElement("w3s.request"); // <w3s.request>

            ulong requestNumber = Initializer.GetRequestNumber();

            requestBuilder.WriteElement("reqn", requestNumber);

            if (AuthorizationMode.Classic == Initializer.Mode)
            {
                requestBuilder.WriteElement("wmid", Initializer.Id.ToString());
                requestBuilder.WriteElement("sign", Initializer.Sign(BuildMessage(requestNumber)));
            }
        }
Exemple #22
0
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartElement("trans"); // <trans>

            xmlRequestBuilder.WriteElement("tranid", TransferId);
            xmlRequestBuilder.WriteElement("pursesrc", SourcePurse.ToString());
            xmlRequestBuilder.WriteElement("pursedest", TargetPurse.ToString());
            xmlRequestBuilder.WriteElement("amount", Amount.ToString());
            xmlRequestBuilder.WriteElement("period", Period);
            xmlRequestBuilder.WriteElement("pcode", Code);
            xmlRequestBuilder.WriteElement("desc", Description);
            xmlRequestBuilder.WriteElement("wminvid", InvoiceId);
            xmlRequestBuilder.WriteElement("onlyauth", Force ? 0 : 1);
            xmlRequestBuilder.WriteElement("wmb_denomination", string.Empty);

            xmlRequestBuilder.WriteEndElement(); // </trans>
        }
Exemple #23
0
        protected override void BuildXmlHead(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteStartDocument();

            xmlRequestBuilder.WriteStartElement("contract.request"); // <contract.request>

            ulong requestNumber = Initializer.GetRequestNumber();

            if (AuthorizationMode.Classic == Initializer.Mode)
            {
                xmlRequestBuilder.WriteElement("wmid", Initializer.Id.ToString());
                xmlRequestBuilder.WriteElement("sign", Initializer.Sign(BuildMessage(requestNumber)));
            }
            else
            {
                throw new InvalidOperationException("AuthorizationMode.Classic != Initializer.Mode");
            }
        }