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

...

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 void GetPerson()
{

try

{

if (String.IsNullOrEmpty(token))

{

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

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 tokenresult: " + tokenres);

}

else

{

Console.WriteLine("Auth Was not successfulresult type: " + responseres.StatusCodeGetType());
output.Text = output.Text + "\r\nAuth Was not successfulConsole.WriteLine("Auth result string: " + responseres.StatusCodeResult);

}

response.Dispose();
return token;

}

Retrieve a Worker

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

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

{

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

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

nDoing GET from URL

nAuth Was not successful: " +

url

response.StatusCode;

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

}

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

}
else
{

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

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

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 NIDict personDict = NIDetailspersonDetails.ToDictionary(k => k.Name, v => v.Value.ToString()); Dictionary<string, string> paymentDict;
if (results.Value<JObject>("PaymentDetail") != null)

{

var paymentDetails

var addressDetails = results.Value<JObject>("

PaymentDetail

AddressDetail").Properties();

paymentDict

var addressDict =

paymentDetails

addressDetails.ToDictionary(k => k.Name, v => v.Value

.ToString());

}

else

{

paymentDict = null;

}

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

{

var starterStatmentDetails

.ToString());

var employmentDetails = results.Value<JObject>("

StarterStatementDetail

EmploymentDetail").Properties();

starterStatementDict

var employmentDict =

starterStatmentDetails

employmentDetails.ToDictionary(k => k.Name, v => v.Value.ToString());

}

else

{

starterStatementDict = null;

}

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

var p45Details

var NIDetails = results.Value<JObject>("

P45Detail

NIDetail").Properties();

p45Dict

var NIDict =

p45Details

NIDetails.ToDictionary(k => k.Name, v => v.Value.ToString())

;

}
else
{

p45Dict = null

;
}

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

{

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

}

else

{

taxDict paymentDict = null;

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

Dictionary<string, string> starterStatementDict;
if (personDict["EmployeeNumber"] results.Value<JObject>("StarterStatementDetail") != 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"]

{

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["EmailEmployeeNumber"] != null) emailemployeeNumber.Text = personDict["EmailEmployeeNumber"];
if (personDict["PayslipNotificationTitle"] != null)
{

if (Boolean.Parse(

title.Text = personDict["

PayslipNotification

Title"]

))
{payslipNotification.CheckState = CheckState.Checked

;

}
else
{

payslipNotification.CheckState = CheckState.Unchecked;

}

}
if (personDict["SMSPayslipNotificationFirstName"] != null)
{firstName.Text = personDict["FirstName"];
if (

Boolean.Parse(

personDict["

SMSPayslipNotification

MiddleNames"]

))
{

smsPayslipNotification.CheckState = CheckState.Checked;

}
else
{

smsPayslipNotification.CheckState = CheckState.Unchecked;

}

}!= null) middleNames.Text = personDict["MiddleNames"];
if (personDict["LastName"] != null) lastName.Text = personDict["LastName"];
if (personDict["PostponeDateKnownAs"] != null && ) knownAs.Text = personDict["KnownAs"];
if (personDict["PostponeDateDateOfBirth"] != "")
{

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

null) dateOfBirth.Text = personDict["DateOfBirth"];
if (personDict["Gender"] != null) gender.Text = personDict["

PostponeDate

Gender"];

}
else
{

postponeDate.CustomFormat = " ";

}
if (personDict["Email"] != null) email.Text = personDict["Email"];
if (personDict["OptOutDatePayslipNotification"] != null && )
{

if (Boolean.Parse(personDict["

OptOutDate

PayslipNotification"]

!= ""

))
{ optOutDate

payslipNotification.

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

CheckState = CheckState.Checked;

}
else
{

optOutDate.CustomFormat = " ";

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

payslipNotification.CheckState = CheckState.Unchecked;

}

}
if (personDict["HolidaySchemeSMSPayslipNotification"] != null) holidayScheme.Text = personDict["HolidayScheme"];
{

if (Boolean.Parse(personDict["

AccrueDaysOverride

SMSPayslipNotification"]

!= null) accrueDaysOverride.Text = personDict["AccrueDaysOverride"];
if (personDict["OSPScheme"] != null) ospScheme.Text = personDict["OSPScheme"];
if (addressDict["Date

))
{

smsPayslipNotification.CheckState = CheckState.Checked;

}
else
{

smsPayslipNotification.CheckState = CheckState.Unchecked;

}

}

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

addressDatepostponeDate.CustomFormat = "yyyy/MM/dd";
addressDatepostponeDate.Text = addressDictpersonDict["DatePostponeDate"];

}
else
{

addressDate.CustomFormat = " ";

}

if (addressDict["AddressLine1"] != null) addressLine1.Text = addressDict["AddressLine1"];
if (addressDict["AddressLine2"] != null) addressLine2.Text = addressDict["AddressLine2"];
if (addressDict["AddressLine3

postponeDate.CustomFormat = " ";

}
if (personDict["OptOutDate"] != null ) addressLine3.Text = addressDict["AddressLine3"];
if (addressDict["Town"] != null) town.Text = addressDict["Town"];
if (addressDict["County&& personDict["OptOutDate"] != "")
{


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

}
else
{

optOutDate.CustomFormat = " ";

}
if (personDict["Method"] != null) countymethod.Text = addressDictpersonDict["CountyMethod"];
if (addressDictpersonDict["PostcodeHolidayScheme"] != null) postcodeholidayScheme.Text = addressDictpersonDict["PostcodeHolidayScheme"];
if (employmentDictpersonDict["DateOfJoiningAccrueDaysOverride"] != null) dateOfJoiningaccrueDaysOverride.Text = employmentDictpersonDict["DateOfJoiningAccrueDaysOverride"];
if (employmentDictpersonDict["ServiceStartDateOSPScheme"] != null) serviceStartDateospScheme.Text = employmentDictpersonDict["ServiceStartDateOSPScheme"];

if (employmentDictaddressDict["PayrollDate"] != null ) payroll.Text = employmentDict["Payroll"];
if (employmentDict["Workgroup"] != null) workgroup.Text = employmentDict["Workgroup"];
if (employmentDict["HoursCategory&& addressDict["Date"] != "")
{

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

}
else
{

addressDate.CustomFormat = " ";

}

if (addressDict["AddressLine1"] != null) hoursCategoryaddressLine1.Text = employmentDictaddressDict["HoursCategoryAddressLine1"];
if (employmentDictaddressDict["IrregularPaymentsAddressLine2"] != null)
{

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

irregularPayments.CheckState = CheckState.Checked;

}
else
{

irregularPayments.CheckState = CheckState.Unchecked;

}

}
if (employmentDict["OffPayrollWorkeraddressLine2.Text = addressDict["AddressLine2"];
if (addressDict["AddressLine3"] != null)
{

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

offPayrollWorker.CheckState = CheckState.Checked;

}
else
{

offPayrollWorker.CheckState = CheckState.Unchecked;

}

}

if (employmentDict["ApprenticeaddressLine3.Text = addressDict["AddressLine3"];
if (addressDict["Town"] != null) town.Text = addressDict["Town"];
if (addressDict["County"] != 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;

}

}

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

if (employmentDict["

JobTitle

DateOfJoining"] != null)

strtJobTitle

dateOfJoining.Text = employmentDict["

JobTitle

DateOfJoining"];
if (employmentDict["

WorkerPayType

ServiceStartDate"] != null)

workerPayType

serviceStartDate.Text = employmentDict["

WorkerPayType

ServiceStartDate"];
if (employmentDict["

ContractedHours

Payroll"] != null)


{

contractedHourspayroll.Text = employmentDict["ContractedHoursPayroll"];

}
else
{

contractedHours.Text = "";

}

if (

NIDict

employmentDict["

NINumber

Workgroup"] != null)

niNumber

workgroup.Text =

NIDict

employmentDict["

NINumber

Workgroup"];
if (

NIDict

employmentDict["

NITableLetter

HoursCategory"] != null)

niTableLetter

hoursCategory.Text =

NIDict

employmentDict["

NITableLetter

HoursCategory"];
if (

NIDict

employmentDict["

Director

IrregularPayments"] != null)
{

if (Boolean.Parse(

NIDict

employmentDict["

Director

IrregularPayments"]))
{

director

irregularPayments.CheckState = CheckState.Checked;

}
else
{

director

irregularPayments.CheckState = CheckState.Unchecked;

}

}
if (

NIDict

employmentDict["

NonCumulativeNI

OffPayrollWorker"] != null)
{

if (Boolean.Parse(

NIDict

employmentDict["

NonCumulativeNI

OffPayrollWorker"]))
{nonCumulativeNI

offPayrollWorker.CheckState = CheckState.Checked;

}
else
{nonCumulativeNI

offPayrollWorker.CheckState = CheckState.Unchecked;

}

}

if (

NIDict

employmentDict["

DirectorStartDate

Apprentice"] != null

&& NIDict

)
{

if (Boolean.TryParse(employmentDict["

DirectorStartDate"] != ""

Apprentice"], out bool apprentice))
{

if (apprentice)
{

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

}

else

{

Apprentice.CheckState = CheckState.Unchecked;

}
}
else
{

directorStartDateApprentice.CustomFormat = " "CheckState = CheckState.Unchecked;

}

}

if (paymentDict employmentDict["JobTitle"] != null)
{strtJobTitle.Text = employmentDict["JobTitle"];
if (

paymentDict

employmentDict["

AccountName

WorkerPayType"] != null)

accountName

workerPayType.Text =

paymentDict

employmentDict["

AccountName

WorkerPayType"];

if (

paymentDict

employmentDict["

AccountNumber

ContractedHours"] != null)

accountNumber


{

contractedHours.Text = employmentDict["ContractedHours"];

}
else
{

contractedHours.Text = paymentDict[ "AccountNumber"];

}

if (

paymentDict

NIDict["

SortCode

NINumber"] != null)

sortCode

niNumber.Text =

paymentDict

NIDict["

SortCode

NINumber"];
if (

paymentDict

NIDict["

RollNumber

NITableLetter"] != null)

rollNumber

niTableLetter.Text =

paymentDict

NIDict["

RollNumber

NITableLetter"];

}

if (starterStatementDict NIDict["Director"] != null)
{

if (

starterStatementDict

Boolean.Parse(NIDict["

StarterStatement

Director"]

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

))

{

director.CheckState = CheckState.Checked;

}
else
{

director.CheckState = CheckState.Unchecked;

}

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

studentLoanPlanType.Text = starterStatementDict["StudentLoanPlanType"];


{

if (Boolean.Parse(starterStatementDictNIDict["StudentLoanRepayDirectlyNonCumulativeNI"] != null) studentLoanRepayDirectly.Checked = Boolean.Parse(starterStatementDict["StudentLoanRepayDirectly"]);
if (starterStatementDict["StudentLoanBeforeLast6April"] != null) studentLoanBeforeLast6April.Checked = Boolean.Parse(starterStatementDict["StudentLoanBeforeLast6April"])))
{

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 (p45Dict paymentDict != null)
{

if (p45DictpaymentDict["P45EmployersReferenceAccountName"] != null) p45EmployersReferenceaccountName.Text = p45DictpaymentDict["P45EmployersReferenceAccountName"];
if (p45Dict["P45LeavingDate"] != null && p45DictpaymentDict["P45LeavingDateAccountNumber"] != "")

{

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

}
else
{

p45LeavingDate.CustomFormat = " ";

}

if (p45Dict["P45PeriodNonull) accountNumber.Text = paymentDict["AccountNumber"];
if (paymentDict["SortCode"] != null) sortCode.Text = paymentDict["SortCode"];
if (paymentDict["RollNumber"] != null) p45PeriodNorollNumber.Text = p45DictpaymentDict["P45PeriodNoRollNumber"];

}

if (

p45Dict

starterStatementDict != null)
{

if (starterStatementDict["P45TaxablePayStarterStatement"] != null) p45TaxablePaystarterStatement.Text = p45DictstarterStatementDict["P45TaxablePayStarterStatement"];
if (p45DictstarterStatementDict["P45TaxPaidStudentLoanPlanType"] != null) p45TaxPaidstudentLoanPlanType.Text = p45DictstarterStatementDict["P45TaxPaidStudentLoanPlanType"];
if (p45DictstarterStatementDict["P45TaxCodeStudentLoanRepayDirectly"] != null) p45TaxCodestudentLoanRepayDirectly.Text = p45DictChecked = Boolean.Parse(starterStatementDict["P45TaxCodeStudentLoanRepayDirectly"]);
if (p45DictstarterStatementDict["P45Wk1Mth1StudentLoanBeforeLast6April"] != null)

{

if (

studentLoanBeforeLast6April.Checked = Boolean.Parse(

p45Dict["P45Wk1Mth1"]))
{

p45Wk1Mth1.CheckState = CheckState.Checked;

}
else
{

p45Wk1Mth1.CheckState = CheckState.Unchecked;

}

}starterStatementDict["StudentLoanBeforeLast6April"]);

}

if (p45Dict != null)
{

if (p45Dict["P45TaxDistrictNoP45EmployersReference"] != null) p45TaxDistrictNop45EmployersReference.Text = p45Dict["P45TaxDistrictNoP45EmployersReference"];
if (p45Dict["P45PayFrequencyP45LeavingDate"] != null ) p45PayFrequency&& p45Dict["P45LeavingDate"] != "")

{

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

P45PayFrequency

P45LeavingDate"];

}

if (taxDict != null)
{


else
{

p45LeavingDate.CustomFormat = " ";

}

if (taxDictp45Dict["StartDateP45PeriodNo"] != null) taxStartDatep45PeriodNo.Text = taxDictp45Dict["StartDateP45PeriodNo"];
if (taxDictp45Dict["TaxCodeP45TaxablePay"] != null) taxTaxCodep45TaxablePay.Text = taxDictp45Dict["TaxCodeP45TaxablePay"];
if (taxDictp45Dict["TaxBasisP45TaxPaid"] != 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"

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
{

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

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("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\

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

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 btnUpdatePayment_Click(object sender, EventArgs e)
{

try

{

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

if (String.IsNullOrEmpty(token))
{

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

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
{

Console.WriteLine("Add Payment was not successful: " + response2.StatusCode);

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

nAdd Payment failed

nAuthenticated: " +

response2.StatusCode;
output.Text = output

token.ToString();

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

\r\nAdd Payment failed:

api/Payment/" +

response2

employeeID.

ToString()

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

nAdd Payment failed

nDoing PUT to URL: " +

response2.ReasonPhrase;

}

if (result == null)
{

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

}

else

{

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

}

}

}

catch (Exception ex)

{

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

}

}

Update a Payment

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

{

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("/", "-"

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: " + response2.ToString();
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

nAdd Payment failed: " + response2.ReasonPhrase;

}

if (result == null)
{

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

}

else

{

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

}

}

}

catch (Exception ex)

{

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

}

}

Update a Payment

private void btnUpdatePayment_Click(object sender, EventArgs e)
{

try

{

Console.WriteLine("Update

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

Payment clicked");
output.

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

}

if (result == null

Text = "";
var token = Authenticate();

if (String.IsNullOrEmpty(token))
{

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

nUpdate Payment returned null

nAuthentication failed ";

}

else

{

Console.WriteLine("Update Payment returned:" + result.ToString());

output.Text = output.Text + "

.

\r\

nUpdate Payment returned

nAuthenticated: " +

result

token.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))

{

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\

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

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.

DeleteAsync

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

{

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

Delete

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

}

else

{

Console.WriteLine("

Delete

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

nDelete

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

nDelete

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

nDelete

nUpdate Payment failed: " + response2.ReasonPhrase;

}

if (result == null)

{

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

nDelete

nUpdate Payment returned null";

}

else

{

Console.WriteLine("

Delete

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

nDelete

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

}

}

}

catch (Exception ex)

{

Console.WriteLine("Exception in

Delete

Update Payment:" + ex);

}

}

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

...

Comment

...

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