Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const intro = document.querySelector(".intro"); | |
const controller = new ScrollMagic.Controller(); | |
// set desired animation time long enough so that it doesn't skip frames when scrolling fast. | |
const animationTime = 2427; | |
// initialise scrollmagic scene | |
let scene = new ScrollMagic.Scene({ | |
duration: animationTime, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Type":2, // 1 fulfilment, 2 for ordinary order | |
"CustomerId":"107085", // your account ID - this is mandatory | |
"ChannelId":158, // This is mandatory and refers to the base channel ID for shipping providers for a certain country. You can find the channelId from http://www.pfcexpress.com/webservice/APIWebService.asmx/getChannel. You will need to filter based on country code to determine what channelId to use. | |
"INorOut":0, // 0 for exports - most common | |
"IDCardNo":"", | |
"Remark":"", | |
"Products":[ | |
{ | |
"Price":64, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require("crypto"); | |
const fetch = require("isomorphic-fetch"); | |
exports.wooComPushToPFC = functions.https.onRequest((req, res) => { | |
const method = req.method; | |
const headers = req.headers; | |
const data = req.body; | |
if (method !== "POST") { | |
res.status(501).send("Incorrect req method"); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"id": 52, | |
"parent_id": 0, | |
"status": "pending", | |
"order_key": "order_5836d85314887", | |
"number": 52, | |
"currency": "EUR", | |
"version": "2.6.8", | |
"prices_include_tax": false, | |
"date_created": "2016–11–24T12:08:00", | |
"date_modified": "2016–11–24T12:08:51", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pushOrder = (data) => { | |
return new Promise((resolve, reject) => { | |
if (data.status !== "processing") { | |
console.log("order not completed"); // we only want to push data when the order transitions to processing (paid) | |
reject("Order not completed"); | |
} | |
// construct object for PFC | |
// POST data to PFC endpoint | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pfcEndpoint = "http://www.pfcexpress.com/webservice/v2/CreateShipment.aspx"; | |
let lineItems = []; | |
// creating an update line items array for the necessary object attributes for PFC | |
for (let i = 0; i <= data.line_items.length - 1; i++) { | |
let item = data.line_items[i]; | |
let temp_item = { | |
SKU: item.sku, | |
EnName: item.name, | |
CnName: "", | |
MaterialQuantity: item.quantity, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pfcData = JSON.stringify({ | |
Type: 2, // 1 fulfillment, 2 - ordinary | |
CustomerId: "107085", // 0 account ID for pfc | |
ChannelId: channelId, | |
Sender: "huangjia", | |
SendPhone: "0755–83727415", | |
SendAddress: | |
"4th Floor, Building C, №2, Road 1,Shangxue Science and Technology Park,Bantian street, Longgang District, Shenzhen, Guangdong Province, China", | |
SendCompany: "www.parcelfromchina.com", | |
SendEmail: "sales@pfcexpress.com", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchConfig = { | |
method: "POST", | |
headers: { | |
Authorization: "Bearer " + functions.config().pfc.apikey, //api key is stored as a env variable | |
"Content-Type": "application/json", | |
}, | |
body: pfcData, | |
}; | |
fetch(pfcEndpoint, fetchConfig) | |
.then((response) => response.json()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.wooComPushToPFC = functions.https.onRequest((req, res) => { | |
const method = req.method; | |
const headers = req.headers; | |
const data = req.body; | |
if (method !== "POST") { | |
res.status(501).send("Incorrect req method"); | |
} | |
const secret = functions.config().woocommerce.secret; //secret phrase set in woocommerce |
OlderNewer