lfrichter / omnivore
Laravel Facade to easy access Omnivore Api
Requires
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~7.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2025-04-07 06:01:37 UTC
README
Installation
Via Composer
$ composer require lfrichter/omnivore
If you do not run Laravel 5.5 (or higher), then add in config/app.php:
- service provider:
lfrichter\omnivore\omnivoreServiceProvider::class,
- facade to aliases:
'Omnivore' => lfrichter\omnivore\Facades\omnivore::class,
Usage
Place these values into your .ENV
OMNIVORE_API_URL=
OMNIVORE_API_KEY=
OMNIVORE_LOCATION_ID=
ES_FROM=
ES_SIZE=
Tickets functions
Interact with tickets of claimed locations from the POS.
List tickets for location
$ticketList = Omnivore::tickets()->ticketList($locationId);
Open a new ticket
$ticketOpen = Omnivore::tickets()->ticketOpen($locationId, $content);
Omnivore documentation
To open a new ticket you'll need the following:
- a valid employee id for the Location — we'll use EMPLOYEEID
- a valid order type id for the Location — we'll use ORDERTYPEID
- a valid revenue center id for the Location — we'll use REVENUECENTERID
- a valid table id for the Location — we'll use TABLEID
Sample JSON object to be send
{
"employee": "EMPLOYEEID",
"order_type": "ORDERTYPEID",
"revenue_center": "REVENUECENTERID",
"table": "TABLEID",
"guest_count": 1,
"name": "New Ticket",
"auto_send": true
}
You should get a 201 CREATED HTTP response to let you know your ticket has been added. You'll also get the ticket id field in the response which you need to add menu items or make payments.
Don't Send Items to the Kitchen
Did you notice the auto_send field we used when we opened the ticket? It determines whether new menu items are sent to the kitchen immediately, or if they're held until the ticket is paid. By default it's true which means as soon as you add a menu item to the ticket it will be made by the restaurant. If you set it to false nothing will be made until the ticket is paid in full and closed.
Retrieve data for a specific ticket
$ticketRetrieve = Omnivore::tickets()->ticketRetrieve($locationId, $ticketId);
Void a locations ticket
$ticketVoid = Omnivore::tickets()->ticketVoid($locationId, $ticketId);
List discounts for a ticket
$ticketDiscountList = Omnivore::tickets()->ticketDiscountList($locationId, $ticketId);
Apply a discount to a ticket
$ticketDiscountApply = Omnivore::tickets()->ticketDiscountApply($locationId, $ticketId, $discount, $value);
Retrieve a discount that was applied to a ticket
$ticketDiscountRetrieve = Omnivore::tickets()->ticketDiscountRetrieve($locationId, $ticketId, $ticketDiscountId);
List items on a ticket
$ticketItemList = Omnivore::tickets()->ticketItemList($locationId, $ticketId);
You'll get a list of menu items each with two important pieces of information:
- the menu item
id
- the list of acceptable
price_levels
for the item
Add an item to a ticket
$ticketItemAdd = Omnivore::tickets()->ticketItemAdd($locationId, $ticketId, $content);
Omnivore documentation
For this example pick an item that looks tasty and note its id
then choose an arbitrary price_levels
element and note its id
as well. We'll refer to them as MENUITEMID and PRICELEVELID respectively. Now, let's place an order on the ticket from earlier.
Sample JSON object to be send
{
"menu_item": "MENUITEMID",
"quantity": 1,
"price_level": "PRICELEVELID",
"comment": "Get in my belly!",
"modifiers": []
}
Making an Order with Modifiers
Let's say you've picked out a menu item, looked up its modifier groups, and figured out which modifiers you want to apply. You've noted all the modifier id values and the id for the appropriate price_level on each one. That's a lot, but now you're ready to place a personalized order.
Sample JSON object to be send
{
"menu_item": "MENUITEMID",
"quantity": 1,
"price_level": "PRICELEVELID",
"comment": "Get in my belly!",
"modifiers": [
{
"modifier": "MODIFIERID",
"quantity": 1,
"price_level": "PRICELEVELID",
"comment": "on the side"
},
{
"modifier": "MODIFIERID",
"quantity": 1,
"price_level": "PRICELEVELID",
"comment": "extra"
}
]
}
Retrieve an item from a ticket
$ticketItemRetrieve = Omnivore::tickets()->ticketItemRetrieve($locationId, $ticketId, $ticketItemId);
Void an item from a ticket
$ticketItemVoid = Omnivore::tickets()->ticketItemVoid($locationId, $ticketId, $ticketItemId)
List modifiers form a ticket
$ticketItemModifierList = Omnivore::tickets()->ticketItemModifierList($locationId, $ticketId, $ticketItemId)
Retrieve a modifier form a ticket
$ticketItemModifierRetrieve = Omnivore::tickets()->ticketItemModifierRetrieve($locationId, $ticketId, $ticketItemId, $ticketItemModifierId)
List dicounts on a ticket
$ticketItemDiscountList = Omnivore::tickets()->ticketItemDiscountList($locationId, $ticketId, $ticketItemId)
Retrieve a discount from a ticket
$ticketItemDiscountRetrieve = Omnivore::tickets()->ticketItemDiscountRetrieve($locationId, $ticketId, $ticketItemId, $ticketItemDiscountId)
List payments
$paymentList = Omnivore::tickets()->paymentList($locationId, $ticketId)
Retrieve a payment
$paymentRetrieve = Omnivore::tickets()->paymentRetrieve($locationId, $ticketId, $paymentId)
Make a payment where a card is not present
$paymentCardNotPresent = Omnivore::tickets()->paymentCardNotPresent($locationId, $ticketId, $content)
Sample JSON object to be send
{
"type": "card_not_present",
"amount": 500,
"tip": 100,
"card_info": {
"exp_month": 1,
"exp_year": 2025,
"cvc2": 123,
"number": "4111111111111111"
}
}
Make a payment where a card is present
$paymentCardPresent = Omnivore::tickets()->paymentCardPresent($locationId, $ticketId, $content)
Sample JSON object to be send
{
"type": "card_present",
"amount": 500,
"tip": 100,
"card_info": {
"data": "%B4111111111111111^SCHMOE /JOE^180710100695000000?"
}
}
Make a payment with a 3rd party
$payment3rdParty = Omnivore::tickets()->payment3rdParty($locationId, $ticketId, $content)
Sample JSON object to be send
{
"type": "3rd_party",
"amount": 500,
"tip": 100,
"tender_type": TENDERTYPEID,
"payment_source": "put your transaction reference here"
}
Make a payment with a card
$paymentGiftCard = Omnivore::tickets()->paymentGiftCard($locationId, $ticketId, $content)
Sample JSON object to be send
{
"type": "gift_card",
"amount": 500,
"tip": 100,
"card_info": {
"number": "1111111111111111"
}
}
Make a payment with cash
$paymentCash = Omnivore::tickets()->paymentCash($locationId, $ticketId, $content)
Tables functions
Interact with tables of claimed locations from the POS.
List tables of claimed locations
$tableList = Omnivore::tables()->tableList($locationId)
Retrieve data for a specific table
$tableRetrieve = Omnivore::tables()->tableRetrieve($locationId, $tableId)
General functions
Interact with general labeled actions of claimed locations from the POS.
List all locations claimed.
$locations = Omnivore::general()->locationList();
Retrieve information about a location
$locationRetrieve = Omnivore::general()->locationRetrieve($locationId)
List employees of a location
$employeeList = Omnivore::general()->employeeList($locationId)
Retrieve data of a specific location
$employeeRetrieve = Omnivore::general()->employeeRetrieve($locationId, $employeeId)
List location types (Order Types)
$orderTypeList = Omnivore::general()->orderTypeList($locationId)
Retrieve a locations type
$orderTypeRetrieve = Omnivore::general()->orderTypeRetrieve($locationId, $orderTypeId)
List the types of tender the location accepts
$tenderTypeList = Omnivore::general()->tenderTypeList($locationId)
Retrive the tender type
$tenderTypeRetrieve = Omnivore::general()->tenderTypeRetrieve($locationId, $tenderTypeId)
List a locations revenue centers
$revenueCenterList = Omnivore::general()->revenueCenterList($locationId)
Retrieve information of a payment center
$revenueCenterRetrieve = Omnivore::general()->revenueCenterRetrieve($locationId, $revenueCenterId)
List the discounts of a location
$discountList = Omnivore::general()->discountList($locationId)
Retrieve the discount
$discountRetrieve = Omnivore::general()->discountRetrieve($locationId, $discountId)
Grab the menu from POS
$menu = Omnivore::general()->menu($locationId)
List the menu categories
$categoryList = Omnivore::general()->categoryList($locationId)
Retrieve a category
$categoryRetrieve = Omnivore::general()->categoryRetrieve($locationId, $categoryId)
List items in a menu
$menuItemList = Omnivore::general()->menuItemList($locationId)
Retrieve a menu item
$menuItemRetrieve = Omnivore::general()->menuItemRetrieve($locationId, $menuItemId)
List location modifiers
$modifierList = Omnivore::general()->modifierList($locationId)
Retrieve a modifier
$modifierRetrieve = Omnivore::general()->modifierRetrieve($locationId, $modifierId)
List modifier groups
$modifierGroupList = Omnivore::general()->modifierGroupList($locationId, $menuItemId)
Retrieve a modifier group
$modifierGroupRetrieve = Omnivore::general()->modifierGroupRetrieve($locationId, $menuItemId, $modifierGroupId)
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
- Luis Fernando Richter
- This package was based in Onivore from Andreas Beasley
License
license. Please see the license file for more information.