-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (27 loc) · 1.46 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require('colors');
require('dotenv').config();
const mutations = require("./modules/mutations");
const post = require("./modules/post");
console.info("Creating customer:".cyan);
post(mutations.createCustomer);
console.info("Generating the customer token:".cyan);
var response = post(mutations.generateCustomerToken);
var token = response.generateCustomerToken.token;
console.info("Creating an empty guest cart:".cyan);
response = post(mutations.createGuestCart, token);
var cartId = response.createEmptyCart;
console.info("Adding a simple product to the cart:".cyan);
response = post(mutations.addSimpleProductToCart.replace("CART_ID", cartId), token);
console.info("Setting a shipping address:".cyan);
response = post(mutations.setShippingAddress.replace("CART_ID", cartId), token);
console.info("Setting a billing address:".cyan);
response = post(mutations.setBillingAddress.replace("CART_ID", cartId), token);
console.info("Setting a shipping method:".cyan);
response = post(mutations.setShippingMethod.replace("CART_ID", cartId), token);
console.info("Setting a guest email address:".cyan);
response = post(mutations.setGuestEmail.replace("CART_ID", cartId), token);
console.info("Setting the payment method:".cyan);
response = post(mutations.setPaymentMethod.replace("CART_ID", cartId), token);
console.info("Placing the order:".cyan);
response = post(mutations.placeOrder.replace("CART_ID", cartId), token);
response = post(mutations.placeOrder.replace("CART_ID", cartId), token);