Manage Operator Shifts
This guide shows how to set up the number of shifts on a terminal, move to the next shift, and read how many shifts are configured, using the Shift deeplink.
How it works
All three operations share the getnet://payment/v1/shift URI and are selected by the shiftOperation parameter:
shiftOperation | Action | Notes |
|---|---|---|
"1" | Set up the number of available shifts | Pass the amount in numberOfShifts. |
"2" | Change to the next shift | No extra parameter needed. |
"3" | Retrieve the current shift amount | The response adds totalOfShifts. |
The terminal adjusts the flow to what you send. When a required value is already in the request, the corresponding input screen is skipped; when it is missing, the terminal prompts the operator for it.
Before you begin
The Getnet Payment App must be installed on the terminal and your application must be able to launch it, as described in Architecture and flow.
Step 1: Send the shift Intent
Build the Intent with the operation you need. The example below configures two shifts and takes responsibility for printing:
private val REQUEST_CODE = 1001
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/shift"))
intent.putExtra("shiftOperation", "1")
intent.putExtra("numberOfShifts", "2")
intent.putExtra("allowPrintCurrentTransaction", "false")
startActivityForResult(intent, REQUEST_CODE)
}The optional skipConfirmation parameter suppresses the shift change confirmation screen. The allowPrintCurrentTransaction parameter follows the rules in Printing responsibility.
Step 2: Handle the response
Read result and resultDetails from the returned Intent. For shiftOperation "3", also read totalOfShifts:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
val extras = data?.extras
val result = extras?.getString("result")
val resultDetails = extras?.getString("resultDetails")
val totalOfShifts = extras?.getString("totalOfShifts")
}
}A successful setup or change returns result 0 with resultDetails APPROVED. A retrieve operation returns the same pair plus the shift count:
{
"result": 0,
"resultDetails": "APPROVED",
"totalOfShifts": "3"
}totalOfShifts is present only when shiftOperation is "3".
Next steps
- Deeplink parameters reference - the full request and response parameters for the Shift deeplink.
- Result codes and data structures - interpret the
resultvalue returned by the operation.