Skip to content

Instantly share code, notes, and snippets.

View kevinsproles's full-sized avatar

kevin sproles kevinsproles

View GitHub Profile
@kevinsproles
kevinsproles / check-email.js
Last active November 5, 2019 17:41
Check Email
// This script is used to move email address box to top of checkout form,
// and prompt for login if user already has account
'use strict';
console.log('Check Email');
// Check email function
function checkEmail(email) {
console.log('Checking email ' + email);
<!-- Google Maps API for checkout page -->
<script src="/v/vspfiles/templates/269/js/map.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key={{insert-your-google-api-key}}&callback=initAddress&libraries=places" async defer></script>
// Tenant + App Credentials
const tenant = "INSERT_YOUR_TENANT_ID"
const appId = "INSERT_YOUR_EMAIL"
const appSecret = "INSERT_YOUR_PASSWORD"
// Credentials
const SHIPSTATION_API_KEY = "INSERT_YOUR_SHIPSTATION_API_KEY"
const SHIPSTATION_API_SECRET = "INSERT_YOUR_SHIPSTATION_API_KEY"
// ----------------------------------------------------
// Make Volt API Request: get orders
// ----------------------------------------------------
exports.getOrders = async function getOrders() {
// endpoint url
const url = "https://api.material.com/store/admin/orders"
// request method
const method = "GET"
/***************************************************************************/
// map volt to shipstation
/***************************************************************************/
// left side is the volt order format... --> right side is shipstation order model
// but first, map a few new properties ShipStation expects
let totalOrderWeight = 0
order.cart.items.map( item => {
item.product.weight_unit = 'grams';
/***************************************************************************/
// import the order into ShipStation
/***************************************************************************/
const shipstationAPI = require('node-shipstation');
const shipstation = new shipstationAPI(
SHIPSTATION_API_KEY, // api key
SHIPSTATION_API_SECRET // api secret
);
shipstation.addOrder(orderInShipStationFormat, function(err, res, body) {
{
"openapi" : "3.0.0",
"servers" : [ ],
"info" : {
"description" : "Welcome to the REST API Documentation for VOLT, by Volusion.\n\nDomain: `https://api.material.com`\n\nAll requests need a Bearer Token for Authorization, and a `x-mat-tenant` header with a value of the Merchant's Store Identifier (tenantId). Tokens are obtained via Admin Authentication. \n\nIf you are looking to develop an App for VOLT please reach out to our Partners Team, partners@volusion.com",
"version" : "1.0.0",
"title" : "VOLT API",
"contact" : {
"email" : "phil.manno@volusion.com"
},