Example #1
0
        protected ConfirmOrderResponse ConfirmServicePIL(string idRichiesta)
        {
            // Prima PreConferma e poi Conferma
            OrderRequest preconfirmRequest = GetPreConfirmRequest(idRichiesta);
            var          ceHeader          = Helper.GetCeHeader();

            ceHeader.SenderSystem = "H2H";
            ceHeader.IDSender     = "999988";
            ceHeader.IdCRM        = string.Empty;
            ceHeader.UserId       = "nello.citta.npce";
            ceHeader.ContractId   = string.Empty;
            ceHeader.GUIDMessage  = idRichiesta;
            OrderResponse preConfirmResponse = null;
            var           preConfirmResult   = Helper.PublishToBizTalk <OrderRequest, OrderResponse>(preconfirmRequest, ceHeader, ambiente.UrlEntryPoint, out preConfirmResponse);

            Assert.AreEqual(TResultResType.I, preConfirmResult.ResType);
            Thread.Sleep(20000);

            ConfirmOrder         confirmRequest  = GetConfirmRequest(preConfirmResponse.IdOrder, preConfirmResponse.PaymentTypes[0].TypeDescription);
            ConfirmOrderResponse confirmResponse = null;
            var result = Helper.PublishToBizTalk <ConfirmOrder, ConfirmOrderResponse>(confirmRequest, ceHeader, ambiente.UrlEntryPoint, out confirmResponse);

            Assert.AreEqual(TResultResType.I, result.ResType);
            return(confirmResponse);
        }
Example #2
0
        public NpceOperationResult PreConferma(string idRichiesta, bool autoconfirm)
        {
            OrderRequest  orderRequest  = new PosteItaliane.OrderManagement.Schema.SchemaDefinition.OrderRequest();
            OrderResponse orderResponse = null;
            var           ce            = new CE();

            ce.Header             = new CEHeader();
            ce.Header.GUIDMessage = Guid.NewGuid().ToString();
            ce.Header             = new CEHeader
            {
                BillingCenter = _ambiente.billingcenter,
                CodiceFiscale = _ambiente.codicefiscale,
                ContractId    = _ambiente.contractid,
                ContractType  = _ambiente.contracttype,
                CostCenter    = _ambiente.costcenter,
                Customer      = _ambiente.customer,
                IdCRM         = string.Empty,
                SenderSystem  = _ambiente.sendersystem,
                UserId        = _ambiente.smuser,
                PartitaIva    = _ambiente.partitaiva,
                IDSender      = string.Empty,
                UserType      = _ambiente.usertype
            };

            ce.Header.GUIDMessage = idRichiesta;

            orderRequest.ServiceInstance    = new OrderRequestServiceInstance[1];
            orderRequest.ForceOrderCreation = true;

            orderRequest.ServiceInstance[0]             = new OrderRequestServiceInstance();
            orderRequest.ServiceInstance[0].GUIDMessage = idRichiesta;


            ce.Body = SerializationUtility.SerializeToXmlElement(orderRequest);

            using (WsCEClient client = new WsCEClient())
            {
                client.Endpoint.Address = new System.ServiceModel.EndpointAddress(_ambiente.LolUri);
                client.SubmitRequest(ref ce);
                try
                {
                    orderResponse = SerializationUtility.Deserialize <OrderResponse>(ce.Body);
                }
                catch (Exception ex)
                {
                    throw (ex);
                }

                var idOrdine = orderResponse.IdOrder;


                if (autoconfirm)
                {
                    ce = Conferma(orderResponse, ce, client);
                }
            }

            return(CreateResult(NpceOperation.PreConfermaWithAutoconfirm, ce.Result.ResType == TResultResType.I ? "0" : "99", ce.Result.Description?.Substring(0, Math.Min(ce.Result.Description.Length, 500)) ?? "Invio Ok", orderResponse.IdOrder, null, null));
        }
Example #3
0
        protected virtual OrderRequest GetPreConfirmRequest(string idRichiesta)
        {
            OrderRequest orderRequest = new OrderRequest();

            orderRequest.ServiceInstance    = new OrderRequestServiceInstance[1];
            orderRequest.ForceOrderCreation = true;

            orderRequest.ServiceInstance[0]             = new OrderRequestServiceInstance();
            orderRequest.ServiceInstance[0].GUIDMessage = idRichiesta;

            return(orderRequest);
        }