Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dominos

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dominos

node js API for Domino's pizza

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
172
increased by132.43%
Maintainers
1
Weekly downloads
 
Created
Source

Domino's PizzAPI

This is a node.js wrapper for the Domino's pizza APIs. The dominos module is the latest release and pizzapi should provide the dev release from our pizzapi development branch this branch is maintained by madelinecameron.
See the pretty PizzaPI documentation

Join the chat at https://gitter.im/RIAEvangelist/node-dominos-pizza-api

PAYMENT-SUPPORTED-MODULE
This module will pass payment information directly from the customer to Domino's Pizza for Domino's Pizza to process.

npm dominos info : See npm trends and stats for dominos
dominos npm version supported node version for pizzapi total npm downloads for pizzapi monthly npm downloads for pizzapi npm licence for pizzapi

RIAEvangelist

GitHub info :
node-dominos-pizza-api GitHub Release GitHub license node-dominos-pizza-api license open issues for node-dominos-pizza-api on GitHub


PAYMENT-DISSALLOWED-MODULE

For individuals who wish to test without the risk of actually purchasing @madelinecameron, a major contributor to this repo and module have created the npm pizzapi module it is the same as the dominos module but has no built in method to purchase, you would need to manually create the payment object to send to Domino's Pizza.

See npm trends and stats for pizzapi
pizzapi npm version supported node version for pizzapi total npm downloads for pizzapi monthly npm downloads for pizzapi npm licence for pizzapi

madelinecameron


This work is licenced via the DBAD Public Licence. It is a derivative work from Dominos API.

Install either Dominos or PizzaPI depending on your needs for placing an order.

payments are allowed and will purchase Pizza npm install dominos

no payments allowed, no actual pizza purchases npm install pizzapi

Contributing

  1. Pull or Fork code.
  2. from the cloned directory run npm install (this will install required dependancies, depending on your system may require)
  3. be awesome!

Examples

You can run the domino's pizza command line interface from your terminal just by running npm start! See the example in the examples directory.

See the examples directory for simple apps and demonstrations on using the basic functionality.

Testing

Simply run npm test if you have issues with this you may want to try installing mocha globally like this : npm install -g mocha

-OR for manual testing-

  1. Install mocha npm install -g mocha
  2. Run the tests mocha

Finding Stores

argumenttypedefaultrequired
addressfull or partial address stringnulltrue
typeDelivery, Carryout, allalltrue
callbackfunction to pass the api result tonulltrue

Note: the 'address' parameter is passed to the Address class. This means any formatting that works for Address will work being passed here. This means you can pass JSON, array or string.

By Postal Code

this yields the least accurate information

```javascript
var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');

pizzapi.Util.findNearbyStores(
    '63102',))
    'Delivery',
    function(storeData){
        console.log(storeData);
    }
);
```

By City and Postal Code

this yields less accurate information but is better than just using the postal code

    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');

    pizzapi.Util.findNearbyStores(
        'St. Louis, MO, 63102',
        'Delivery',
        function(storeData){
            console.log(storeData);
        }
    );

Using Full or Nearly Full Address

this yields the best information and sorts stores by actual distance

    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');

    pizzapi.Util.findNearbyStores(
        '700 Clark Ave, St. Louis, MO, 63102',
        'Delivery',
        function(storeData){
            console.log(storeData);
        }
    );


Store

argumenttypedefaultrequired
IDIntegernulltrue
    //Get Store Info for Store #4336
    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');
    var myStore=new pizzapi.Store();
    myStore.ID=4336;

    myStore.getInfo(
        function(storeData){
            console.log(storeData);
        }
    );
    ```

### Store menu

|argument|type|default|required|
|--------|----|-------|--------|
|callback|function|null|true   |

```javascript

    //Get Menu for Store #4336
    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');
    var myStore=new pizzapi.Store();
    myStore.ID=4336;

    myStore.getMenu(
        function(storeData){
            console.log(storeData);
        }
    );

Store info

argumenttypedefaultrequired
callbackfunctionnulltrue

    //Get Info for Store #4336
    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');
    var myStore=new pizzapi.Store();
    myStore.ID=4336;

    myStore.getInfo(
        function(storeData){
            console.log(storeData);
        }
    );

Friendly menu list

argumenttypedefaultrequired
callbackfunctionnulltrue

Returns a list of all items the store offers in an JSON array, formatted {Code: Friendly Name}


    //Get friendly name menu for Store #4336
    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');
    var myStore=new pizzapi.Store();
    myStore.ID=4336;

    myStore.getFriendlyNames(
        function(storeData){
            console.log(storeData);
        }
    );


Address

When creating a new Address object, there are many ways to instantiate the object!

The following are examples of the methods:

From string note the commas

    var fullAddress = new Address('900 Clark Ave, St. Louis, MO, 63102');

    //or

    var partAddress = new Address('St. Louis, MO, 63102');

    //or

    var stateAndZip = new Address('St. Louis, 63102');

    //or

    var cityAndZip = new Address('St. Louis, 63102');

    //only zip

    var onlyZip = new Address('63102');

From JSON

    var jsonAddress = new Address(
        {
            Street: '900 Clark Ave',
            City: 'St. Louis',
            Region: 'MO',
            PostalCode: 63102
        }
    );

From array

    var arrayAddress = new Address(['900 Clark Ave', 'St. Louis', 'MO', '63102']);


Customer

argumenttypedefault
addressAddressnull
firstNameString''
lastNameString''
emailString''
phoneString''


    var customer = new Customer(
        {
            address: someAddressObj,
            firstName: 'Barack',
            lastName: 'Obama',
            phone: '1-800-The-White-House',
            email: 'br'
        }
    )


Item

You can get the codes from one of the menu requests.

argumenttypedefault
codeStringnull
quantityInteger1
optionsArray[]

    var newItem = new Item(
        {
            code: '14SCREEN'
        }
    );

//and so on...


Order

This is the class that every other class feeds into.

argumenttypedefault
codeStringnull
quantityInteger1
optionsArray[]

creating an order


    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');

    var thePresident = new pizzapi.Customer(
        {
            firstName: 'Barack',
            lastName: 'Obama',
            address: '700 Pennsylvania Avenue, Washington, DC',
            email: 'barack@whitehouse.gov'
        }
    );

    var order = new pizzapi.Order(
        {
            customer: thePresident,

            //optional set the store ID right away
            storeID: myStore.ID,

            deliveryMethod: 'Delivery' //(or 'Carryout')
        }
    );

    //or

    var order = new pizzapi.Order();

    order.FirstName=data;
    order.LastName=data;
    order.Email=data;
    order.Phone=data;

    //and if you want to update the store id just :

    order.StoreID=myStore.ID;

duplicating an order


    var anotherIdenticalOrder = new pizzapi.Order(
        {
            order:order
            //or
            //Order:order
            //because domino's pizza web API returns pascal case...
        }
    );

    //or create a duplicate order WITH different customer params

    var order = new pizzapi.Order(
        {
            customer: thePresident,
            deliveryMethod: 'Delivery' //(or 'Carryout')
        }
    );

Adding a product to the order :


    order.addItem(
        new pizzapi.Item(
            {
                code: '14SCREEN',
                options: [],
                quantity: 1
            }
        )
    );

Validating an Order

This step is Strongly recommended


    order.validate(
        function(result) {
            console.log("We did it!");
        }
    );

Price an Order


    order.price(
        function(result) {
            console.log("Price!")
        }
    );

Place an Order

At least one item must've been added to place an order.

with payment allowed

You don't have to do anything for the payment, Domino's Pizza will handle all transactions.


    var pizzapi=require('dominos');

    var cardInfo = new order.PaymentObject();
    cardInfo.Amount = order.Amounts.Customer;
    order.Payments.push(cardInfo);

    order.place(
        function(result) {
            console.log("Order placed!");
        }
    );

no actual purchase allowed

    // if you want no accidental purchase or liability use the pizzapi module!
    var pizzapi=require('pizzapi');

    order.place(
        function(result) {
            console.log("Order placed!");
        }
    );


Tracking

By Phone

argumenttypedefaultrequired
phonePhone number string or intnulltrue
callbackfunction to pass the api result tonulltrue

    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');

    pizzapi.Track.byPhone(
        2024561111,
        function(pizzaData){
            console.log(pizzaData);
        }
    );

By orderKey

argumenttypedefaultrequired
orderKeystring or intnulltrue
storeIDsting or intnulltrue
callbackfunction to pass the api result tonulltrue

    var pizzapi=require('dominos'); // or without payment option : var pizzapi=require('pizzapi');

    pizzapi.Track.byId(
        123456,
        12345,
        function(pizzaData){
            console.log(pizzaData)
        }
    );

Code, Order, Eat, Be Happy!

Keywords

FAQs

Package last updated on 23 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc