1.1.3 • Published 3 years ago

ampsalesfunnels-functions v1.1.3

Weekly downloads
9
License
SEE LICENSE IN li...
Repository
-
Last release
3 years ago

ampsalesfunnels-functions

Set with helper functions for the implementation of Netlify functions.

Functions

printEnv(additionalAMPSFVars, additionalNetlifyVars) ⇒ void

Kind: global function

ParamTypeDescription
additionalAMPSFVarsArray.<string>additional AMPSalesFunnels specific environment variables to print
additionalNetlifyVarsArray.<string>additional Netlify specific environment variables to print

isProductionBasedOnHostname() ⇒ boolean

Kind: global function

getEnv(envName)

Kind: global function

ParamType
envName*

prepareFunction(event, context, dirname, additionalAMPSFVars, additionalNetlifyVars) ⇒ void

Kind: global function

ParamTypeDescription
eventAPIGatewayProxyEvent
contextany
dirnamestringpath to the directory containing the function
additionalAMPSFVarsArray.<string>additional AMPSalesFunnels specific environment variables to print
additionalNetlifyVarsArray.<string>additional Netlify specific environment variables to print

getAMPRedirectToFunctionResult(url) ⇒ *

Kind: global function

ParamTypeDescription
urlstringurl to redirect to

getEmptyFunctionResult() ⇒ Object

Kind: global function

getMessageFunctionResult(message) ⇒ Object

Kind: global function

ParamTypeDescription
messagestringthe message to return in body: { "message": message }

getObjectFunctionResult(obj) ⇒ *

Kind: global function

ParamTypeDescription
obj*the obj to return in body: { ... }

getErrorFunctionResult(statusCode, error) ⇒ Object

Kind: global function

ParamTypeDescription
statusCodenumberstatus code
errorError | stringthe error object (or a string), error message wil be returned in body: { "error": "message" }

sendEmailWithMailgen(nodemailerTransporter, from, to, name, sku, dirname) ⇒ Promise.<void>

Kind: global function

ParamTypeDescription
nodemailerTransporterTransporterthe nodemailer transporter to use
fromstringemail address of the sender
tostringemail address to send the mail to
namestringname of the customer
skustringunique identifier for the product (stock-keeping unit)
dirnamestringpath to the directory containing the mailgen files

makeQueryString(params) ⇒ string

Kind: global function
Returns: string - the query string

ParamTypeDescription
paramsObject.<string, string>dictionary object with name-value pairs

ifttt_event(key, eventname, value1, value2, value3)

Kind: global function
Category: IFTTT

ParamTypeDescription
keystringIFTTT key, available at https://ifttt.com/maker_webhooks/settings (after /use/)
eventnamestringthe name of the event to report
value1stringfirst value
value2stringsecond value
value3stringthird value

log_event(production, eventname, valueA, valueB)

Kind: global function
Category: IFTTT

ParamTypeDescription
productionbooleantrue if production; false if sandbox
eventnamestringthe name of the event to report, can be ERROR, LOG, INTERESTED, SALE, ...
valueAstringfirst value
valueBstringsecond value

log_event_error(production, functionFilename, name, email, message)

Kind: global function
Category: IFTTT

ParamTypeDescription
productionbooleantrue if production; false if sandbox
functionFilenamestringfilename of the function
namestringname of user
emailstringemail of user
messagestringerror message

log_event_information(production, functionFilename, name, email, message)

Kind: global function
Category: IFTTT

ParamTypeDescription
productionbooleantrue if production; false if sandbox
functionFilenamestringfilename of the function
namestringname of user
emailstringemail of user
messagestringmessage to log

log_event_interest(production, name, email, sku, price)

Kind: global function
Category: IFTTT

ParamTypeDefaultDescription
productionbooleantrue if production; false if sandbox
namestringname of user
emailstringemail of user
skustring"unknown"sku of the product user is interested in
pricestring"unknown"price of sku

log_event_sale(production, name, email, sku, price)

Kind: global function
Category: IFTTT

ParamTypeDefaultDescription
productionbooleantrue if production; false if sandbox
namestringname of user
emailstringemail of user
skustring"unknown"sku of the product user is interested in
pricestring"unknown"price of sku

getPayPalBaseUrl(production) ⇒ string

Kind: global function
Returns: string - The PayPal base URL https://www.sandbox.paypal.com or https://www.paypal.com'
Category: PayPal

ParamTypeDescription
productionbooleanin production mode if true; in sandbox mode if false

getPayPalMerchantEmail(production) ⇒ string

Kind: global function
Returns: string - email address of merchant
Category: PayPal

ParamTypeDescription
productionbooleanin production mode if true; in sandbox mode if false

getPayPalIpnNotificationUrl(production) ⇒ string

Kind: global function
Returns: string - The IPN notification URL
Category: PayPal

ParamTypeDescription
productionbooleanin production mode if true; in sandbox mode if false

getPayPalProductUrl(sku, formData, customData, siteUrl, returnPage, cancelPage, logoUrl, dirname, production) ⇒ string

Kind: global function
Returns: string -

ParamTypeDescription
skustringunique identifier for the product (stock-keeping unit)
formDataobjectform data as posted on the salesfunnel page
customDataobjectcustom data to add to the PayPal URL
siteUrlstringurl of the site hosting the salesfunnel page
returnPagestringrelative url of page to go to when PayPal checkout completed, e.g. salesfunnel-thanks.html page)
cancelPagestringrelative url of page to go to when PayPal flow is canceled (salesfunnel page)
logoUrlstringrelative url to a 150x50 product log image used in PayPal checkout
dirnamestringpath to the directory containing the products.json file
productionbooleanin production mode if true; in sandbox mode if false

payPalIpnValidate(ipnMessage, production) ⇒ Promise.<void>

Kind: global function
Returns: Promise.<void> -

ParamTypeDescription
ipnMessagestringthe body of the PayPal IPN message
productionbooleanin production mode if true; in sandbox mode if false

payPalIpnToOrder(body) ⇒ *

Kind: global function
Returns: * - an order object with all IPN fields
Category: PayPal

ParamTypeDescription
bodystringPOST body as PayPal sends to IPN endpoint

=== © 2021 Dellariva Solutions