示例#1
0
        private IList <XmlDocument> CreateRequests()
        {
            using (new MethodLogger(s_logger))
            {
                try
                {
                    var reqs        = new List <XmlDocument>();
                    var userSigData = new SignaturePubKeyOrderData
                    {
                        PartnerId  = Config.User.PartnerId,
                        UserId     = Config.User.UserId,
                        SignKeys   = Config.User.SignKeys,
                        Namespaces = Namespaces
                    };

                    s_logger.LogDebug("User signature data:\n{data}", userSigData.Serialize().ToString());

                    var compressed =
                        Compress(
                            Encoding.UTF8.GetBytes(userSigData.Serialize().ToString(SaveOptions.DisableFormatting)));
                    var b64encoded = Convert.ToBase64String(compressed);

                    var req = new EbicsUnsecuredRequest
                    {
                        StaticHeader = new StaticHeader
                        {
                            HostId         = Config.User.HostId,
                            PartnerId      = Config.User.PartnerId,
                            UserId         = Config.User.UserId,
                            SecurityMedium = Params.SecurityMedium,
                            Namespaces     = Namespaces,
                            OrderDetails   = new OrderDetails
                            {
                                OrderType      = OrderType,
                                OrderAttribute = OrderAttribute,
                                Namespaces     = Namespaces
                            }
                        },
                        MutableHeader = new MutableHeader
                        {
                            Namespaces = Namespaces
                        },
                        Body = new Body
                        {
                            Namespaces   = Namespaces,
                            DataTransfer = new DataTransfer
                            {
                                OrderData  = b64encoded,
                                Namespaces = Namespaces
                            }
                        },
                        Version    = Config.Version,
                        Revision   = Config.Revision,
                        Namespaces = Namespaces
                    };

                    reqs.Add(req.Serialize().ToXmlDocument());
                    return(reqs);
                }
                catch (EbicsException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new CreateRequestException($"can't create requests for {OrderType}", ex);
                }
            }
        }
示例#2
0
        private IList <XmlDocument> CreateRequests()
        {
            using (new MethodLogger(s_logger))
            {
                try
                {
                    var reqs = new List <XmlDocument>();

                    var hiaOrderData = new HiaRequestOrderData
                    {
                        Namespaces = Namespaces,
                        PartnerId  = Config.User.PartnerId,
                        UserId     = Config.User.UserId,
                        AuthInfo   = new AuthenticationPubKeyInfo
                        {
                            Namespaces = Namespaces,
                            AuthKeys   = Config.User.AuthKeys,
                            UseEbicsDefaultNamespace = true
                        },
                        EncInfo = new EncryptionPubKeyInfo
                        {
                            Namespaces = Namespaces,
                            CryptKeys  = Config.User.CryptKeys,
                            UseEbicsDefaultNamespace = true
                        }
                    };

                    var compressed =
                        Compress(Encoding.UTF8.GetBytes(
                                     hiaOrderData.Serialize().ToString(SaveOptions.DisableFormatting)));
                    var b64Encoded = Convert.ToBase64String(compressed);

                    var req = new EbicsUnsecuredRequest
                    {
                        StaticHeader = new StaticHeader
                        {
                            HostId         = Config.User.HostId,
                            PartnerId      = Config.User.PartnerId,
                            UserId         = Config.User.UserId,
                            SecurityMedium = Params.SecurityMedium,
                            Namespaces     = Namespaces,
                            OrderDetails   = new OrderDetails
                            {
                                OrderType      = OrderType,
                                OrderAttribute = OrderAttribute,
                                Namespaces     = Namespaces
                            }
                        },
                        MutableHeader = new MutableHeader
                        {
                            Namespaces = Namespaces
                        },
                        Body = new Body
                        {
                            Namespaces   = Namespaces,
                            DataTransfer = new DataTransfer
                            {
                                OrderData  = b64Encoded,
                                Namespaces = Namespaces
                            }
                        },
                        Namespaces = Namespaces,
                        Version    = Config.Version,
                        Revision   = Config.Revision,
                    };

                    reqs.Add(req.Serialize().ToXmlDocument());
                    return(reqs);
                }
                catch (EbicsException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new CreateRequestException($"can't create requests for {OrderType}", ex);
                }
            }
        }