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

synnex-xml-sdk

v1.0.4

Published

A TypeScript-supported Node.js SDK for Synnex XML Services.

Downloads

170

Readme

Synnex XML SDK Documentation

Overview

The SynnexClient class provides a simple interface to interact with the TD SYNNEX XML API. It allows users to submit purchase orders and check the status of existing orders through the API.

Installation

To use the SynnexClient, first install the SDK package:

npm install synnex-xml-sdk

Usage

Importing the Client

To use the SynnexClient, import it from the package:

import { SynnexClient } from "synnex-xml-sdk";

Creating an Instance

Create an instance of SynnexClient by providing the necessary configuration options. These options include the environment, country, and authentication credentials.

Configuration Options

  • environment: Specifies the environment to use ("sandbox" or "production").
  • country: The country code ("US" or "CA").
  • username: Your API username.
  • password: Your API password.
  • accountNumber: Your account number with SYNNEX.
  • accountName: The name associated with your SYNNEX account.

Example: Creating an Instance

const synnexClient = new SynnexClient({
  environment: "sandbox",
  country: "US",
  username: "your-username",
  password: "your-password",
  accountNumber: "your-account-number",
  accountName: "Your Account Name",
});

Submitting a Purchase Order

To submit a purchase order, use the submitPO method. This method requires a SynnexB2BRequest object containing the order details.

Example: Submitting a Purchase Order

const orderRequest = {
  OrderRequest: {
    PONumber: "PO123456",
    DropShipFlag: "N",
    Shipment: {
      ShipFromWarehouse: "WarehouseCode",
      ShipTo: {
        AddressName1: "Customer Name",
        AddressLine1: "123 Street",
        City: "CityName",
        State: "StateCode",
        ZipCode: "12345",
        Country: "US",
      },
      ShipToContact: {
        ContactName: "Contact Name",
        PhoneNumber: "1234567890",
        EmailAddress: "[email protected]",
      },
      ShipMethod: {
        Code: "UPS",
      },
    },
    Payment: {
      BillTo: {
        AddressName1: "Billing Name",
        AddressLine1: "456 Billing St",
        City: "BillingCity",
        State: "BillingState",
        ZipCode: "67890",
        Country: "US",
      },
    },
    Items: [
      {
        LineNumber: 1,
        SKU: "SKU123",
        UnitPrice: 10.0,
        OrderQuantity: 2,
      },
    ],
  },
};

async function submitOrder() {
  try {
    const response = await synnexClient.submitPO(orderRequest);
    console.log("Order submitted successfully:", response);
  } catch (error) {
    console.error("Error submitting order:", error);
  }
}

submitOrder();

Checking Purchase Order Status

To check the status of a purchase order, use the getOrderStatus method. This method requires a POStatusRequest object containing the purchase order number.

Example: Checking Purchase Order Status

async function checkOrderStatus() {
  try {
    const statusResponse = await synnexClient.getOrderStatus("");
    console.log("Order status:", statusResponse);
  } catch (error) {
    console.error("Error retrieving order status:", error);
  }
}

checkOrderStatus();

Example: Checking Price and Availability of given SKU

async function checkPriceAvailability() {
  const skus = ["439866", "1058926"];

  try {
    const priceAvailabilityResponse = await synnexClient.getPriceAvailability(
      skus
    );
    console.log("Price and Availability Response:", priceAvailabilityResponse);
  } catch (error) {
    console.error("Error fetching price and availability:", error);
  }
}

checkPriceAvailability();

Environment Configuration

You can switch between the sandbox and production environments using the environment option in the configuration. Here are examples for both environments:

Sandbox Environment

const sandboxClient = new SynnexClient({
  environment: "sandbox",
  country: "US",
  username: "sandbox-username",
  password: "sandbox-password",
  accountNumber: "sandbox-account-number",
  accountName: "Sandbox Account",
});

Production Environment

const productionClient = new SynnexClient({
  environment: "production",
  country: "US",
  username: "production-username",
  password: "production-password",
  accountNumber: "production-account-number",
  accountName: "Production Account",
});

Conclusion

This SDK provides a straightforward interface for interacting with the TD SYNNEX XML API. Ensure you have the correct credentials and environment setup to use the client effectively. For more detailed information on request and response structures, please refer to the official TD SYNNEX API documentation.