trailpack-proxy-generics

Generic features that require adapters built with love from Cali-Style
Looking for Proxy Engine?
Generics are common features that every web application needs but implements differently. The result of a Generic is a normalized way of handling these different services.
For example: Email Provider, Payment Processors, Tax Provider, Shipping Provider, Fulfillment, Geolocation, whatever you need!
Can you think of a generic we missed? Create a PR!
Install
$ npm install --save trailpack-proxy-generics
Configure
module.exports = {
packs: [
require('trailpack-proxy-generics')
]
}
module.exports = {
payment_processor: {
adapter: require('<adpater>'),
options: {
whatever_key: '<what ever you need here>'
}
}
}
Usage
Many different modules in Proxy Engine will rely on a generic to complete a task. Generics are easy to create and use.
Validation
Every Generic call is validated twice:
- When data is passed to the generic.
- When there is a successful response from the generic.
This allows for generics to stay consistent with their requests and responses.
Currently Supported Generics
Email Provider
The Email Provider handles sending emails from different email providers eg. Mandrill, MailGun
EmailGenericService.send
Sends an Email
EmailGenericService.sendTemplate
Sends an Email Template
Creating an Email Provider Generic
Supported Email Providers
Geolocation Provider
The Geolocation Provider handles resolving geography
GeolocationGenericService.locate
Resolves the geolocation of an address, validates an address, normalizes an address.
Creating a Geolocation Provider Generic
Supported Geolocation Providers
Payment Processor
The Payment Processor handles payments from different merchant processors/terminals eg. Stripe, Authorize.net.
PaymentGenericService.authorize
Authorizes a purchase
PaymentGenericService.capture
Captures an authorized purchase
PaymentGenericService.sale
Authorizes and captures a purchase
PaymentGenericService.void
Voids an authorized purchase
PaymentGenericService.refund
Partially Refunds/Refunds a purchase
Creating a Payment Processor Generic
Supported Payment Processors
Tax Provider
The Tax Provider handles sales tax for items sold from different tax providers eg. TaxBundle
TaxGenericService.getRate
Gets the tax rate for a purchase.
Creating a Tax Provider Generic
Supported Tax Providers
Shipping Provider (TODO)
The Shipping Provider handles shipping rates from a location to a destination from different shipping providers eg. Shipstation, USPS, FedEx, UPS
ShippingGenericService.getRate
Gets a single carrier rate.
ShippingGenericService.getRates
Gets all carrier rates
Creating a Shipping Provider Generic
Supported Shipping Providers
Fulfillment Provider (TODO)
The Fulfillment Provider handles fulfillment events from a location to a destination from different fulfillment providers eg. Shipstation
FulfillmentGenericService.createOrder
Creates an order in fulfillment
FulfillmentGenericService.createOrders
Creates multiple orders in fulfillment
FulfillmentGenericService.updateOrder
Updates an order in fulfillment
FulfillmentGenericService.updateOrders
Updates multiple orders in fulfillment
FulfillmentGenericService.destroyOrder
Destroys an order in fulfillment
FulfillmentGenericService.destroyOrders
Destroys multiple orders in fulfillment
FulfillmentGenericService.getOrder
Retrieves an order in fulfillment
FulfillmentGenericService.getOrders
Retrieves multiple orders in fulfillment
FulfillmentGenericService.holdOrder
Creates an order hold in fulfillment
FulfillmentGenericService.holdOrders
Creates multiple order holds in fulfillment
Creating a Fulfillment Provider Generic
Supported Fulfillment Providers
Data Store Provider
The Data Store provider handles uploads and downloads to a remote data store eg. AWS, Gcloud
DataStoreGenericService.upload
Uploads a buffer to a data store
DataStoreGenericService.uploadFile
Uploads a file to a data store
DataStoreGenericService.uploadFiles
Uploads files to a data store
Creating a Data Store Provider Plugin
Supported Data Store Providers