hapi-paypal
Advanced tools
Comparing version 0.0.83 to 0.0.84
@@ -16,4 +16,7 @@ "use strict"; | ||
}); | ||
const routes = process.env.PAYPAL_REST_ROUTES ? | ||
process.env.PAYPAL_REST_ROUTES.split(",") : | ||
Array.from(exports.hapiPayPal.routes.keys()); | ||
exports.hapiPayPalOptions = { | ||
routes: Array.from(exports.hapiPayPal.routes.keys()), | ||
routes, | ||
sdk: { | ||
@@ -37,3 +40,3 @@ client_id: process.env.PAYPAL_CLIENT_ID, | ||
register: exports.hapiPayPal.register, | ||
select: ["public"], | ||
select: [process.env.PAYPAL_HAPI_CONNECTION || "public"], | ||
}; | ||
@@ -40,0 +43,0 @@ exports.hapiPayPalGlueRegistration = { |
{ | ||
"name": "hapi-paypal", | ||
"version": "0.0.83", | ||
"version": "0.0.84", | ||
"description": "A hapi plugin to interface with PayPal Rest API's and webhooks.", | ||
@@ -33,5 +33,7 @@ "license": "MIT", | ||
"reinstall": "rimraf node_modules yarn.lock && yarn install", | ||
"start": "ts-node -r dotenv/config example/server.ts" | ||
"start:dev": "cross-env NODE_ENV=development ts-node -r dot-env-json/lib/config example/server.ts" | ||
}, | ||
"dependencies": { | ||
"cross-env": "^5.0.5", | ||
"dot-env-json": "^0.0.2", | ||
"joi": "^11.1.1", | ||
@@ -43,3 +45,2 @@ "paypal-rest-api": "^0.0.51", | ||
"@types/blue-tape": "^0.1.31", | ||
"@types/dotenv": "^4.0.0", | ||
"@types/hapi": "^16.1.7", | ||
@@ -46,0 +47,0 @@ "@types/joi": "^10.4.0", |
@@ -6,60 +6,10 @@ [![Build Status](https://travis-ci.org/trainerbill/hapi-paypal.svg?branch=master)](https://travis-ci.org/trainerbill/hapi-paypal) | ||
[![devDependency Status](https://david-dm.org/trainerbill/hapi-paypal/dev-status.svg)](https://david-dm.org/trainerbill/hapi-paypal#info=devDependencies) | ||
# hapi-paypal | ||
Hapi Plugin for PayPal REST API's | ||
## hapi-paypal | ||
Hapi Plugin for PayPal REST API's. This plugin provides two sets of functionality to easily integrate with paypal | ||
# Usage | ||
* Restful Routing | ||
* Webhook Handling | ||
``` | ||
const hapiPayPalOptions = { | ||
routes: [ | ||
// Enable any routes supported by the plugin: https://github.com/trainerbill/hapi-paypal/blob/master/src/index.ts#L78 | ||
// Handler gets called after the paypal api call. | ||
// Response from paypal is returned to your handler in the 3rd argument | ||
{ | ||
config: { | ||
id: "paypal_payment_create", | ||
}, | ||
handler: (request: any, reply: any, response: any) => { | ||
server.log(response); | ||
reply(response); | ||
}, | ||
}, | ||
// IF you enable webhooks you need a listener route. Handler gets called after receiving every webhook. We recommend saving to a database. | ||
{ | ||
config: { | ||
id: "paypal_webhooks_listen", | ||
}, | ||
handler: (request: any, reply: any, response: any) => { | ||
reply("GOT IT!"); | ||
}, | ||
}, | ||
], | ||
sdk: { | ||
// PayPal SDK Configuration: https://github.com/paypal/PayPal-node-SDK/blob/master/lib/configure.js | ||
client_id: process.env.PAYPAL_CLIENT_ID, | ||
client_secret: process.env.PAYPAL_CLIENT_SECRET, | ||
mode: "sandbox", | ||
}, | ||
// Enables webhooks | ||
webhooks: { | ||
event_types: [ | ||
{ | ||
// Any Webhook names you want enabled: https://developer.paypal.com/docs/integration/direct/webhooks/event-names/ | ||
name: "INVOICING.INVOICE.PAID", | ||
}, | ||
{ | ||
name: "INVOICING.INVOICE.CANCELLED", | ||
}, | ||
], | ||
// Host name for webhooks. Must be SSL. | ||
url: "https://www.yourwebhookdomain.com', | ||
}, | ||
}; | ||
## Restful Routing | ||
Restful Routing creates hapi routes that execute the corresponding paypal rest api call. | ||
const hapiPaypal = { | ||
options: hapiPayPalOptions, | ||
register: new HapiPayPal(), | ||
}; | ||
server.register(hapiPaypal); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20
539
0
38919
5
15
8
+ Addedcross-env@^5.0.5
+ Addeddot-env-json@^0.0.2
+ Added@types/node@22.9.3(transitive)
+ Addedapp-root-path@2.2.1(transitive)
+ Addedcross-env@5.2.1(transitive)
+ Addedcross-spawn@6.0.6(transitive)
+ Addeddot-env-json@0.0.2(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addednice-try@1.0.5(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addedwhich@1.3.1(transitive)
- Removed@types/node@22.10.0(transitive)
- Removedundici-types@6.20.0(transitive)