Method PostAutoPayOnBillDueDate

Summary

Auto Pay on Bill Due Date

Remarks

This sets up Auto Pay payments starting on the Bill Due Date.

Input Parameters

NameTypeLengthDescription
customerNumber numeric 9 [Required] Customer Number. See Account Search methods.
locationNumber numeric 9 [Required] Location Number. See Account Search methods.
paymentAmount amount 0 [Required] Amount paid, including the decimal. Example: "2.50" = $2.50
dueDate mmddyyyy 0 Date the payment is due. Defaults to current date. Format: mmddyyyy

Example

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

Return Values

NameDescription
ErrorCode 0000 = Successful
ErrorMessage error message if any error occurred.

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/RecurringPayment";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("customerNumber",System.Web.HttpUtility.UrlEncode("000000339"));
   postParms.Add("locationNumber",System.Web.HttpUtility.UrlEncode("000012588"));
   postParms.Add("paymentAmount",System.Web.HttpUtility.UrlEncode("2"));

   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 PostAutoPayOnBillDueDate
   {
       // 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;}

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

       [RegularExpression("^(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])(19|20)\\d\\d$", ErrorMessage = "Date values only. Format: MMDDYYYY")]
       public string dueDate{get; set;}

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

@{
   ViewBag.Title = "PostAutoPayOnBillDueDate";
}

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

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

// 
// POST: /MyController/PostAutoPayOnBillDueDate
[HttpPost]
public ActionResult PostAutoPayOnBillDueDate(FormCollection collection)
{
   string url = "v3/Naviline/Utilities/RecurringPayment";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("customerNumber", collection["customerNumber"]);
   inputParms.Add("locationNumber", collection["locationNumber"]);
   inputParms.Add("paymentAmount", collection["paymentAmount"]);
   inputParms.Add("dueDate", collection["dueDate"]);

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