Category: Node.js

Apps

start-fortnox-sync (from Airtable)

– Was made for internal Use. Starts Pricelist sync to Fortnox on the main shops server. Waits for 30 minutes for each pricelist to finish. NOTE: Add airtableToken & main server authorizationLink to make it work. (async function() {   var localMode = typeof addEventListener === “undefined” && typeof input === “undefined” ? true : false; …

Apps

update-currency-rates (Airtable)

Finds pricelists on Airtable on all bases by checking 2 tables: Pricelist & (*). (*) tables contains all the currency rates in this format: (Please note that SEK is master currency) Code. Rate —- —- SEK 1.0000000 USD 0.0972745 AED 0.3572467 AFN 8.4328730 ALL 10.0878786 AMD 37.8046774 ANG 0.1755555 AOA 49.2695078 ARS 20.5039556 AUD 0.1440093 …

Apps, Blog

fn-cors-proxy-with-auto-refresh

This script will run a simple CORS server for Fortnox API: https://developer.fortnox.se/documentation/ It will also refresh the API token every 30 minutes and will use it automatically allowing us access to Fortnox API. We do not need to provide Fortnox API token. There should be a token file with client ID & secret with same …

apps

certbot-autorenew-cron-v1

v1.js

Helps to renew SSL certificates automatically using certbot. Helps in automatic domain verification too. Also, runs a cron to keep checking SSL renewal automatically at specified time interval.

We need to set reverse proxy for .well-known folder so it can do the verification for us.
For example for openlitespeed go into Virtual Hosts and click a host. Go into External App add the app there with address 127.0.0.1:9999. Then go into context and add URI as /.well-known and select the external app you added.

Should be run with command line arguments.

Example:
node certbot-autorenew-cron-v1.js \
server-port=9999 \
server-folder=/mnt/node/letsencrypt \
cron-key= \
cron-interval=86400 \
dry-run=true \
optional:
console-key=my-console-key
console-prefix=certbot-autorenew-cron-v1

Check also: https://console.ylo.one/

Cron will not run until you specify cron-interval option.
Cron key is for running cron manually for example calling http://127.0.0.1:9999/cron-key
dry-run is equivalent to certbot’s –dry-run.

Help: Coming soon! 😀

An app bundled by ac-bundle-app, published by ac-bundle-module. namespace: certbot-autorenew-cron

Available Methods: start, startUps, workerStartUps, callbacks, build, cron, parseArgv, console, exit, consoleColors, camelCase, properCase, enhance, publish, server, has

apps

import-from-woocommerce-to-fortnox-cron-v1

v1.js

Cron to perform multiple imports from woocommerce to fortnox. Imports orders to fortox.
Should be run with command line arguments.

Example:
node import-from-woocommerce-to-fortnox-cron-v1.js \
conf-airtable-base-name= \
conf-airtable-table-name= \
conf-airtable-view-name= \
conf-airtable-api-key= \
conf-airtable-table-key= \
conf-airtable-key-name= \
conf-airtable-key-value= \
type=order \
fn-api-url= \
fn-client-secret= \
fn-access-token= \
optional:
console-key=my-console-key
console-prefix=import-from-woocommerce-to-fortnox-v1

Check also: https://console.ylo.one/

Airtable configuration schema table example: https://airtable.com/shrOSB0DFqir5c46L/tblL26Ms8WZWh6Uh0

Help: Coming soon! 😀

An app bundled by ac-bundle-app, published by ac-bundle-module. namespace: import-from-woocommerce-to-fortnox-cron

Available Methods: start, startUps, workerStartUps, callbacks, api, build, cron, parseArgv, console, exit, consoleColors, camelCase, properCase, workers, enhance, publish, utils, has

apps

import-from-woocommerce-to-fortnox-v1

v1.js

Imports from woocommerce to fortnox. Imports orders to fortnox. You can also import a single order by specifying wc-order-number.
Should be run with command line arguments.

Example:
node import-from-woocommerce-to-fortnox-v1.js \
wc-api-url=https://SITE/wp-json/wc/v3 \
wc-consumer-key= \
wc-consumer-secret= \
type=order \
fn-api-url= \
fn-client-secret= \
fn-access-token= \
wc-order-number=XXXXXX \
optional:
console-key=my-console-key
console-prefix=import-from-woocommerce-to-fortnox-v1

Help: Coming soon! 😀

An app bundled by ac-bundle-app, published by ac-bundle-module. namespace: import-from-woocommerce-to-fortnox

Available Methods: start, startUps, workerStartUps, callbacks, api, build, parseArgv, console, exit, consoleColors, camelCase, properCase, enhance, publish, sync, utils, has

modules

ac-apps-minimal-api-fortnox

api/fortnox.js

Makes it easy to work with Fortnox API.

Example:
app.api.fortnox.createOrder(options, order);
app.api.fortnox.updateCustomer(options, customer);
app.api.fortnox.getCustomers(options, email);

A module for ac-bundle-app, published by ac-bundle-module. namespace: ac-apps-minimal

Available Methods: createOrder, updateCustomer, createCustomer, getCustomers

modules

ac-apps-minimal-utils-relatedfields

utils/relatedFields.js

Helps to parse left to right sync related fields.

Example:
app.utils.relatedFields.parse("Model+sku,regular_price_sek+price");
Will return: { Model: 'sku', regular_price_sek: 'price' }

A module for ac-bundle-app, published by ac-bundle-module. namespace: ac-apps-minimal

Available Methods: parse