Exemple #1
0
        private IList <XmlDocument> CreateRequests()
        {
            using (new MethodLogger(s_logger))
            {
                try
                {
                    var reqs        = new List <XmlDocument>();
                    var userSigData = new ebics.SignaturePubKeyOrderDataType
                    {
                        PartnerID           = Config.User.PartnerId,
                        UserID              = Config.User.UserId,
                        SignaturePubKeyInfo = new ebics.SignaturePubKeyInfoType
                        {
                            SignatureVersion = "A005",
                            PubKeyValue      = Config.User.SignKeys.PubKeyValueType1,
                        },
                    };
                    var doc = XMLSerializeToDocument(userSigData).OuterXml;
                    s_logger.LogDebug("User signature data:\n{data}", doc);

                    var compressed =
                        Compress(
                            Encoding.UTF8.GetBytes(doc));
                    var req = new ebics.ebicsUnsecuredRequest
                    {
                        header = new ebics.ebicsUnsecuredRequestHeader
                        {
                            @static = new ebics.UnsecuredRequestStaticHeaderType
                            {
                                HostID         = Config.User.HostId,
                                PartnerID      = Config.User.PartnerId,
                                UserID         = Config.User.UserId,
                                Product        = Config.ProductElementType,
                                SecurityMedium = Params.SecurityMedium,
                                OrderDetails   = new ebics.UnsecuredReqOrderDetailsType
                                {
                                    OrderType      = OrderType,
                                    OrderAttribute = OrderAttribute
                                }
                            },
                            mutable = new ebics.EmptyMutableHeaderType(),
                        },
                        body = new ebics.ebicsUnsecuredRequestBody
                        {
                            DataTransfer = new ebics.ebicsUnsecuredRequestBodyDataTransfer
                            {
                                OrderData = new ebics.ebicsUnsecuredRequestBodyDataTransferOrderData
                                {
                                    Value = compressed
                                }
                            }
                        },
                        Version  = "H004",
                        Revision = "1"
                    };

                    reqs.Add(XMLSerializeToDocument(req));
                    return(reqs);
                }
                catch (EbicsException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new CreateRequestException($"can't create requests for {OrderType}", ex);
                }
            }
        }
Exemple #2
0
        private IList <XmlDocument> CreateRequests()
        {
            using (new MethodLogger(s_logger))
            {
                try
                {
                    var reqs = new List <XmlDocument>();
                    var h    = new ebics.HIARequestOrderDataType
                    {
                        PartnerID = Config.User.PartnerId,
                        UserID    = Config.User.UserId,
                        AuthenticationPubKeyInfo = new ebics.AuthenticationPubKeyInfoType
                        {
                            AuthenticationVersion = "X002",
                            PubKeyValue           = Config.User.AuthKeys.PubKeyValueType,
                        },
                        EncryptionPubKeyInfo = new ebics.EncryptionPubKeyInfoType
                        {
                            EncryptionVersion = "E002",
                            PubKeyValue       = Config.User.CryptKeys.PubKeyValueType,
                        }
                    };

                    var compressed =
                        Compress(Encoding.UTF8.GetBytes(
                                     XMLSerializeToDocument(h).OuterXml));
                    var b64Encoded = Convert.ToBase64String(compressed);

                    var req = new ebics.ebicsUnsecuredRequest
                    {
                        header = new ebics.ebicsUnsecuredRequestHeader
                        {
                            @static = new ebics.UnsecuredRequestStaticHeaderType
                            {
                                HostID         = Config.User.HostId,
                                PartnerID      = Config.User.PartnerId,
                                UserID         = Config.User.UserId,
                                Product        = Config.ProductElementType,
                                SecurityMedium = Params.SecurityMedium,
                                OrderDetails   = new ebics.UnsecuredReqOrderDetailsType
                                {
                                    OrderType      = OrderType,
                                    OrderAttribute = OrderAttribute
                                }
                            },
                            mutable = new ebics.EmptyMutableHeaderType {
                            },
                        },
                        body = new ebics.ebicsUnsecuredRequestBody
                        {
                            DataTransfer = new ebics.ebicsUnsecuredRequestBodyDataTransfer
                            {
                                OrderData = new ebics.ebicsUnsecuredRequestBodyDataTransferOrderData
                                {
                                    Value = compressed
                                }
                            }
                        },
                        Version  = "H004",
                        Revision = "1"
                    };
                    //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(XMLSerializeToDocument(req));
                    return(reqs);
                }
                catch (EbicsException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new CreateRequestException($"can't create requests for {OrderType}", ex);
                }
            }
        }