Method PostAutoPayUpdate

Summary

Auto Pay Update

Remarks

Use this method to enable or disable autopay.

The options for setting auto pay are:

Verification:

Before setting to eCheck, validate the account numbers by setting transactionCode to V for Validate

Input Parameters

NameTypeLengthDescription
customerNumber numeric 9 [Required] Customer Number. See Account Search methods.
locationNumber numeric 9 [Required] Location Number. See Account Search methods.
transactionCode System.String 1 Transaction Code. R=Search, U=Update, V=Validate. Default is U=Update. Use V to validate eCheck account numbers before saving.
autoPayTypeCode System.String 1 Auto Pay Type Code. N=None R=CreditCard C=Checking Required if U=Update (default). Use N to disable auto-pay.
bankRoutingNumber numeric 9 Bank Routing Number. Required for eCheck.
bankAccountNumber numeric 17 Bank Account Number. Required for eCheck.
autoPayDay numeric 2 Day of month to pay on. If DraftDaysUsed from GetAutoPaySetup is set to Y, then autoPayDay is required when setting to Checking or Credit Card. Use GetAutoPaySetup to get list of valid days.

Example

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

Return Values

NameDescription
AutoPayTypeDescription Description of current auto-pay settings
CustomerLevelAutoPayOnly
ErrorCode Error code returned from the call. 0000 indicates success.
ErrorMessage Error message returned if there was an error.

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/AutoPayUpdate";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("customerNumber",System.Web.HttpUtility.UrlEncode("201"));
   postParms.Add("locationNumber",System.Web.HttpUtility.UrlEncode("28578"));
   postParms.Add("transactionCode",System.Web.HttpUtility.UrlEncode("U"));
   postParms.Add("autoPayTypeCode",System.Web.HttpUtility.UrlEncode("C"));
   postParms.Add("bankRoutingNumber",System.Web.HttpUtility.UrlEncode("111000025"));
   postParms.Add("bankAccountNumber",System.Web.HttpUtility.UrlEncode("2079951060453"));
   postParms.Add("autoPayDay",System.Web.HttpUtility.UrlEncode("5"));

   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 PostAutoPayUpdate
   {
       // 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("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
       public string transactionCode{get; set;}

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

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

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

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

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

@{
   ViewBag.Title = "PostAutoPayUpdate";
}

<h2>PostAutoPayUpdate</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostAutoPayUpdate</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.transactionCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.transactionCode)
           @Html.ValidationMessageFor(model => model.transactionCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.autoPayTypeCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.autoPayTypeCode)
           @Html.ValidationMessageFor(model => model.autoPayTypeCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.bankRoutingNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.bankRoutingNumber)
           @Html.ValidationMessageFor(model => model.bankRoutingNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.bankAccountNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.bankAccountNumber)
           @Html.ValidationMessageFor(model => model.bankAccountNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.autoPayDay)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.autoPayDay)
           @Html.ValidationMessageFor(model => model.autoPayDay)
       </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/PostAutoPayUpdate
public ActionResult PostAutoPayUpdate()
{
   // Create a new instance of the model to pick up any default values.
   PostAutoPayUpdate model =  new PostAutoPayUpdate();

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

// 
// POST: /MyController/PostAutoPayUpdate
[HttpPost]
public ActionResult PostAutoPayUpdate(FormCollection collection)
{
   string url = "v3/Naviline/Utilities/AutoPayUpdate";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("customerNumber", collection["customerNumber"]);
   inputParms.Add("locationNumber", collection["locationNumber"]);
   inputParms.Add("transactionCode", collection["transactionCode"]);
   inputParms.Add("autoPayTypeCode", collection["autoPayTypeCode"]);
   inputParms.Add("bankRoutingNumber", collection["bankRoutingNumber"]);
   inputParms.Add("bankAccountNumber", collection["bankAccountNumber"]);
   inputParms.Add("autoPayDay", collection["autoPayDay"]);

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