Method PostValidatePin

Summary

Validate account ownership

Remarks

When accessing an account online, it will prompt you for your account information to validate it is your account.

Cities may have different fields required for validation. This method takes the information entered and validates that it is correct for the account number.

Set the validation fields to Y to indicate which fields are to be validated. Then pass in the values for those fields.

Returns 0000 if all fields are valid. Otherwise it the ErrorMessage will indicate which field was invalid.

Input Parameters

NameTypeLengthDescription
customerNumber numeric 9 [Required] Customer Number. See Account Search methods.
locationNumber numeric 9 [Required] Location Number. See Account Search methods.
valBillDate yn 1 Y/N flag to enable Bill Date validation.
billDate mmddyy 6 Bill Date. Format: mmddyy
valDueDate yn 1 Y/N flag to enable Due Date validation.
dueDate mmddyy 6 Bill Due Date. Format: mmddyy
valPrevBal yn 1 Y/N flag to enable Previous Balance validation.
prevBal amount 9 Previous Balance Amount on current bill.
valBillAmt yn 1 Y/N flag to enable Bill Amount validation.
billAmt amount 9 Amount charged on current bill.
valCycleRoute yn 1 Y/N flag to enable Cycle Route validation.
cycleRoute numeric 4 Cycle and Route number. Must be 4 digits. Ex. 0102 = Cycle 1 Route 2
valLastPayAmt yn 1 Y/N flag to enable Last Paid Amount validation.
lastPayAmt amount 9 Amount paid on last bill.
valLastPayDate yn 1 Y/N flag to enable Last Paid Date validation.
lastPayDate mmddyy 6 Date last payment was made. Format: mmddyy

Example

POST http://localhost/FusionServices/v3/Naviline/Utilities/ValidatePin

Return Values

NameDescription
ErrorCode 0000 = Successful
ErrorMessage error message indicating which field was invalid

Sample Responses

Sample Code

using System.Net;
using Newtonsoft.Json.Linq;

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/ValidatePin";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("customerNumber",System.Web.HttpUtility.UrlEncode("000000191"));
   postParms.Add("locationNumber",System.Web.HttpUtility.UrlEncode("000020530"));
   postParms.Add("valBillDate",System.Web.HttpUtility.UrlEncode("N"));
   postParms.Add("valDueDate",System.Web.HttpUtility.UrlEncode("Y"));
   postParms.Add("valPrevBal",System.Web.HttpUtility.UrlEncode(""));
   postParms.Add("valBillAmt",System.Web.HttpUtility.UrlEncode("Y"));
   postParms.Add("valCycleRoute",System.Web.HttpUtility.UrlEncode("Y"));
   postParms.Add("valLastPayAmt",System.Web.HttpUtility.UrlEncode(""));
   postParms.Add("valLastPayDate",System.Web.HttpUtility.UrlEncode(""));
   postParms.Add("billDate",System.Web.HttpUtility.UrlEncode("033114"));
   postParms.Add("dueDate",System.Web.HttpUtility.UrlEncode("040414"));
   postParms.Add("prevBal",System.Web.HttpUtility.UrlEncode("000000000"));
   postParms.Add("billAmt",System.Web.HttpUtility.UrlEncode("000008594"));
   postParms.Add("cycleRoute",System.Web.HttpUtility.UrlEncode("0221"));
   postParms.Add("lastPayAmt",System.Web.HttpUtility.UrlEncode("000000000"));
   postParms.Add("lastPayDate",System.Web.HttpUtility.UrlEncode(""));

   WebClient req = new WebClient();
   wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
   wc.Headers.Set("X-APPID", "YOURID");
   wc.Headers.Set("X-APPKEY", "YOURKEY");

   byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
   string stringResult = Encoding.UTF8.GetString(responseBytes); 
   JObject response = JObject.Parse(stringResult);
   string error = response["OutputParms"]["ErrorCode"].ToString();
   if (error == "0000")
   {
         // TODO - YOUR CODE HERE
   }
}

C# Razor MVC Sample Code

using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;

// NOTE: Use the namespace generated when you add the class, so that it is correct.
namespace FusionRazor.Models
{
   public class PostValidatePin
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
       public string customerNumber{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
       public string locationNumber{get; set;}

       [RegularExpression("^[YN]{0,1}$", ErrorMessage = "Must be Y or N.")]
       public string valBillDate{get; set;}

       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string billDate{get; set;}

       [RegularExpression("^[YN]{0,1}$", ErrorMessage = "Must be Y or N.")]
       public string valDueDate{get; set;}

       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string dueDate{get; set;}

       [RegularExpression("^[YN]{0,1}$", ErrorMessage = "Must be Y or N.")]
       public string valPrevBal{get; set;}

       [RegularExpression("^\\d{1,8}\\.(\\d{2,2})$", ErrorMessage = "Amount values only.  Example: 1234.56")]
       public string prevBal{get; set;}

       [RegularExpression("^[YN]{0,1}$", ErrorMessage = "Must be Y or N.")]
       public string valBillAmt{get; set;}

       [RegularExpression("^\\d{1,8}\\.(\\d{2,2})$", ErrorMessage = "Amount values only.  Example: 1234.56")]
       public string billAmt{get; set;}

       [RegularExpression("^[YN]{0,1}$", ErrorMessage = "Must be Y or N.")]
       public string valCycleRoute{get; set;}

       [RegularExpression("[0-9]{0,4}", ErrorMessage = "Numeric values only. Must be 4 digits or less. ")]
       public string cycleRoute{get; set;}

       [RegularExpression("^[YN]{0,1}$", ErrorMessage = "Must be Y or N.")]
       public string valLastPayAmt{get; set;}

       [RegularExpression("^\\d{1,8}\\.(\\d{2,2})$", ErrorMessage = "Amount values only.  Example: 1234.56")]
       public string lastPayAmt{get; set;}

       [RegularExpression("^[YN]{0,1}$", ErrorMessage = "Must be Y or N.")]
       public string valLastPayDate{get; set;}

       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string lastPayDate{get; set;}

       public PostValidatePin()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostValidatePin class. *@
@* NOTE: Select Edit as the Scaffold template. *@
@* NOTE: Use the @model line that is generated at the top.  Replace the rest with the lines below.
@model FusionRazor.Models.PostValidatePin

@{
   ViewBag.Title = "PostValidatePin";
}

<h2>PostValidatePin</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostValidatePin</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.customerNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.customerNumber)
           @Html.ValidationMessageFor(model => model.customerNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.locationNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.locationNumber)
           @Html.ValidationMessageFor(model => model.locationNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.valBillDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.valBillDate)
           @Html.ValidationMessageFor(model => model.valBillDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.billDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.billDate)
           @Html.ValidationMessageFor(model => model.billDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.valDueDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.valDueDate)
           @Html.ValidationMessageFor(model => model.valDueDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.dueDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.dueDate)
           @Html.ValidationMessageFor(model => model.dueDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.valPrevBal)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.valPrevBal)
           @Html.ValidationMessageFor(model => model.valPrevBal)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.prevBal)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.prevBal)
           @Html.ValidationMessageFor(model => model.prevBal)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.valBillAmt)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.valBillAmt)
           @Html.ValidationMessageFor(model => model.valBillAmt)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.billAmt)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.billAmt)
           @Html.ValidationMessageFor(model => model.billAmt)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.valCycleRoute)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.valCycleRoute)
           @Html.ValidationMessageFor(model => model.valCycleRoute)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.cycleRoute)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.cycleRoute)
           @Html.ValidationMessageFor(model => model.cycleRoute)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.valLastPayAmt)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.valLastPayAmt)
           @Html.ValidationMessageFor(model => model.valLastPayAmt)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.lastPayAmt)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.lastPayAmt)
           @Html.ValidationMessageFor(model => model.lastPayAmt)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.valLastPayDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.valLastPayDate)
           @Html.ValidationMessageFor(model => model.valLastPayDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.lastPayDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.lastPayDate)
           @Html.ValidationMessageFor(model => model.lastPayDate)
       </div>
       <p>
       <input type="submit" value="Submit"/>
       </p>
   </fieldset>

}

@section Scripts {
   @Scripts.Render("~/bundles/jqueryval")
}
using System;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FusionServiceHelper.Models;

// NOTE: Replace 'MyController' with the name of your controller.

// 
// GET: /MyController/PostValidatePin
public ActionResult PostValidatePin()
{
   // Create a new instance of the model to pick up any default values.
   PostValidatePin model =  new PostValidatePin();

   // pass model to set to default values
   // NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
   return View("~/Views/MyFolderPath/PostValidatePin.cshtml", model);
}

// 
// POST: /MyController/PostValidatePin
[HttpPost]
public ActionResult PostValidatePin(FormCollection collection)
{
   string url = "v3/Naviline/Utilities/ValidatePin";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("customerNumber", collection["customerNumber"]);
   inputParms.Add("locationNumber", collection["locationNumber"]);
   inputParms.Add("valBillDate", collection["valBillDate"]);
   inputParms.Add("billDate", collection["billDate"]);
   inputParms.Add("valDueDate", collection["valDueDate"]);
   inputParms.Add("dueDate", collection["dueDate"]);
   inputParms.Add("valPrevBal", collection["valPrevBal"]);
   inputParms.Add("prevBal", collection["prevBal"]);
   inputParms.Add("valBillAmt", collection["valBillAmt"]);
   inputParms.Add("billAmt", collection["billAmt"]);
   inputParms.Add("valCycleRoute", collection["valCycleRoute"]);
   inputParms.Add("cycleRoute", collection["cycleRoute"]);
   inputParms.Add("valLastPayAmt", collection["valLastPayAmt"]);
   inputParms.Add("lastPayAmt", collection["lastPayAmt"]);
   inputParms.Add("valLastPayDate", collection["valLastPayDate"]);
   inputParms.Add("lastPayDate", collection["lastPayDate"]);

   try
   {
       // Send the request
       FusionServiceRequest request = new FusionServiceRequest();
       FusionServiceResult result = request.Post(url, inputParms);

       return View("Result", result);
   }
   catch(Exception e)
   {
       HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "PostValidatePin");
       return View("Error", info);
   }
}