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 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 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))); } }
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"); } }