Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



InPay provides a REST Web Service Interface that allows two-way flow of information to external systems. This enables automated and efficient transfer of data to and from your other systems reducing effort and duplication.  

If you wish to know the commercials or costs involved in using Web Services then please contact the Client Account Management team. If you would like to enable the use of Web Services please contact our Support team and an estimate will be raised. It will need to be enabled on your system and a set of credentials for accessing the service will be supplied.

The full technical https://inpay.es.rsmuk.com/WebServicesREST/Help

Scenarios and uses

This section describes various scenarios of how the Web Services can be used.

Authentication

Before you can call any other InPay Web Service method you must first call the authenticate() method. Providing valid credentials to this method will return an authentication token that must be provided with all other Web Service calls. 

Data Retrieval (Read operations)

There are a number of methods that enable you to read back the full details of an entity.  Examples are api/Person/{employeeNo} where providing the correct employee number will return the full Person object and  api/Payment/{employeeNo} which will return all the permanent payments in the system for an employee 

Data Creation (Write Operations)

It is now possible to create data in InPay via the Web Services. This includes the following the person entity and many of the entities related to the worker (for example pension and absence records)

C# Code

Authenticate

private string Authenticate()

{

string token = null;

if (String.IsNullOrEmpty(username.Text) || String.IsNullOrEmpty(password.Text) || String.IsNullOrEmpty(companyID.Text))

{

return "Credentials missing";

}

FormUrlEncodedContent content = new FormUrlEncodedContent(new[]

{

new KeyValuePair<string, string>("grant_type", "password"),
new KeyValuePair<string, string>("companyId", companyID.Text),
new KeyValuePair<string, string>("username", username.Text),
new KeyValuePair<string, string>("password", password.Text)

});

var request = new HttpRequestMessage(HttpMethod.Post, restURL.Text + "token");
request.Content = content;

HttpResponseMessage response = client.PostAsync(restURL.Text + "token", content).Result;
if (response.IsSuccessStatusCode)

{

Task<Object> res = response.Content.ReadAsAsync<Object>();
Console.WriteLine("Auth result: " + res);
Console.WriteLine("Auth result type: " + res.GetType());
Console.WriteLine("Auth result string: " + res.Result);

Newtonsoft.Json.Linq.JObject jObj = (Newtonsoft.Json.Linq.JObject)res.Result;
//get the ticjket out of the json object returned
token = jObj.GetValue("access_token").ToString();
Console.WriteLine("Auth token: " + token);

}

else

{

Console.WriteLine("Auth Was not successful: " + response.StatusCode);
output.Text = output.Text + "\r\nAuth Was not successful: " + response.StatusCode;

}

response.Dispose();
return token;

}

Retrieve a Worker

private void GetPerson()
{

try

{

if (String.IsNullOrEmpty(token))

{

output.Text = output.Text + "\r\nAuthentication failed ";

}

else

{

output.Text = output.Text + "\r\nAuthenticated: " + token.ToString();

Object person = null;
string url = restURL.Text + "api/Person/" + employeeID.Text;

output.Text = output.Text + "\r\nDoing GET from URL: " + url;
var requestMessage = new HttpRequestMessage(HttpMethod.Get, url);
requestMessage.Headers.Add("Authorization", "Bearer " + token);
Console.WriteLine("About to do GET from " + url);
HttpResponseMessage response2 = client.SendAsync(requestMessage).Result;

if (response2.IsSuccessStatusCode)

{

Task<Object> res2 = response2.Content.ReadAsAsync<Object>();
Console.WriteLine("GET Person result: " + res2);
Console.WriteLine("GET Person result string: " + res2.Result);
person = res2.Result;

var results = JObject.Parse(res2.Result.ToString());
if (results["message"] != null)

{

Console.WriteLine("GET Person was not successful: " + results["message"]);
output.Text = output.Text + "\r\nGet Person failed: " + results["message"];

}

else

{

var personDetails = results.Value<JObject>("Person").Properties();
var personDict = personDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

var addressDetails = results.Value<JObject>("AddressDetail").Properties();
var addressDict = addressDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

var employmentDetails = results.Value<JObject>("EmploymentDetail").Properties();
var employmentDict = employmentDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

...

{

var paymentDetails = results.Value<JObject>("PaymentDetail").Properties();
paymentDict = paymentDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

}

else

{

paymentDict = null;

}

Dictionary<string, string> starterStatementDict;
if (results.Value<JObject>("StarterStatementDetail") != null)

{

var starterStatmentDetails = results.Value<JObject>("StarterStatementDetail").Properties();
starterStatementDict = starterStatmentDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

}

else

{

starterStatementDict = null;

}

Dictionary<string, string> p45Dict;
if (results.Value<JObject>("P45Detail") != null)
{

var p45Details = results.Value<JObject>("P45Detail").Properties();
p45Dict = p45Details.ToDictionary(k => k.Name, v => v.Value.ToString());

}
else
{

p45Dict = null;

}
Dictionary<string, string> taxDict;
if (results.Value<JObject>("TaxDetail") != null)
{

var taxDetails = results.Value<JObject>("TaxDetail").Properties();
taxDict = taxDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

}
else
{

taxDict = null;

}
Console.WriteLine("personDetails:" + personDict);

if (personDict["EmployeeNumber"] != null) employeeNumber.Text = personDict["EmployeeNumber"];
if (personDict["Title"] != null) title.Text = personDict["Title"];
if (personDict["FirstName"] != null) firstName.Text = personDict["FirstName"];
if (personDict["MiddleNames"] != null) middleNames.Text = personDict["MiddleNames"];
if (personDict["LastName"] != null) lastName.Text = personDict["LastName"];
if (personDict["KnownAs"] != null) knownAs.Text = personDict["KnownAs"];
if (personDict["DateOfBirth"] != null) dateOfBirth.Text = personDict["DateOfBirth"];
if (personDict["Gender"] != null) gender.Text = personDict["Gender"];
if (personDict["Email"] != null) email.Text = personDict["Email"];
if (personDict["PayslipNotification"] != null)
{

if (Boolean.Parse(personDict["PayslipNotification"]))
{

payslipNotification.CheckState = CheckState.Checked;

}
else
{

payslipNotification.CheckState = CheckState.Unchecked;

}

}
if (personDict["SMSPayslipNotification"] != null)
{

if (Boolean.Parse(personDict["SMSPayslipNotification"]))
{

smsPayslipNotification.CheckState = CheckState.Checked;

}
else
{

smsPayslipNotification.CheckState = CheckState.Unchecked;

}

}

if (personDict["PostponeDate"] != null && personDict["PostponeDate"] != "")
{

postponeDate.CustomFormat = "yyyy/MM/dd";
postponeDate.Text = personDict["PostponeDate"];

}
else
{

postponeDate.CustomFormat = " ";

}
if (personDict["OptOutDate"] != null && personDict["OptOutDate"] != "")
{

...

}
else
{

optOutDate.CustomFormat = " ";

...

addressDate.CustomFormat = "yyyy/MM/dd";
addressDate.Text = addressDict["Date"];

}
else
{

addressDate.CustomFormat = " ";

}

if (addressDict["AddressLine1"] != null) addressLine1.Text = addressDict["AddressLine1"];
if (addressDict["AddressLine2"] != null) addressLine2.Text = addressDict["AddressLine2"];
if (addressDict["AddressLine3"] != null) addressLine3.Text = addressDict["AddressLine3"];
if (addressDict["Town"] != null) town.Text = addressDict["Town"];
if (addressDict["County"] != null) county.Text = addressDict["County"];
if (addressDict["Postcode"] != null) postcode.Text = addressDict["Postcode"];

if (employmentDict["DateOfJoining"] != null) dateOfJoining.Text = employmentDict["DateOfJoining"];
if (employmentDict["ServiceStartDate"] != null) serviceStartDate.Text = employmentDict["ServiceStartDate"];
if (employmentDict["Payroll"] != null) payroll.Text = employmentDict["Payroll"];
if (employmentDict["Workgroup"] != null) workgroup.Text = employmentDict["Workgroup"];
if (employmentDict["HoursCategory"] != null) hoursCategory.Text = employmentDict["HoursCategory"];
if (employmentDict["IrregularPayments"] != null)
{

if (Boolean.Parse(employmentDict["IrregularPayments"]))
{

irregularPayments.CheckState = CheckState.Checked;

}
else
{

irregularPayments.CheckState = CheckState.Unchecked;

}

}
if (employmentDict["OffPayrollWorker"] != null)
{

if (Boolean.Parse(employmentDict["OffPayrollWorker"]))
{

offPayrollWorker.CheckState = CheckState.Checked;

}
else
{

offPayrollWorker.CheckState = CheckState.Unchecked;

}

}

if (employmentDict["Apprentice"] != null)
{

if (Boolean.TryParse(employmentDict["Apprentice"], out bool apprentice))
{

if (apprentice)
{

Apprentice.CheckState = CheckState.Checked;

}

else

{

Apprentice.CheckState = CheckState.Unchecked;

}
}
else
{

Apprentice.CheckState = CheckState.Unchecked;

}

}

if (employmentDict["JobTitle"] != null) strtJobTitle.Text = employmentDict["JobTitle"];
if (employmentDict["WorkerPayType"] != null) workerPayType.Text = employmentDict["WorkerPayType"];

if (employmentDict["ContractedHours"] != null)
{

...

InPay provides a REST Web Service Interface that allows two-way flow of information to external systems. This enables automated and efficient transfer of data to and from your other systems reducing effort and duplication.  

If you wish to know the commercials or costs involved in using Web Services then please contact the Client Account Management team. If you would like to enable the use of Web Services please contact our Support team and an estimate will be raised. It will need to be enabled on your system and a set of credentials for accessing the service will be supplied.

The full technical https://inpay.es.rsmuk.com/WebServicesREST/Help

Scenarios and uses

This section describes various scenarios of how the Web Services can be used.

Authentication

Before you can call any other InPay Web Service method you must first call the authenticate() method. Providing valid credentials to this method will return an authentication token that must be provided with all other Web Service calls. 

Data Retrieval (Read operations)

There are a number of methods that enable you to read back the full details of an entity.  Examples are api/Person/{employeeNo} where providing the correct employee number will return the full Person object and  api/Payment/{employeeNo} which will return all the permanent payments in the system for an employee 

Data Creation (Write Operations)

It is now possible to create data in InPay via the Web Services. This includes the following the person entity and many of the entities related to the worker (for example pension and absence records)

C# Code

Authenticate

private string Authenticate()

{

string token = null;

if (String.IsNullOrEmpty(username.Text) || String.IsNullOrEmpty(password.Text) || String.IsNullOrEmpty(companyID.Text))

{

return "Credentials missing";

}

FormUrlEncodedContent content = new FormUrlEncodedContent(new[]

{

new KeyValuePair<string, string>("grant_type", "password"),
new KeyValuePair<string, string>("companyId", companyID.Text),
new KeyValuePair<string, string>("username", username.Text),
new KeyValuePair<string, string>("password", password.Text)

});

var request = new HttpRequestMessage(HttpMethod.Post, restURL.Text + "token");
request.Content = content;

HttpResponseMessage response = client.PostAsync(restURL.Text + "token", content).Result;
if (response.IsSuccessStatusCode)

{

Task<Object> res = response.Content.ReadAsAsync<Object>();
Console.WriteLine("Auth result: " + res);
Console.WriteLine("Auth result type: " + res.GetType());
Console.WriteLine("Auth result string: " + res.Result);

Newtonsoft.Json.Linq.JObject jObj = (Newtonsoft.Json.Linq.JObject)res.Result;
//get the ticjket out of the json object returned
token = jObj.GetValue("access_token").ToString();
Console.WriteLine("Auth token: " + token);


}

else

{

Console.WriteLine("Auth Was not successful: " + response.StatusCode);
output.Text = output.Text + "\r\nAuth Was not successful: " + response.StatusCode;

}

response.Dispose();
return token;

}

Retrieve a Worker

private void btnAddPayment_Click(object sender, EventArgs e)
{

try
{

Console.WriteLine("Add Payment clicked");
output.Text = "";
var token = Authenticate(); if (String.IsNullOrEmpty(token))
{ output.Text = output.Text + "\r\nAuthentication failed "

private void GetPerson()
{

try

{

if (String.IsNullOrEmpty(token))

{

output.Text = output.Text + "\r\nAuthentication failed ";

}

else

{

output.Text = output.Text + "\r\nAuthenticated: " + token.ToString();

Object person = null;
string url = restURL.Text + "api/Person/" + employeeID.Text;

output.Text = output.Text + "\r\nDoing GET from URL: " + url;
var requestMessage = new HttpRequestMessage(HttpMethod.Get, url);
requestMessage.Headers.Add("Authorization", "Bearer " + token);
Console.WriteLine("About to do GET from " + url);
HttpResponseMessage response2 = client.SendAsync(requestMessage).Result;

if (response2.IsSuccessStatusCode)

{

Task<Object> res2 = response2.Content.ReadAsAsync<Object>();
Console.WriteLine("GET Person result: " + res2);
Console.WriteLine("GET Person result string: " + res2.Result);
person = res2.Result;

var results = JObject.Parse(res2.Result.ToString());
if (results["message"] != null)

{

Console.WriteLine("GET Person was not successful: " + results["message"]);
output.Text = output.Text + "\r\nGet Person failed: " + results["message"];

}

else

{

var personDetails = results.Value<JObject>("Person").Properties();
var personDict = personDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

var addressDetails = results.Value<JObject>("AddressDetail").Properties();
var addressDict = addressDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

var employmentDetails = results.Value<JObject>("EmploymentDetail").Properties();
var employmentDict = employmentDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

var NIDetails = results.Value<JObject>("NIDetail").Properties();
var NIDict = NIDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

Dictionary<string, string> paymentDict;
if (results.Value<JObject>("PaymentDetail") != null)

{

var paymentDetails = results.Value<JObject>("PaymentDetail").Properties();
paymentDict = paymentDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

}

else

{

paymentDict = null;

}

Dictionary<string, string> starterStatementDict;
if (results.Value<JObject>("StarterStatementDetail") != null)

{

var starterStatmentDetails = results.Value<JObject>("StarterStatementDetail").Properties();
starterStatementDict = starterStatmentDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

}

else

{

starterStatementDict = null;

}

Dictionary<string, string> p45Dict;
if (results.Value<JObject>("P45Detail") != null)
{

var p45Details = results.Value<JObject>("P45Detail").Properties();
p45Dict = p45Details.ToDictionary(k => k.Name, v => v.Value.ToString());

}
else
{

p45Dict = null;

}
Dictionary<string, string> taxDict;
if (results.Value<JObject>("TaxDetail") != null)
{

var taxDetails = results.Value<JObject>("TaxDetail").Properties();
taxDict = taxDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

}
else
{

taxDict = null;

}
Console.WriteLine("personDetails:" + personDict);

if (personDict["EmployeeNumber"] != null) employeeNumber.Text = personDict["EmployeeNumber"];
if (personDict["Title"] != null) title.Text = personDict["Title"];
if (personDict["FirstName"] != null) firstName.Text = personDict["FirstName"];
if (personDict["MiddleNames"] != null) middleNames.Text = personDict["MiddleNames"];
if (personDict["LastName"] != null) lastName.Text = personDict["LastName"];
if (personDict["KnownAs"] != null) knownAs.Text = personDict["KnownAs"];
if (personDict["DateOfBirth"] != null) dateOfBirth.Text = personDict["DateOfBirth"];
if (personDict["Gender"] != null) gender.Text = personDict["Gender"];
if (personDict["Email"] != null) email.Text = personDict["Email"];
if (personDict["PayslipNotification"] != null)
{

if (Boolean.Parse(personDict["PayslipNotification"]))
{

payslipNotification.CheckState = CheckState.Checked;

}
else
{

payslipNotification.CheckState = CheckState.Unchecked;

}

}
if (personDict["SMSPayslipNotification"] != null)
{

if (Boolean.Parse(personDict["SMSPayslipNotification"]))
{

smsPayslipNotification.CheckState = CheckState.Checked;

}
else
{

smsPayslipNotification.CheckState = CheckState.Unchecked;

}

}

if (personDict["PostponeDate"] != null && personDict["PostponeDate"] != "")
{

postponeDate.CustomFormat = "yyyy/MM/dd";
postponeDate.Text = personDict["PostponeDate"];

}
else
{

postponeDate.CustomFormat = " ";

}
if (personDict["OptOutDate"] != null && personDict["OptOutDate"] != "")
{


optOutDate.CustomFormat = "yyyy/MM/dd";
optOutDate.Text = personDict["OptOutDate"];

}
else
{

optOutDate.CustomFormat = " ";

}
if (personDict["Method"] != null) method.Text = personDict["Method"];
if (personDict["HolidayScheme"] != null) holidayScheme.Text = personDict["HolidayScheme"];
if (personDict["AccrueDaysOverride"] != null) accrueDaysOverride.Text = personDict["AccrueDaysOverride"];
if (personDict["OSPScheme"] != null) ospScheme.Text = personDict["OSPScheme"];

if (addressDict["Date"] != null && addressDict["Date"] != "")
{

addressDate.CustomFormat = "yyyy/MM/dd";
addressDate.Text = addressDict["Date"];

}
else
{contractedHours

addressDate.

Text

CustomFormat = " ";

}

if (

NIDict

addressDict["

NINumber

AddressLine1"] != null)

niNumber

addressLine1.Text =

NIDict

addressDict["

NINumber

AddressLine1"];
if (

NIDict

addressDict["

NITableLetter

AddressLine2"] != null)

niTableLetter

addressLine2.Text =

NIDict

addressDict["

NITableLetter

AddressLine2"];
if (

NIDict

addressDict["

Director

AddressLine3"] != null)


{

if (Boolean.Parse(NIDict["Director"]))

{

director.CheckState = CheckState.Checked;

}
else
{

director.CheckState = CheckState.Unchecked;

}

}
if (NIDict["NonCumulativeNI

addressLine3.Text = addressDict["AddressLine3"];
if (addressDict["Town"] != null)


{

if (Boolean.Parse(NIDict["NonCumulativeNI"]))
{

nonCumulativeNI.CheckState = CheckState.Checked;

}
else
{

nonCumulativeNI.CheckState = CheckState.Unchecked;

}

}
if (NIDict["DirectorStartDate"] != null && NIDict["DirectorStartDate"] != "")
{

directorStartDate.CustomFormat = "yyyy/MM/dd";
directorStartDate.Text = NIDict["DirectorStartDate"];

}
else
{

directorStartDate.CustomFormat = " ";

}

if (paymentDict != null)
{

if (paymentDict["AccountNametown.Text = addressDict["Town"];
if (addressDict["County"] != null) county.Text = addressDict["County"];
if (addressDict["Postcode"] != null) postcode.Text = addressDict["Postcode"];

if (employmentDict["DateOfJoining"] != null) dateOfJoining.Text = employmentDict["DateOfJoining"];
if (employmentDict["ServiceStartDate"] != null) serviceStartDate.Text = employmentDict["ServiceStartDate"];
if (employmentDict["Payroll"] != null) accountNamepayroll.Text = paymentDictemploymentDict["AccountNamePayroll"];
if (paymentDictemploymentDict["AccountNumberWorkgroup"] != null) accountNumberworkgroup.Text = paymentDictemploymentDict["AccountNumberWorkgroup"];
if (paymentDictemploymentDict["SortCodeHoursCategory"] != null) sortCodehoursCategory.Text = paymentDictemploymentDict["SortCodeHoursCategory"];
if (paymentDictemploymentDict["RollNumberIrregularPayments"] != null) rollNumber.Text = paymentDict["RollNumber"];
{

if (Boolean.Parse(employmentDict["IrregularPayments"]))
{

irregularPayments.CheckState = CheckState.Checked;

}
else
{

irregularPayments.CheckState = CheckState.Unchecked;

}

}
if (

starterStatementDict

employmentDict["OffPayrollWorker"] != null)
{

if (

starterStatementDict

Boolean.Parse(employmentDict["

StarterStatement

OffPayrollWorker"]

!= null) starterStatement.Text = starterStatementDict["StarterStatement"];
if (starterStatementDict["StudentLoanPlanType"] != null) studentLoanPlanType.Text = starterStatementDict["StudentLoanPlanType"];
if (starterStatementDict["StudentLoanRepayDirectly

))
{

offPayrollWorker.CheckState = CheckState.Checked;

}
else
{

offPayrollWorker.CheckState = CheckState.Unchecked;

}

}

if (employmentDict["Apprentice"] != null) studentLoanRepayDirectly.Checked =
{

if (Boolean.ParseTryParse(starterStatementDictemploymentDict["StudentLoanRepayDirectly"]);
if (starterStatementDict["StudentLoanBeforeLast6AprilApprentice"], out bool apprentice))
{

if (apprentice)
{

Apprentice.CheckState = CheckState.Checked;

}

else

{

Apprentice.CheckState = CheckState.Unchecked;

}
}
else
{

Apprentice.CheckState = CheckState.Unchecked;

}

}

if (employmentDict["JobTitle"] != null)

studentLoanBeforeLast6April

strtJobTitle.

Checked = Boolean.Parse(starterStatementDict

Text = employmentDict["

StudentLoanBeforeLast6April

JobTitle"]

)

;

}
if (p45Dict != null)
{

if (p45Dict

employmentDict["

P45EmployersReference

WorkerPayType"] != null)

p45EmployersReference

workerPayType.Text =

p45Dict

employmentDict["

P45EmployersReference

WorkerPayType"];

if (

p45Dict

employmentDict["

P45LeavingDate

ContractedHours"] != null

&& p45Dict["P45LeavingDate"] != ""

)
{

p45LeavingDate.CustomFormat = "yyyy/MM/dd";
p45LeavingDate

contractedHours.Text =

p45Dict

employmentDict["

P45LeavingDate

ContractedHours"];

}
else
{

p45LeavingDate

contractedHours.

CustomFormat

Text = "";

}

if (

p45Dict

NIDict["

P45PeriodNo

NINumber"] != null)

p45PeriodNo

niNumber.Text =

p45Dict

NIDict["

P45PeriodNo

NINumber"];
if (

p45Dict

NIDict["

P45TaxablePay

NITableLetter"] != null)

p45TaxablePay

niTableLetter.Text =

p45Dict

NIDict["

P45TaxablePay

NITableLetter"];
if (

p45Dict

NIDict["

P45TaxPaid

Director"] != null)

p45TaxPaid.Text = p45Dict["P45TaxPaid"];


{

if (

p45Dict

Boolean.Parse(NIDict["

P45TaxCode

Director"]

!= null) p45TaxCode.Text = p45Dict["P45TaxCode"];
if (p45Dict["P45Wk1Mth1

))

{

director.CheckState = CheckState.Checked;

}
else
{

director.CheckState = CheckState.Unchecked;

}

}
if (NIDict["NonCumulativeNI"] != null)
{

if (Boolean.Parse(

p45Dict

NIDict["

P45Wk1Mth1

NonCumulativeNI"]))
{

p45Wk1Mth1

nonCumulativeNI.CheckState = CheckState.Checked;

}
else
{

p45Wk1Mth1

nonCumulativeNI.CheckState = CheckState.Unchecked;

}

}
if (

p45Dict

NIDict["

P45TaxDistrictNo

DirectorStartDate"] != null

) p45TaxDistrictNo.Text = p45Dict["P45TaxDistrictNo"];
if (p45Dict["P45PayFrequency"] != null) p45PayFrequency.Text = p45Dict["P45PayFrequency"]

&& NIDict["DirectorStartDate"] != "")
{

directorStartDate.CustomFormat = "yyyy/MM/dd";
directorStartDate.Text = NIDict["DirectorStartDate"];

}
else
{

directorStartDate.CustomFormat = " ";

}

if (taxDict paymentDict != null)
{

if (taxDictpaymentDict["StartDateAccountName"] != null) taxStartDateaccountName.Text = taxDictpaymentDict["StartDateAccountName"];
if (taxDictpaymentDict["TaxCodeAccountNumber"] != null) taxTaxCodeaccountNumber.Text = taxDictpaymentDict["TaxCodeAccountNumber"];
if (taxDictpaymentDict["TaxBasisSortCode"] != null)

{

if (Boolean.Parse(taxDict["TaxBasis"]))

{

taxTaxBasis.CheckState = CheckState.Checked;

}
else
{

taxTaxBasis.CheckState = CheckState.Unchecked;

}

}

}

}

}
else
{

Console.WriteLine("GET person was not successful: " + response2.StatusCode);
output.Text = output.Text + "\r\nGet person failed: " + response2.StatusCode;

}

if (person == null)
{

output.Text = output.Text + "\r\nGet Person returned null";

}
else
{

Console.WriteLine("Get Person returned:" + person.ToString());
output.Text = output.Text + ".\r\nGet Person returned:" + person.ToString();

}

}

}
catch (Exception ex)
{

Console.WriteLine("Exception in Get Person:" + ex);

}
}

Add a Payment

sortCode.Text = paymentDict["SortCode"];
if (paymentDict["RollNumber"] != null) rollNumber.Text = paymentDict["RollNumber"];

}

if (starterStatementDict != null)
{

if (starterStatementDict["StarterStatement"] != null) starterStatement.Text = starterStatementDict["StarterStatement"];
if (starterStatementDict["StudentLoanPlanType"] != null) studentLoanPlanType.Text = starterStatementDict["StudentLoanPlanType"];
if (starterStatementDict["StudentLoanRepayDirectly"] != null) studentLoanRepayDirectly.Checked = Boolean.Parse(starterStatementDict["StudentLoanRepayDirectly"]);
if (starterStatementDict["StudentLoanBeforeLast6April"] != null) studentLoanBeforeLast6April.Checked = Boolean.Parse(starterStatementDict["StudentLoanBeforeLast6April"]);

}

if (p45Dict != null)
{

if (p45Dict["P45EmployersReference"] != null) p45EmployersReference.Text = p45Dict["P45EmployersReference"];
if (p45Dict["P45LeavingDate"] != null && p45Dict["P45LeavingDate"] != "")

{

p45LeavingDate.CustomFormat = "yyyy/MM/dd";
p45LeavingDate.Text = p45Dict["P45LeavingDate"];

}
else
{

output

p45LeavingDate.

Text

CustomFormat =

output.Text +

"

\r\nAuthenticated:

"

+ token.ToString();

Object result = null;
string url = restURL.Text + "api/Payment/" + employeeID.Text;
output.Text = output.Text + "\r\nDoing PUT to URL: " + url;
Console.WriteLine("About to PUT to " + url);

//Load scheme details in to request body
FormUrlEncodedContent content = new FormUrlEncodedContent(new[]

{

new KeyValuePair<string, string>("PayElement", paymentPayElement.Text),
new KeyValuePair<string, string>("StartDate", paymentStartDate.Text),
new KeyValuePair<string, string>("EndDate", paymentEndDate.Text),
new KeyValuePair<string, string>("AnnualAmount", annualAmount.Text),
new KeyValuePair<string, string>("PeriodAmount", periodAmount.Text),
new KeyValuePair<string, string>("Balance", balance.Text),
new KeyValuePair<string, string>("RateEffectiveDate", paymentRateEffectiveDate.Text)

});

var requestMessage = new HttpRequestMessage(HttpMethod.Put, url);
requestMessage.Headers.Add("Authorization", "Bearer " + token);
requestMessage.Content = content;
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

HttpResponseMessage response2 = client.PutAsync(url, content).Result;
if (response2.IsSuccessStatusCode)

{

Task<Object> res2 = response2.Content.ReadAsAsync<Object>();
Console.WriteLine("Add Payment result: " + res2.Result);
result = res2.Result;

}

;

}

if (p45Dict["P45PeriodNo"] != null) p45PeriodNo.Text = p45Dict["P45PeriodNo"];
if (p45Dict["P45TaxablePay"] != null) p45TaxablePay.Text = p45Dict["P45TaxablePay"];
if (p45Dict["P45TaxPaid"] != null) p45TaxPaid.Text = p45Dict["P45TaxPaid"];
if (p45Dict["P45TaxCode"] != null) p45TaxCode.Text = p45Dict["P45TaxCode"];
if (p45Dict["P45Wk1Mth1"] != null)

{

if (Boolean.Parse(p45Dict["P45Wk1Mth1"]))
{

p45Wk1Mth1.CheckState = CheckState.Checked;

}
else
{

p45Wk1Mth1.CheckState = CheckState.Unchecked;

}

}

if (p45Dict["P45TaxDistrictNo"] != null) p45TaxDistrictNo.Text = p45Dict["P45TaxDistrictNo"];
if (p45Dict["P45PayFrequency"] != null) p45PayFrequency.Text = p45Dict["P45PayFrequency"];

}

if (taxDict != null)
{

if (taxDict["StartDate"] != null) taxStartDate.Text = taxDict["StartDate"];
if (taxDict["TaxCode"] != null) taxTaxCode.Text = taxDict["TaxCode"];
if (taxDict["TaxBasis"] != null)

{

if (Boolean.Parse(taxDict["TaxBasis"]))

{

taxTaxBasis.CheckState = CheckState.Checked;

}
else
{

taxTaxBasis.CheckState = CheckState.Unchecked;

}

}

}

}

}
else
{

Console.WriteLine("

Add Payment was not successful: " + response2.StatusCode);
output.Text = output.Text + "\r\nAdd Payment failed: " + response2.StatusCode;
output.Text = output.Text + "\r\nAdd Payment failed

GET person was not successful: " + response2.

ToString(

StatusCode);
output.Text = output.Text + "\r\

nAdd Payment

nGet person failed: " + response2.

ReasonPhrase

StatusCode;

}

if (

result

person == null)
{

output.Text = output.Text + "\r\

nAdd Payment

nGet Person returned null";

}
else
{

Console.WriteLine("

Add Payment

Get Person returned:" +

result

person.ToString());
output.Text = output.Text + ".\r\

nAdd Payment

nGet Person returned:" +

result

person.ToString();

}

}

}
catch (Exception ex)
{

Console.WriteLine("Exception in

Add Payment

Get Person:" + ex);

}
}

...



Add a Payment

private void

btnUpdatePayment

btnAddPayment_Click(object sender, EventArgs e)
{

try
{


Console.WriteLine("

Update

Add Payment clicked");
output.Text = "";
var token = Authenticate();


if (String.IsNullOrEmpty(token))
{


output.Text = output.Text + "\r\nAuthentication failed ";

}
else
{

output.Text = output.Text + "\r\nAuthenticated: " + token.ToString();

client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

Object result = null;
string url = restURL.Text + "api

/Payment/" + employeeID.Text;
url += "/" + paymentPayElement.Text + "

/Payment/" +

paymentStartDate

employeeID.Text

.Replace("/", "-")

;
output.Text = output.Text + "\r\nDoing

POST

PUT to URL: " + url;
Console.WriteLine("About to

POST

PUT to " + url);

//Load scheme details in to request body
FormUrlEncodedContent content = new FormUrlEncodedContent(new[]

{

new KeyValuePair<string, string>("PayElement", paymentPayElement.Text),
new KeyValuePair<string, string>("StartDate", paymentStartDate.Text),
new KeyValuePair<string, string>("EndDate", paymentEndDate.Text),
new KeyValuePair<string, string>("AnnualAmount", annualAmount.Text),
new KeyValuePair<string, string>("PeriodAmount", periodAmount.Text),
new KeyValuePair<string, string>("Balance", balance.Text),
new KeyValuePair<string, string>("RateEffectiveDate", paymentRateEffectiveDate.Text)

});

var requestMessage = new HttpRequestMessage(HttpMethod.Put, url);
requestMessage.Headers.Add("Authorization", "Bearer " + token);
requestMessage.Content = content;
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

HttpResponseMessage response2 = client.

PostAsync

PutAsync(url, content).Result;
if (response2.IsSuccessStatusCode)

{

Task<Object> res2 = response2.Content.ReadAsAsync<Object>();
Console.WriteLine("

Update

Add Payment result: " + res2.Result);
result = res2.Result;

}

else

{

Console.WriteLine("

Update

Add Payment was not successful: " + response2.StatusCode);
output.Text = output.Text + "\r\

nUpdate

nAdd Payment failed: " + response2.StatusCode;
output.Text = output.Text + "\r\

nUpdate

nAdd Payment failed: " + response2.ToString();
output.Text = output.Text + "\r\

nUpdate

nAdd Payment failed: " + response2.ReasonPhrase;

}

if (result == null)
{

output.Text = output.Text + "\r\

nUpdate

nAdd Payment returned null";

}

else

{

Console.WriteLine("

Update

Add Payment returned:" + result.ToString());
output.Text = output.Text + ".\r\

nUpdate

nAdd Payment returned:" + result.ToString();

}

}

}

catch (Exception ex)

{

Console.WriteLine("Exception in

Update

Add Payment:" + ex);

}

}

...

Update a Payment

private void

btnDeletePayment

btnUpdatePayment_Click(object sender, EventArgs e)
{

try

{

Console.WriteLine("

Delete

Update Payment clicked");
output.Text = "";
var token = Authenticate();

if (String.IsNullOrEmpty(token))
{

output.Text = output.Text + "\r\nAuthentication failed ";

}

else

{

output.Text = output.Text + "\r\nAuthenticated: " + token.ToString();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

Object result = null;

string url = restURL.Text + "api/Payment/" + employeeID.Text;
url += "/" + paymentPayElement.Text + "/" + paymentStartDate.Text.Replace("/", "-");

output.Text = output.Text + "\r\nDoing DELETE to URL: " + url;
Console.WriteLine("About to DELETE to " + url);

HttpResponseMessage response2 = client.DeleteAsync(url).Result;

if (response2.IsSuccessStatusCode)

{

Task<Object> res2 = response2.Content.ReadAsAsync<Object>();
Console.WriteLine("Delete Payment result: " + res2.Result);
result = res2.Result;

}

else

{

Console.WriteLine("Delete was not successful: " + response2.StatusCode);
output.Text = output.Text + "\r\nDelete Payment failed: " + response2.StatusCode;
output.Text = output.Text + "\r\nDelete Payment failed: " + response2.ToString();
output.Text = output.Text + "\r\nDelete Payment failed: " + response2.ReasonPhrase;

}

if (result == null)

{

output.Text = output.Text + "\r\nDelete Payment returned null"

string url = restURL.Text + "api/Payment/" + employeeID.Text;
url += "/" + paymentPayElement.Text + "/" + paymentStartDate.Text.Replace("/", "-");
output.Text = output.Text + "\r\nDoing POST to URL: " + url;
Console.WriteLine("About to POST to " + url);

//Load scheme details in to request body
FormUrlEncodedContent content = new FormUrlEncodedContent(new[]

{

new KeyValuePair<string, string>("PayElement", paymentPayElement.Text),
new KeyValuePair<string, string>("StartDate", paymentStartDate.Text),
new KeyValuePair<string, string>("EndDate", paymentEndDate.Text),
new KeyValuePair<string, string>("AnnualAmount", annualAmount.Text),
new KeyValuePair<string, string>("PeriodAmount", periodAmount.Text),
new KeyValuePair<string, string>("Balance", balance.Text),
new KeyValuePair<string, string>("RateEffectiveDate", paymentRateEffectiveDate.Text)

}

);

HttpResponseMessage response2 = client.PostAsync(url, content).Result;
if (response2.IsSuccessStatusCode)

{

Task<Object> res2 = response2.Content.ReadAsAsync<Object>();
Console.WriteLine("Update Payment result: " + res2.Result);
result = res2.Result;

}

else

{

Console.WriteLine("

Delete Payment returned

Update was not successful: " +

result

response2.

ToString(

StatusCode)

)

;
output.Text = output.Text + "

.

\r\

nDelete

nUpdate Payment

returned

failed: " +

result

response2.

ToString();

}

}

}

catch (Exception ex)

{

Console.WriteLine("Exception in Delete Payment:" + ex);

}

}

Whilst using the InTime Web Services, some fields have expected values from a range of constants. These are detailed below.

FieldConstant

Comment

NotesClientinvoice period0Weekly1Two-Weekly2Four-Weekly3Calendar Monthly44-4-5WorkerworkerTypepayeFor PAYE WorkersltdFor Ltd Company Workersexternal-contractorFor Non Ltd Company WorkerscisFor CIS WorkersumbFor Workers operating through an UmbrellaYou must specify the umbrella against the worker, otherwise the worker will appear as LTD.cisBusinessTypeSoleTraderCompanyTrustPartnershipcisPercentage02030paymentFrequencyweeklymonthly<InPay Payroll Name>If InPay connected, for PAYE workers, use the InPay Payroll NametimesheetsOnInvoices0Timesheets On Invoices1Timesheets Not On InvoicespaperOnInvoices-1Agency Default0No Attachments1Attach Paper Timesheets2Attach Expense Group Paper4Attach Expense Receipts Paper<sum of the above>Attach the appropriate paperFor example, 5 to attach timesheets and receiptsgenderMFUUnkownLTD invoice period0Weekly1Two-Weekly2Four-Weekly3Calendar Monthly44-4-5Payment Methodbacschequecashchapsachinternationalbuilding societyPlacementlayoutstandardSee Maintaining PlacementscalendartimesheetDateCalculatorweeklySee Maintaining Placements. You can see all possible values for this in the ui.monthly<many more>See UI for all options.Ratesperiod60For hourly rates entered in hours format (hours only or start, break, finish).1440For fixed rates of a specified duration entered in decimal format (decimal or tickbox)periodDuration<any integer>The duration in minutes for the fixed rate (e.g. 60 for hours, 480 for a day).timePatterndefaultWill use the selected default time pattern<any string>The string should match the name of a time pattern in the systemtimesheetFieldsSTART_FINISH_BREAKEnter start, break, finishOnly when period above is 60HOURSEnter hours onlyOnly when period above is 60DECIMALEnter time as a decimalOnly when period above is 1440DAYTickbox only (equivalent to entering decimals as 1.00)Only when period above is 1440

StatusCode;
output.Text = output.Text + "\r\nUpdate Payment failed: " + response2.ToString();
output.Text = output.Text + "\r\nUpdate Payment failed: " + response2.ReasonPhrase;

}

if (result == null)

{

output.Text = output.Text + "\r\nUpdate Payment returned null";

}

else

{

Console.WriteLine("Update Payment returned:" + result.ToString());
output.Text = output.Text + ".\r\nUpdate Payment returned:" + result.ToString();

}

}

}

catch (Exception ex)

{

Console.WriteLine("Exception in Update Payment:" + ex);

}

}

Delete a Payment

private void btnDeletePayment_Click(object sender, EventArgs e)

{

try

{

Console.WriteLine("Delete Payment clicked");
output.Text = "";
var token = Authenticate();

if (String.IsNullOrEmpty(token))

{

output.Text = output.Text + "\r\nAuthentication failed ";

}

else

{

output.Text = output.Text + "\r\nAuthenticated: " + token.ToString();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

Object result = null;
string url = restURL.Text + "api/Payment/" + employeeID.Text;
url += "/" + paymentPayElement.Text + "/" + paymentStartDate.Text.Replace("/", "-");

output.Text = output.Text + "\r\nDoing DELETE to URL: " + url;
Console.WriteLine("About to DELETE to " + url);

HttpResponseMessage response2 = client.DeleteAsync(url).Result;

if (response2.IsSuccessStatusCode)

{

Task<Object> res2 = response2.Content.ReadAsAsync<Object>();
Console.WriteLine("Delete Payment result: " + res2.Result);
result = res2.Result;

}

else

{

Console.WriteLine("Delete was not successful: " + response2.StatusCode);
output.Text = output.Text + "\r\nDelete Payment failed: " + response2.StatusCode;
output.Text = output.Text + "\r\nDelete Payment failed: " + response2.ToString();
output.Text = output.Text + "\r\nDelete Payment failed: " + response2.ReasonPhrase;

}

if (result == null)

{

output.Text = output.Text + "\r\nDelete Payment returned null";

}
else

{

Console.WriteLine("Delete Payment returned:" + result.ToString());
output.Text = output.Text + ".\r\nDelete Payment returned:" + result.ToString();

}

}

}

catch (Exception ex)

{

Console.WriteLine("Exception in Delete Payment:" + ex);

}

}


Whilst using the InPay Web Services, some fields have expected values from a range of constants. These are detailed below.

FieldConstant

Comment

Notes
Person


MethodCASHCashThis is the method of payment

CHEQUECheque

BACSBacs or payment via other banking software




HoursCategory
AUp to 15.99Required for the FPS submission

B24 - 29.99

C30 hrs or more

DOther

E16 - 23.99




Worker Pay Type1SalariedNot Mandatory

2Grade

3Hourly




AbsenceDetail




AbsenceType1Holiday

2Sickness