Sandbox
A mock cabinet runs the same steps as a real cabinet without hardware.
A task created with mock: true uses mock cabinets only. Its webhooks carry livemode: false, an event_id that starts with PLE-MOCK- and the header X-Webhook-Test: 1, and go to the sandbox URL of the endpoint when one is set.
- Up to 5 mock cabinets per provider, with 1 to 60 compartments each.
- Read locations in the same mode as the task (mock: true on the scope locations and the nearby locations). A live location for a mock task answers 409 LOCKER_NO_CABINET_FOR_MODE.
What a mock cabinet can do
| Call | Effect |
|---|---|
createPartnerLockerMockLocker |
Creates a mock cabinet at a location. |
partnerLockerMockLockers |
Lists the mock cabinets of the provider. |
setPartnerLockerMockDoor |
Forces a door open or closed, for example a door left open. |
setPartnerLockerMockDevice |
Takes the cabinet offline or brings it back online. |
setPartnerLockerMockFeatures |
Changes the features the cabinet reports. |
setPartnerLockerMockCompartments |
Changes compartment sizes and weight limits, for example to test a package that does not fit. |
seedPartnerLockerMockParcel |
Places parcels in compartments. |
markPartnerLockerMockParcelsTaken |
Marks parcels as taken: the pickup is completed and partner_locker.pickup.completed is sent. |
clearPartnerLockerMockParcels |
Empties the cabinet without a pickup. |
deletePartnerLockerMockLocker |
Deletes the mock cabinet. |
A sandbox run
# Python
locker = sl.create_partner_locker_mock_locker(body={'location_id': 101, 'name': 'Dev cabinet', 'compartments': 8})
device_id = locker['data']['locker']['device_id']
task = sl.create_partner_locker_delivery(idempotency_key='TEST-1', body={
'external_order_id': 'TEST-1', 'platform_scope_group_id': 12, 'recipient': {'email': 'qa@example.com'}, 'mock': True})
opened = sl.open_partner_locker_delivery(body={'location_id': 101, 'access_code': task['data']['access_code']})
sl.confirm_partner_locker_delivery(body={'claim_token': opened['data']['claim_token'], 'decision': 'confirm_all'})
# webhook partner_locker.delivery.delivered, livemode false
sl.mark_partner_locker_mock_parcels_taken(device_id, body={'compartments': [1]})
# webhook partner_locker.pickup.completed
sl.clear_partner_locker_mock_parcels(device_id)
sl.set_partner_locker_mock_door(device_id, body={'compartment': 2, 'action': 'open'})
sl.set_partner_locker_mock_compartments(device_id, body={'compartments': [1, 2], 'grid_length_cm': 20,
'grid_width_cm': 20, 'grid_height_cm': 20, 'weight_limit_kg': 5})
sl.delete_partner_locker_mock_locker(device_id)
// JavaScript / TypeScript
const { data } = await sl.api.createPartnerLockerMockLocker({ body: { location_id: 101, name: 'Dev cabinet', compartments: 8 } });
const locations = await sl.api.partnerLockerScopeLocations({ mock: true });