Example #1
0
        public string XMLSerializeGenPackNumbers(authData auth, Sender senderData, Receiver receiverData, parcels[] parcelsList, string PayerType = "SENDER")
        {
            XmlSerializer serializer = new XmlSerializer(typeof(SOAPEnvelope));

            SOAPEnvelope se   = new SOAPEnvelope();
            SAOPBody     body = new SAOPBody();

            var gpn = new genPackNumbers();

            gpn.pkgNumsGenerationPolicyV1 = "ALL_OR_NOTHING";
            gpn.langCode = "PL";

            var packages = new packages
            {
                parcels   = parcelsList,
                payerType = PayerType,
                receiver  = receiverData,
                sender    = senderData,
                ref1      = "",
                ref2      = "",
                ref3      = ""
            };

            var openUML = new openUML();

            openUML.packages = packages;

            gpn.openUMLV1  = openUML;
            gpn.authDataV1 = auth;

            body.generatePackagesNumbersV2 = gpn;

            se.Body = body;

            using (StringWriter textWriter = new Utf8StringWriter())
            {
                serializer.Serialize(textWriter, se);
                return(textWriter.ToString());
            }
        }
 public void setAuth(authData auth)
 {
     authorize = auth;
 }