public void ResponseOriginal()
    {
        var ws = new RunEngine();

        _response  = ws.SearchCust(new AppHeader(), _request) as SearchResponse;
        _response2 = ws.CancelCust(new AppHeader(), _request2) as CancelResponse;
    }
示例#2
0
        public CancelResponse Cancel(CancelRequest request)
        {
            var response = new CancelResponse();

            response.Success();

            return(response);
        }
示例#3
0
        public async Task Cancel_ServiceReturnsValidJson_ReturnsResponseInstance()
        {
            _messageHandler.SendAsyncReturns(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent("{\"totalCapturedAmount\": 0.0,\"totalAuthorizedAmount\": 248.0}")
            });
            CancelResponse result = await _service.CancelAsync(Factory.GetString(), Factory.GetString());

            Assert.IsType <CancelResponse>(result);
        }
        public Output Cancel(ref SecurityHeaderType Security, RequestHeaderType RequestHeader, Input Input)
        {
            CancelRequest inValue = new CancelRequest();

            inValue.Security      = Security;
            inValue.RequestHeader = RequestHeader;
            inValue.Input         = Input;
            CancelResponse retVal = ((CancelV01)(this)).Cancel(inValue);

            Security = retVal.Security;
            return(retVal.Output);
        }
示例#5
0
        public async Task Create()
        {
            var responseDirect = new DirectResponse();

            using (var directApi = new EbanxDirectOperationApi())
            {
                var r = new DirectRequest
                {
                    Operation = "request",
                    Mode      = "full",
                    Payment   = new PaymentRequest
                    {
                        Name                = "Customer Name",
                        Email               = "*****@*****.**",
                        AmountTotal         = 500,
                        Zipcode             = "000000",
                        Address             = "Rua X",
                        StreetNumber        = "5",
                        City                = "City",
                        State               = "SP",
                        Country             = "BR",
                        PhoneNumber         = "999999999",
                        CurrencyCode        = "BRL",
                        MerchantPaymentCode = Guid.NewGuid().ToString(),
                        Document            = "29479146002",
                        Instalments         = 1,
                        PaymentTypeCode     = "boleto",
                        DueDate             = DateTime.Now.AddDays(3).ToString("dd/MM/yyyy"),
                    }
                };

                responseDirect = await directApi.Create(r);

                var response = new CancelResponse();

                var request = new CancelRequest
                {
                    Hash = responseDirect.Payment.Hash
                };

                using (var api = new EbanxCancelOperationApi(request))
                {
                    response = await api.Create();
                }

                Assert.IsFalse(response.Success);
                //Assert.IsTrue(!string.IsNullOrEmpty(token?.Token));
            }
        }
示例#6
0
        public CancelResponse CancelReservation(string reservationNumber)
        {
            var result = new CancelResponse();

            try
            {
                var api = new Api(CurrentConfiguration);
                result.IsSuccess = api.CancelReservation(reservationNumber);
            }
            catch (Exception ex)
            {
                SetError(result, ex);
            }
            return(result);
        }
示例#7
0
        /// <summary>
        /// 取消订单
        /// </summary>
        /// <param name="ctripOrderId"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public bool CancelOrder(string ctripOrderId, ref string msg)
        {
            CancelRequest req = new CancelRequest(Config);

            req.OTA_Cancel.UniqueIDList.Add(new UniqueID()
            {
                Type = "501", ID = ctripOrderId
            });
            CancelResponse res = ExecutePost(req);

            if (res.Error != null)
            {
                msg = res.Error.Type + ":" + res.Error.Code + ":" + res.Error.Message;
            }
            return(res.IsSuccess);
        }
示例#8
0
        public CancelResponse cancel(CancelRequest req)
        {
            CancelResponse rsp = null;

            try
            {
                var strResp = this.InternalRequest(req, "cancel");

                rsp = JsonConvert.DeserializeObject <CancelResponse>(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new Exception(e.Message);
            }
            return(rsp);
        }
示例#9
0
    public void Response()             /* tried to correct */
    {
        var ws = new RunEngine();

        _response = ws.SearchCust(new AppHeader(), _request) as SearchResponse;
        var customerIds = _response.Customers.Select(c => c.CustID).ToList();

        foreach (var custID in customerIds)
        {
            _request2         = new CancelRequest();
            _request2.CustID  = custID;
            _request2.Company = _request.Company;
            // Seems it should be like this
            _response2 = ws.CancelCust(new AppHeader(), _request2) as CancelResponse;
        }
    }
    public void Response()             /* tried to correct */
    {
        var ws = new RunEngine();

        _response = ws.SearchCust(new AppHeader(), _request) as SearchResponse;
        var customerIds = _response.Customers.Select(c => c.CustID).ToList();

        foreach (var custID in customerIds)
        {
            _request2         = new CancelRequest();
            _request2.CustID  = custID;
            _request2.Company = _request.Company;
            // Seems it should be like this
            // but note the assignment might be wrong, it's according to what `CancelCust` returns
            // for the correct way to make it a list of Customer is appeared in other answers
            _response2 = ws.CancelCust(new AppHeader(), _request2) as CancelResponse;
        }
    }
示例#11
0
        /// <summary>
        /// Invokes the Cancel service.
        /// </summary>
        public IServiceResponse Cancel(IServiceRequest incoming)
        {
            CancelResponse response = null;

            CancelRequest request = (CancelRequest)incoming;

            uint cancelCount = 0;

            response = new CancelResponse();

            response.ResponseHeader = ServerInstance.Cancel(
               request.RequestHeader,
               request.RequestHandle,
               out cancelCount);

            response.CancelCount = cancelCount;

            return response;
        }
示例#12
0
        /// <summary>
        /// Invokes the Cancel service.
        /// </summary>
        public IServiceResponse Cancel(IServiceRequest incoming)
        {
            CancelResponse response = null;

            try
            {
                // OnRequestReceived(incoming);

                CancelRequest request = (CancelRequest)incoming;

                uint cancelCount = 0;

                response = new CancelResponse();

                response.ResponseHeader = ServerInstance.Cancel(
                   request.RequestHeader,
                   request.RequestHandle,
                   out cancelCount);

                response.CancelCount = cancelCount;
            }
            finally
            {
                // OnResponseSent(response);
            }

            return response;
        }
示例#13
0
        /// <summary>
        /// Initializes the message with a service fault.
        /// </summary>
        public CancelResponseMessage(ServiceFault ServiceFault)
        {
            this.CancelResponse = new CancelResponse();

            if (ServiceFault != null)
            {
                this.CancelResponse.ResponseHeader = ServiceFault.ResponseHeader;
            }
        }
示例#14
0
 /// <summary>
 /// Initializes the message with the body.
 /// </summary>
 public CancelResponseMessage(CancelResponse CancelResponse)
 {
     this.CancelResponse = CancelResponse;
 }
示例#15
0
        /// <summary cref="IServiceMessage.CreateResponse" />
        public object CreateResponse(IServiceResponse response)
        {
            CancelResponse body = response as CancelResponse;

            if (body == null)
            {
                body = new CancelResponse();
                body.ResponseHeader = ((ServiceFault)response).ResponseHeader;
            }

            return new CancelResponseMessage(body);
        }