Example #1
0
        public Response CancelPolicyByInsurance(Dictionary <string, object> parameters)
        {
            try
            {
                var insReq = new InsuranceRequest();
                var sess   = new SessionRequest();
                var cancel = new CancelRequest();
                sess.Username = (String)parameters["username"];
                sess.Password = "";

                sess.AuthenticationKey    = (String)parameters["AuthenticationKey"];
                cancel.AccountID          = (String)parameters["accountid"];
                cancel.CancellationReason = (String)parameters["cancellationreason"];
                cancel.CertificateNumber  = (String)parameters["certificatenumber"];
                cancel.ContactEmail       = (String)parameters["contactemail"];
                cancel.DealerName         = (String)parameters["dealername"];
                cancel.Surname            = (String)parameters["surname"];
                cancel.RequestValidation  = (bool)parameters["requestvalidation"];
                cancel.RefundCustomer     = (String)parameters["refundcustomer"];

                cancel.PhoenixCancellation = null;

                insReq.Session      = sess;
                insReq.Cancellation = cancel;

                var response = insuranceWebService.CancelPolicyByInsuranceRequest(insReq);
                return(MethodRespToObject(response));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.InnerException.Message);
                return(null);
            }
        }
        static void nMain(string[] args)
        {
            InsuranceWebService insuranceWebService = new InsuranceWebService();
            var cancel = new CancelRequest();
            var insReq = new InsuranceRequest();
            var sess   = new SessionRequest();

            sess.Username             = "";
            sess.Password             = "";
            sess.AuthenticationKey    = "";
            cancel.AccountID          = "";
            cancel.CancellationReason = "";
            cancel.CertificateNumber  = "";
            cancel.ContactEmail       = "";
            cancel.DealerName         = "";

            //Always Null
            cancel.PhoenixCancellation = null;
            cancel.RequestValidation   = true;
            cancel.RefundCustomer      = ""; //Set As required
            cancel.Surname             = "";
            insReq.Session             = sess;
            insReq.Cancellation        = cancel;

            var response = insuranceWebService.CancelPolicyByInsuranceRequest(insReq);

            if (response.Success)
            {
                Console.WriteLine("Success");
            }
            else
            {
                Console.WriteLine("Fail");
            }
            Console.ReadKey();
        }