npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ez-pizza-api

v1.0.2

Published

A simple library for interacting with the Dominos Pizza API.

Downloads

1

Readme

🍕 EZ Pizza API 🍕

A simple library for interacting with the Dominos Pizza API.

Install

npm i ez-pizza-api

DOCS

See DOCS for all available methods and descriptions of each.

Example Usage

const ezPizzaAPI = require('ez-pizza-api');

(async () => {
  const cityRegionOrPostalCode = 'Denver, CO, 80202';
  const streetAddress = '1280 Grant St';

  // Get a full list of stores near an address
  const storesResult = await ezPizzaAPI
    .getStoresNearAddress(ezPizzaAPI.orderTypes.Carryout, cityRegionOrPostalCode);

  // Get basic info about nearest delivery store to address
  const storeResult = await ezPizzaAPI
    .getNearestDeliveryStore(cityRegionOrPostalCode, streetAddress);

  // Get full info about specified store
  const storeInfo = await ezPizzaAPI
    .getStoreInfo(storeResult.StoreID);

  // Get full menu for the specified store
  const storeMenu = await ezPizzaAPI
    .getStoreMenu(storeResult.StoreID);

  const couponId = '9193';
  // Get info for the specified store and coupon
  // Coupon ID found in the above menu request
  const coupon = await ezPizzaAPI
    .getStoreCoupon(storeResult.StoreID, couponId);

  // Create an Order with the following properties
  const order = {
    Order: {
      Address: { // <- Update this
        Street: '123 Sesame St.',
        City: 'New York',
        Region: 'NY',
        PostalCode: '10001',
        Type: 'House',
        StreetName: 'Sesame St',
        StreetNumber: '123',
      },
      // Specify any coupons here, leave empty if not using a coupon
      Coupons: [{
        Code: couponId,
        Qty: 1,
        ID: 2, // Specify your own IDs, increment if more than 1 specified
      }],
      Email: '[email protected]', // <- Update this
      FirstName: 'Cool', // <- Update this
      LastName: 'Guy', // <- Update this
      LanguageCode: 'en',
      OrderChannel: 'OLO',
      OrderMethod: 'Web',
      OrderTaker: null,
      Payments: [],
      Phone: '1234567890', // <- Update this
      PhonePrefix: '1', // <- Update this
      // An array of products. Find the corresponding code and available options in the menu response.
      Products: [{
        Code: '12THIN',
        Qty: 1,
        isNew: true,
        Options: {
          X: {
            '1/1': '1',
          },
          C: {
            '1/1': '1',
          },
          Sa: {
            '1/1': '1',
          },
          J: {
            '1/2': '1',
          },
          Z: {
            '2/2': '1',
          },
        },
      }, {
        Code: 'MARBRWNE',
        Qty: 1,
        isNew: true,
        Options: {},
      }, {
        Code: 'B16PBIT',
        Options: {},
        Qty: 1,
        isNew: true,
      }],
      ServiceMethod: ezPizzaAPI.orderTypes.Delivery, // <- Update this can be Delivery or Carryout
      SourceOrganizationURI: 'order.dominos.com',
      StoreID: storeResult.StoreID,
      Tags: {},
      Version: '1.0',
      NoCombine: true,
      Partners: {},
      OrderInfoCollection: [],
    },
  };

  const orderValid = await ezPizzaAPI.validateOrder(order);
  order.Order.OrderID = orderValid.Order.OrderID; // get the generated orderID from the response

  const pricedOrder = await ezPizzaAPI.priceOrder(order);
  const Amount = pricedOrder.Order.Amounts.Customer; // get total amount for order

  // specify the amount and credit card info OR see how to use cash on delivery below
  order.Order.Payments.push({
    Amount,
    Type: 'CreditCard',
    Number: '​4242424242424242',
    CardType: 'VISA',
    Expiration: '0424',
    SecurityCode: '424',
    PostalCode: '80202',
  });

  // OR
  // specify the amount type as Cash
  order.Order.Payments.push({
    Amount,
    Type: 'Cash', // <- Pay cash on delivery
  });

  const placedOrder = await ezPizzaAPI.placeOrder(order);
  // For a succesful order, look for:
  // StoreOrderID
  // EmailHash
  // StatusItems: [ { Code: 'Success' } ] }

  // Be sure to check your email before trying again.
  // Sometimes this has a failure status but the order still goes through...
  console.log(placedOrder);

  // Getting the orderID may vary. Validate by looking at the placedOrder response
  const orderID = placedOrder.Order.StoreOrderID.split('#')[1]; // <- This might change depending on store
  const orderStatus = await ezPizzaAPI.trackOrder(storeResult.StoreID, orderID);
  console.log(orderStatus);
})();