Payroll Configurations

Prepare A Payroll Configuration

curl-request
$ curl 'http://localhost:8080/customers/customerOne/payroll' -i -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{
  "mainAccountNumber" : "12345678910",
  "payrollAllocations" : [ {
    "accountNumber" : "9876543210",
    "amount" : 5500.0,
    "proportional" : true
  }, {
    "accountNumber" : "24681097531",
    "amount" : 43.0,
    "proportional" : true
  } ]
}'
http-request
PUT /customers/customerOne/payroll HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:8080
Content-Length: 253

{
  "mainAccountNumber" : "12345678910",
  "payrollAllocations" : [ {
    "accountNumber" : "9876543210",
    "amount" : 5500.0,
    "proportional" : true
  }, {
    "accountNumber" : "24681097531",
    "amount" : 43.0,
    "proportional" : true
  } ]
}
httpie-request
$ echo '{
  "mainAccountNumber" : "12345678910",
  "payrollAllocations" : [ {
    "accountNumber" : "9876543210",
    "amount" : 5500.0,
    "proportional" : true
  }, {
    "accountNumber" : "24681097531",
    "amount" : 43.0,
    "proportional" : true
  } ]
}' | http PUT 'http://localhost:8080/customers/customerOne/payroll' 'Accept:application/json' 'Content-Type:application/json'
Table 1. request-fields
Path Type Description

mainAccountNumber

String

Main account number

payrollAllocations[].accountNumber

String

Account from where you pay first allocation

payrollAllocations[].amount

Integer

Amount to be paid during first allocation

payrollAllocations[].proportional

Boolean

Should payments be proportional ?

payrollAllocations[1].accountNumber

String

Account from where you pay second allocation

payrollAllocations[1].amount

Integer

Amount to be paid during first allocation

payrollAllocations[1].proportional

Boolean

Should payments be proportional ?

http-response
HTTP/1.1 202 Accepted

Find A Payroll Configuration

curl-request
$ curl 'http://localhost:8080/customers/faundCostoma/payroll' -i -H 'Accept: application/json' -H 'Content-Type: application/json'
http-request
GET /customers/faundCostoma/payroll HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/customers/faundCostoma/payroll' 'Accept:application/json' 'Content-Type:application/json'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 364

{
  "mainAccountNumber" : "AB12345",
  "payrollAllocations" : [ {
    "accountNumber" : "BAH97531",
    "amount" : 73.0,
    "proportional" : true
  }, {
    "accountNumber" : "CAG24680",
    "amount" : 21.0,
    "proportional" : true
  } ],
  "createdBy" : "mage",
  "createdOn" : "2018-06-19T06:22:54.261Z",
  "lastModifiedBy" : null,
  "lastModifiedOn" : null
}
Table 2. response-fields
Path Type Description

mainAccountNumber

String

Main account number

payrollAllocations[].accountNumber

String

Account from where you pay first allocation

payrollAllocations[].amount

Integer

Amount to be paid during first allocation

payrollAllocations[].proportional

Boolean

Should payments be proportional ?

payrollAllocations[1].accountNumber

String

Account from where you pay second allocation

payrollAllocations[1].amount

Integer

Amount to be paid during first allocation

payrollAllocations[1].proportional

Boolean

Should payments be proportional ?

createdBy

String

Employee who configured payroll

createdOn

String

Date when payroll was configured

lastModifiedBy

String

Employee who last modified payroll

lastModifiedOn

String

Date when payroll was last modified

Distribute Payments

curl-request
$ curl 'http://localhost:8080/distribution' -i -X POST -H 'Content-Type: application/json' -d '{
  "sourceAccountNumber" : "S1R2C3A4C5C6",
  "payrollPayments" : [ {
    "customerIdentifier" : "flauna",
    "employer" : "The Shop",
    "salary" : 1234.56
  }, {
    "customerIdentifier" : "flauna",
    "employer" : "The Tank",
    "salary" : 14.54
  } ]
}'
http-request
POST /distribution HTTP/1.1
Content-Type: application/json
Host: localhost:8080
Content-Length: 260

{
  "sourceAccountNumber" : "S1R2C3A4C5C6",
  "payrollPayments" : [ {
    "customerIdentifier" : "flauna",
    "employer" : "The Shop",
    "salary" : 1234.56
  }, {
    "customerIdentifier" : "flauna",
    "employer" : "The Tank",
    "salary" : 14.54
  } ]
}
httpie-request
$ echo '{
  "sourceAccountNumber" : "S1R2C3A4C5C6",
  "payrollPayments" : [ {
    "customerIdentifier" : "flauna",
    "employer" : "The Shop",
    "salary" : 1234.56
  }, {
    "customerIdentifier" : "flauna",
    "employer" : "The Tank",
    "salary" : 14.54
  } ]
}' | http POST 'http://localhost:8080/distribution' 'Content-Type:application/json'
Table 3. request-fields
Path Type Description

sourceAccountNumber

String

Account from which payments ensue

payrollPayments[].customerIdentifier

String

first customer’s identifier

payrollPayments[].employer

String

first customer’s employer

payrollPayments[].salary

Number

first customer’s salary

payrollPayments[1].customerIdentifier

String

second customer’s identifier

payrollPayments[1].employer

String

second customer’s employer

payrollPayments[1].salary

Number

second customer’s salary

http-response
HTTP/1.1 202 Accepted

Fetch Distribution History

curl-request
$ curl 'http://localhost:8080/distribution' -i -H 'Accept: */*' -H 'Content-Type: application/json'
http-request
GET /distribution HTTP/1.1
Accept: */*
Content-Type: application/json
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/distribution' 'Accept:*/*' 'Content-Type:application/json'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 168

[ {
  "identifier" : "rBX30gbtvLrORr2ipUsDNKiUsRgqB4FC",
  "sourceAccountNumber" : "S9R7C5A3C1C",
  "createdBy" : "mage",
  "createdOn" : "2018-06-19T06:24:38.616Z"
} ]
Table 4. response-fields
Path Type Description

[].identifier

String

Payroll history identifier

[].sourceAccountNumber

String

Account from which payments ensue

[].createdBy

String

Employee who distributed payroll

[].createdOn

String

Date when payroll was distributed

Fetch Payments

curl-request
$ curl 'http://localhost:8080/distribution/9tBCjquueC5iXblOS5Upy34MyOg6zy7d/payments' -i -H 'Accept: */*' -H 'Content-Type: application/json'
http-request
GET /distribution/9tBCjquueC5iXblOS5Upy34MyOg6zy7d/payments HTTP/1.1
Accept: */*
Content-Type: application/json
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/distribution/9tBCjquueC5iXblOS5Upy34MyOg6zy7d/payments' 'Accept:*/*' 'Content-Type:application/json'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 208

{
  "payrollPayments" : [ {
    "customerIdentifier" : "ngone",
    "employer" : "Nkwane",
    "salary" : 945.0,
    "processed" : true,
    "message" : null
  } ],
  "totalPages" : 1,
  "totalElements" : 1
}
Table 5. response-fields
Path Type Description

payrollPayments[0].customerIdentifier

String

second customer’s identifier

payrollPayments[0].employer

String

second customer’s employer

payrollPayments[0].salary

Number

second customer’s salary

payrollPayments[0].processed

Boolean

second customer’s employer

payrollPayments[0].message

Null

second customer’s salary

totalPages

Integer

Pages of payroll payments

totalElements

Integer

Number of payroll payments