Method PostValidateAcctPin

Summary

Validate Account Pin

Remarks

This method allows you to retrieve, validate, or update a vendor's PIN number. Use the type field to indicate which type of PIN transaction you are doing.

Input Parameters

NameTypeLengthDescription
type System.String 1 Transaction type code. V=Validate PIN (default), P=Provide PIN, U=Update PIN, W=Write PIN, S=Return reminder phrase, D=Delete PIN
accountNumber numeric 10 [Required] Vendor's account number
pin numeric 10 Current PIN number to validate. Required, except for Provide PIN.
newPin numeric 10 New PIN number to validate. Only required for Update PIN.
iaf System.String 1 Internet Active A=Active, I=Inactive. Blank=ignored (default).
pras System.String 50 Reminder Phrase. Use U=Update PIN to set the reminder phrase. Use S=Return reminder phrase to retrieve it. Optional.

Example

POST http://localhost/FusionServices/v3/Naviline/ProductInventory/ValidateAcctPin

Return Values

NameDescription
ErrorCode 0000 = PIN is valid.
ErrorMessage Blank if success, otherwise returns a descriptive error message.
PinNumber Current PIN number
InternetActive
ReminderPhrase Text phrase to remind user of PIN.

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/ProductInventory/ValidateAcctPin";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("type",System.Web.HttpUtility.UrlEncode("V"));
   postParms.Add("accountNumber",System.Web.HttpUtility.UrlEncode("9990000004"));
   postParms.Add("pin",System.Web.HttpUtility.UrlEncode("4870614052"));

   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 PostValidateAcctPin
   {
       // Add property for each input param in order to map a field to it
       [RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
       public string type{get; set;}

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

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

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

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

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

       public PostValidateAcctPin()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostValidateAcctPin 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.PostValidateAcctPin

@{
   ViewBag.Title = "PostValidateAcctPin";
}

<h2>PostValidateAcctPin</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostValidateAcctPin</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.type)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.type)
           @Html.ValidationMessageFor(model => model.type)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.accountNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.accountNumber)
           @Html.ValidationMessageFor(model => model.accountNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.pin)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.pin)
           @Html.ValidationMessageFor(model => model.pin)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.newPin)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.newPin)
           @Html.ValidationMessageFor(model => model.newPin)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.iaf)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.iaf)
           @Html.ValidationMessageFor(model => model.iaf)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.pras)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.pras)
           @Html.ValidationMessageFor(model => model.pras)
       </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/PostValidateAcctPin
public ActionResult PostValidateAcctPin()
{
   // Create a new instance of the model to pick up any default values.
   PostValidateAcctPin model =  new PostValidateAcctPin();

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

// 
// POST: /MyController/PostValidateAcctPin
[HttpPost]
public ActionResult PostValidateAcctPin(FormCollection collection)
{
   string url = "v3/Naviline/ProductInventory/ValidateAcctPin";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("type", collection["type"]);
   inputParms.Add("accountNumber", collection["accountNumber"]);
   inputParms.Add("pin", collection["pin"]);
   inputParms.Add("newPin", collection["newPin"]);
   inputParms.Add("iaf", collection["iaf"]);
   inputParms.Add("pras", collection["pras"]);

   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", "PostValidateAcctPin");
       return View("Error", info);
   }
}