ampsalesfunnels-functions v1.1.3
ampsalesfunnels-functions
Set with helper functions for the implementation of Netlify functions.
Functions
printEnv(additionalAMPSFVars, additionalNetlifyVars) ⇒ void
Kind: global function
Param | Type | Description |
---|---|---|
additionalAMPSFVars | Array.<string> | additional AMPSalesFunnels specific environment variables to print |
additionalNetlifyVars | Array.<string> | additional Netlify specific environment variables to print |
isProductionBasedOnHostname() ⇒ boolean
Kind: global function
getEnv(envName)
Kind: global function
Param | Type |
---|---|
envName | * |
prepareFunction(event, context, dirname, additionalAMPSFVars, additionalNetlifyVars) ⇒ void
Kind: global function
Param | Type | Description |
---|---|---|
event | APIGatewayProxyEvent | |
context | any | |
dirname | string | path to the directory containing the function |
additionalAMPSFVars | Array.<string> | additional AMPSalesFunnels specific environment variables to print |
additionalNetlifyVars | Array.<string> | additional Netlify specific environment variables to print |
getAMPRedirectToFunctionResult(url) ⇒ *
Kind: global function
Param | Type | Description |
---|---|---|
url | string | url to redirect to |
getEmptyFunctionResult() ⇒ Object
Kind: global function
getMessageFunctionResult(message) ⇒ Object
Kind: global function
Param | Type | Description |
---|---|---|
message | string | the message to return in body: { "message": message } |
getObjectFunctionResult(obj) ⇒ *
Kind: global function
Param | Type | Description |
---|---|---|
obj | * | the obj to return in body: { ... } |
getErrorFunctionResult(statusCode, error) ⇒ Object
Kind: global function
Param | Type | Description |
---|---|---|
statusCode | number | status code |
error | Error | string | the 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
Param | Type | Description |
---|---|---|
nodemailerTransporter | Transporter | the nodemailer transporter to use |
from | string | email address of the sender |
to | string | email address to send the mail to |
name | string | name of the customer |
sku | string | unique identifier for the product (stock-keeping unit) |
dirname | string | path to the directory containing the mailgen files |
makeQueryString(params) ⇒ string
Kind: global function
Returns: string - the query string
Param | Type | Description |
---|---|---|
params | Object.<string, string> | dictionary object with name-value pairs |
ifttt_event(key, eventname, value1, value2, value3)
Kind: global function
Category: IFTTT
Param | Type | Description |
---|---|---|
key | string | IFTTT key, available at https://ifttt.com/maker_webhooks/settings (after /use/) |
eventname | string | the name of the event to report |
value1 | string | first value |
value2 | string | second value |
value3 | string | third value |
log_event(production, eventname, valueA, valueB)
Kind: global function
Category: IFTTT
Param | Type | Description |
---|---|---|
production | boolean | true if production; false if sandbox |
eventname | string | the name of the event to report, can be ERROR, LOG, INTERESTED, SALE, ... |
valueA | string | first value |
valueB | string | second value |
log_event_error(production, functionFilename, name, email, message)
Kind: global function
Category: IFTTT
Param | Type | Description |
---|---|---|
production | boolean | true if production; false if sandbox |
functionFilename | string | filename of the function |
name | string | name of user |
string | email of user | |
message | string | error message |
log_event_information(production, functionFilename, name, email, message)
Kind: global function
Category: IFTTT
Param | Type | Description |
---|---|---|
production | boolean | true if production; false if sandbox |
functionFilename | string | filename of the function |
name | string | name of user |
string | email of user | |
message | string | message to log |
log_event_interest(production, name, email, sku, price)
Kind: global function
Category: IFTTT
Param | Type | Default | Description |
---|---|---|---|
production | boolean | true if production; false if sandbox | |
name | string | name of user | |
string | email of user | ||
sku | string | "unknown" | sku of the product user is interested in |
price | string | "unknown" | price of sku |
log_event_sale(production, name, email, sku, price)
Kind: global function
Category: IFTTT
Param | Type | Default | Description |
---|---|---|---|
production | boolean | true if production; false if sandbox | |
name | string | name of user | |
string | email of user | ||
sku | string | "unknown" | sku of the product user is interested in |
price | string | "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
Param | Type | Description |
---|---|---|
production | boolean | in production mode if true; in sandbox mode if false |
getPayPalMerchantEmail(production) ⇒ string
Kind: global function
Returns: string - email address of merchant
Category: PayPal
Param | Type | Description |
---|---|---|
production | boolean | in production mode if true; in sandbox mode if false |
getPayPalIpnNotificationUrl(production) ⇒ string
Kind: global function
Returns: string - The IPN notification URL
Category: PayPal
Param | Type | Description |
---|---|---|
production | boolean | in 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 -
Param | Type | Description |
---|---|---|
sku | string | unique identifier for the product (stock-keeping unit) |
formData | object | form data as posted on the salesfunnel page |
customData | object | custom data to add to the PayPal URL |
siteUrl | string | url of the site hosting the salesfunnel page |
returnPage | string | relative url of page to go to when PayPal checkout completed, e.g. salesfunnel-thanks.html page) |
cancelPage | string | relative url of page to go to when PayPal flow is canceled (salesfunnel page) |
logoUrl | string | relative url to a 150x50 product log image used in PayPal checkout |
dirname | string | path to the directory containing the products.json file |
production | boolean | in production mode if true; in sandbox mode if false |
payPalIpnValidate(ipnMessage, production) ⇒ Promise.<void>
Kind: global function
Returns: Promise.<void> -
Param | Type | Description |
---|---|---|
ipnMessage | string | the body of the PayPal IPN message |
production | boolean | in production mode if true; in sandbox mode if false |
payPalIpnToOrder(body) ⇒ *
Kind: global function
Returns: * - an order object with all IPN fields
Category: PayPal
Param | Type | Description |
---|---|---|
body | string | POST body as PayPal sends to IPN endpoint |
=== © 2021 Dellariva Solutions