Customer apps
The smart-locker operations for apps and websites of a service provider's customers.
The customer side calls the smart-locker operations of the partner app API at https://open.superroute.ca/app/v1: the operations that sApp offered up to 0.2.1, under the same names, and the second-hand handover operations.
An app that called these operations through sApp 0.2.1 keeps the same operation names; the calls move from the sApp package to the sLocker package. Store orders stay in sApp, opening the locker of a store order and asking for its refund included.
Signing in
An app that uses only sLocker creates the customer client with the app code, the client code of the service provider, the app key and a token store. People sign in the same ways as in sApp. Sign-in · sApp
import { SLocker } from '@superrouteca/slocker-customer';
const locker = SLocker.customer({
appCode: 'p_acme_parcels',
clientCode: 'k3m9q2', // the service provider's client code
appKey: 'sp_appkey_…', // restricted key for calls before sign-in
tokenStore, // secure storage: { get, set, clear }
locale: 'en',
});
await locker.auth.signInWithIdToken(googleIdToken);
const pickups = await locker.api.platformAppPickups({ status: 'ready' });
await locker.api.platformAppCollectPickup({ deliveryId: 42, body: { user_confirmed: true } });
const deals = await locker.api.lockerResaleDeals({ open: true });
An app that already uses sApp passes its sApp client instead. The person signs in once, and both packages use the same tokens.
import 'package:sapp/sapp.dart';
import 'package:slocker_customer/slocker_customer.dart';
final sr = PartnerClient(appCode: 'p_acme_parcels', clientCode: 'k3m9q2', appKey: 'sp_appkey_…', tokenStore: store);
final locker = SLocker.customerFor(sr);
final notifications = await sr.api.platformAppNotifications(); // sApp
final pickups = await locker.api.platformAppPickups(page: 1); // sLocker
from sapp import PartnerClient
from slocker.customer import customer
sr = PartnerClient('p_acme_parcels', client_code='k3m9q2', app_key='sp_appkey_…')
locker = customer(sapp=sr)
locker.api.platform_app_pickups(status='ready')
import SApp
import SLockerCustomer
let locker: SLockerCustomerClient = SLocker.customer(sapp: sr)
let pickups = try await locker.api.platformAppPickups(status: "ready")
Entries in each language
Each language has an entry for sLocker on its own and one beside an sApp client. Both return a customer with api (one method per operation), the sApp client underneath for sign-in and every other partner operation, and callOperation for an operation described by hand.
| Language | sLocker on its own | Beside an sApp client |
|---|---|---|
| JavaScript | SLocker.customer({ appCode, clientCode, appKey, tokenStore }) |
SLocker.customer({ sapp: sr }) |
| Dart | SLocker.customer(appCode: …, clientCode: …, appKey: …, tokenStore: …) |
SLocker.customerFor(sr) |
| Swift | SLocker.customer(appCode:clientCode:appKey:tokenStore:) |
SLocker.customer(sapp: sr) |
| Kotlin | SLocker.customer(appCode = …, clientCode = …, appKey = …, tokenStore = …) |
SLocker.customer(sapp = sr) |
| Java | SLocker.customer(appCode, clientCode, appKey, tokenStore) |
SLocker.customer(sr) |
| C# | SLocker.Customer("p_acme_parcels", clientCode: …, appKey: …, tokenStore: …) |
SLocker.Customer(sr) |
| Python | customer('p_acme_parcels', client_code=…, app_key=…, token_store=…) |
customer(sapp=sr) |
| PHP | SLocker::customer('p_acme_parcels', clientCode: …, appKey: …) |
SLocker::customer(sapp: $sr) |
| Go | customer.New(customer.Options{AppCode: …, ClientCode: …, AppKey: …}) |
customer.Share(sr) |
Capabilities
Each group needs the app capability shown, switched on for the app by the service provider. A sensitive capability is approved only while the developer account holds the matching permission from Superroute.
| Group | App capability | Permission from Superroute |
|---|---|---|
| Pickups | locker.pickup |
None |
| Locker locations | None | None |
| Locker storage | locker.storage |
None |
| Locker shop | locker.shop |
app.locker_shop |
| Second-hand handover | locker.resale |
app.locker_resale |
Collecting a pickup opens the door remotely and also needs locker.remote_open (app.locker_remote_open).
Operations
Pickups
Parcels waiting in lockers with their pickup codes: collect and open the door, hand a pickup to another person and take it back.
Locker locations
The service provider's locker locations, directions to the lockers inside a building, and the person's preferred locations.
Locker storage
Bags stored in lockers: add one by its code, keep it, change the return time, collect it at another cabinet, or have it delivered or shipped.
Locker shop
Buying from locker cabinets: the catalogue of a location, orders, opening the next door and asking for a refund; for merchant staff, the items in cells and staff codes.
Second-hand handover
A seller and a buyer hand an item over through a locker: the terms, opening a handover, sending and revoking the pickup code, calling it off and reporting a problem.
Customer API reference · UI kit
Errors and retries
Errors and retries are the same as in sApp: one error type with the HTTP status, the server's code and the parsed body, and signInRequired when the person must sign in again. Repeatable calls are retried; writes are never retried.