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;

}

...

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 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 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 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
{

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(personDictemploymentDict["SMSPayslipNotificationIrregularPayments"]))
{

smsPayslipNotificationirregularPayments.CheckState = CheckState.Checked;

}
else
{

smsPayslipNotificationirregularPayments.CheckState = CheckState.Unchecked;

}

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

if (Boolean.Parse(employmentDict["

PostponeDate

OffPayrollWorker"]

!= ""

))
{postponeDate

offPayrollWorker.

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

CheckState = CheckState.Checked;

}
else
{postponeDate.CustomFormat = " "

offPayrollWorker.CheckState = CheckState.Unchecked;

}

}

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

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

if (apprentice)
{

optOutDate

Apprentice.

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

CheckState = CheckState.Checked;

}

else

{

Apprentice.CheckState = CheckState.Unchecked;

}
}
else
{

optOutDate

Apprentice.

CustomFormat = " "

CheckState = CheckState.Unchecked;

} if (personDict["Method"] != null) method.Text = personDict["Method"];

}

if (

personDict

employmentDict["

HolidayScheme

JobTitle"] != null)

holidayScheme

strtJobTitle.Text =

personDict["HolidayScheme"];
if (personDict["AccrueDaysOverride"] != null) accrueDaysOverride.Text = personDict["AccrueDaysOverride

employmentDict["JobTitle"];
if (

personDict

employmentDict["

OSPScheme

WorkerPayType"] != null)

ospScheme

workerPayType.Text =

personDict

employmentDict["

OSPScheme

WorkerPayType"];

if (

addressDict

employmentDict["

Date

ContractedHours"] != null

&& addressDict["Date"] != ""

)
{

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

contractedHours.Text =

addressDict

employmentDict["

Date

ContractedHours"];

}
else
{

addressDate.CustomFormat = " ";

}

if (addressDict["AddressLine1"] != null) addressLine1contractedHours.Text = addressDict[ "AddressLine1"];

}

if (

addressDict

NIDict["

AddressLine2

NINumber"] != null)

addressLine2

niNumber.Text =

addressDict

NIDict["

AddressLine2

NINumber"];
if (

addressDict

NIDict["

AddressLine3

NITableLetter"] != null)

addressLine3

niTableLetter.Text =

addressDict

NIDict["

AddressLine3

NITableLetter"];
if (

addressDict

NIDict["

Town

Director"] != null)

town.Text = addressDict["Town"];
if (addressDict["County


{

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

{

director.CheckState = CheckState.Checked;

}
else
{

director.CheckState = CheckState.Unchecked;

}

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

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

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


{

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["AccountName"] != null) hoursCategoryaccountName.Text = employmentDictpaymentDict["HoursCategoryAccountName"];
if (employmentDictpaymentDict["IrregularPaymentsAccountNumber"] != null)
{

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

irregularPayments.CheckState = CheckState.Checked;

}
else
{

irregularPayments.CheckState = CheckState.Unchecked;

}

}
if (employmentDict["OffPayrollWorkeraccountNumber.Text = paymentDict["AccountNumber"];
if (paymentDict["SortCode"] != null)
{

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

offPayrollWorker.CheckState = CheckState.Checked;

}
else
{

offPayrollWorker.CheckState = CheckState.Unchecked;

}

}

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

}

if (starterStatementDict != null)
{

if (starterStatementDict["StarterStatement"] != 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

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)

strtJobTitle

studentLoanBeforeLast6April.

Text = employmentDict["JobTitle"];

Checked = Boolean.Parse(starterStatementDict["StudentLoanBeforeLast6April"]);

}

if (p45Dict != null)
{

if (

employmentDict

p45Dict["

WorkerPayType

P45EmployersReference"] != null)

workerPayType

p45EmployersReference.Text =

employmentDict

p45Dict["

WorkerPayType

P45EmployersReference"];
if (

employmentDict

p45Dict["

ContractedHours

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

{contractedHours

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

employmentDict

p45Dict["

ContractedHours

P45LeavingDate"];

}
else
{

contractedHours

p45LeavingDate.CustomFormat = " ";

}

if (p45Dict["P45PeriodNo"] != null) p45PeriodNo.Text = p45Dict["P45PeriodNo"];

}

if (

NIDict

p45Dict["

NINumber

P45TaxablePay"] != null)

niNumber

p45TaxablePay.Text =

NIDict

p45Dict["

NINumber

P45TaxablePay"];
if (

NIDict

p45Dict["

NITableLetter

P45TaxPaid"] != null)

niTableLetter

p45TaxPaid.Text =

NIDict

p45Dict["

NITableLetter

P45TaxPaid"];
if (

NIDict

p45Dict["

Director

P45TaxCode"] != null)


{

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

{

director.CheckState = CheckState.Checked;

}
else
{

director.CheckState = CheckState.Unchecked;

}

}
if (NIDict["NonCumulativeNI

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

{

if (Boolean.Parse(

NIDict

p45Dict["

NonCumulativeNI

P45Wk1Mth1"]))
{nonCumulativeNI

p45Wk1Mth1.CheckState = CheckState.Checked;

}
else
{nonCumulativeNI

p45Wk1Mth1.CheckState = CheckState.Unchecked;

}

}

if (

NIDict

p45Dict["

DirectorStartDate

P45TaxDistrictNo"] != null

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

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

}
else
{

directorStartDate.CustomFormat = " ";

}

if (paymentDict != null)
{

if (paymentDict["AccountName) p45TaxDistrictNo.Text = p45Dict["P45TaxDistrictNo"];
if (p45Dict["P45PayFrequency"] != null) accountNamep45PayFrequency.Text = paymentDictp45Dict["AccountNameP45PayFrequency"];

}

if (

paymentDict

taxDict != null)
{

if (taxDict["AccountNumberStartDate"] != null) accountNumbertaxStartDate.Text = paymentDicttaxDict["AccountNumberStartDate"];
if (paymentDicttaxDict["SortCodeTaxCode"] != null) sortCodetaxTaxCode.Text = paymentDicttaxDict["SortCodeTaxCode"];
if (paymentDicttaxDict["RollNumberTaxBasis"] != 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
{

p45LeavingDate.CustomFormat = " ";

}

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;

}

}

}

}

}

{

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

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 ";

}
else
{

output.Text = 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;

}

else

{

Console.WriteLine("

GET person

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

nGet person

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

}

if (

person

result == null)
{

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

nGet Person

nAdd Payment returned null";

}

else

{

Console.WriteLine("

Get Person

Add Payment returned:" +

person

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

nGet Person

nAdd Payment returned:" +

person

result.ToString();

}

}

}

catch (Exception ex)

{

Console.WriteLine("Exception in

Get Person

Add Payment:" + ex);

}

}

...

Update a Payment

private void

btnAddPayment

btnUpdatePayment_Click(object sender, EventArgs e)
{

try

{

Console.WriteLine("

Add

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

/Payment/" + employeeID.Text;
url += "/" + paymentPayElement.Text + "/" + paymentStartDate.Text.Replace("/", "-");
output.Text = output.Text + "\r\nDoing

PUT

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

PUT

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)

});

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

("RateEffectiveDate", paymentRateEffectiveDate.Text)

}

);

HttpResponseMessage response2 = client.

PutAsync

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

{

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

Add

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

}

else

{

Console.WriteLine("

Add Payment

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

nAdd

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

nAdd

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

nAdd

nUpdate Payment failed: " + response2.ReasonPhrase;

}

if (result == null)

{

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

nAdd

nUpdate Payment returned null";

}

else

{

Console.WriteLine("

Add

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

nAdd

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

}

}

}

catch (Exception ex)

{

Console.WriteLine("Exception in

Add 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

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




AbsenceExt

1Sickness

2Maternity

3Adoption

4Paternity Adoption

5Paternity Birth

6Paid Leave

7Shared Parental Leaver Adoption

8Shared Parental Leaver Birth

9Parental Bereavement