Check for valid Account and PIN
Name | Type | Length | Description |
---|---|---|---|
account | System.String | 19 | [Required] Account Number of the customer account to access. |
pin | System.String | 10 | [Required] The PIN to validate. This is alphanumeric. |
POST https://server/FusionServices/v2/NaviLine/General/C2GValidateAccountPIN/
Name | Description |
---|---|
ErrorCode | 0000 = OK or 8888 = FAIL |
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 C2GValidateAccountPIN
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,19}$).*", ErrorMessage = "Must be 19 characters or less. ")]
public string account{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,10}$).*", ErrorMessage = "Must be 10 characters or less. ")]
public string pin{get; set;}
public C2GValidateAccountPIN()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the C2GValidateAccountPIN 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.C2GValidateAccountPIN
@{
ViewBag.Title = "C2GValidateAccountPIN";
}
<h2>C2GValidateAccountPIN</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>C2GValidateAccountPIN</legend>
<div class="editor-label">
@Html.LabelFor(model => model.account)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.account)
@Html.ValidationMessageFor(model => model.account)
</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>
<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/C2GValidateAccountPIN
public ActionResult C2GValidateAccountPIN()
{
// Create a new instance of the model to pick up any default values.
C2GValidateAccountPIN model = new C2GValidateAccountPIN();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/C2GValidateAccountPIN.cshtml", model);
}
//
// POST: /MyController/C2GValidateAccountPIN
[HttpPost]
public ActionResult C2GValidateAccountPIN(FormCollection collection)
{
string url = "v2/NaviLine/General/C2GValidateAccountPIN/";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("account", collection["account"]);
inputParms.Add("pin", collection["pin"]);
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", "C2GValidateAccountPIN");
return View("Error", info);
}
}