checkbook-api
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -14,6 +14,14 @@ 'use strict'; | ||
function Checkbook(config) { | ||
if (!config.env || !_.includes(['test', 'sandbox'], config.env)) { | ||
if (!config.env || !_.includes(['demo', 'sandbox'], config.env)) { | ||
config.env = 'www'; | ||
} | ||
if (config.bearer) { | ||
config.auth = 'Bearer ' + config.bearer; | ||
} else if (config.api_key && config.api_secret){ | ||
config.auth = config.api_key + ':' + config.api_secret; | ||
} else { | ||
throw 'Invalid Authorization'; | ||
} | ||
this.resource = new Resource(config); | ||
@@ -20,0 +28,0 @@ |
@@ -12,5 +12,5 @@ 'use strict'; | ||
'Accept': 'application/json', | ||
'Authorization': config.api_key + ':' + config.api_secret | ||
'Authorization': config.auth | ||
} | ||
} | ||
}; | ||
} | ||
@@ -17,0 +17,0 @@ |
{ | ||
"name": "checkbook-api", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Node.js library for the Checkbook.io API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -15,3 +15,3 @@ # Node.js library for the Checkbook.io API | ||
:key: The API credentials below are from the ```test``` environment and you can use them to try the API. | ||
:key: The API credentials below are from the ```demo``` environment and you can use them to try the API. | ||
@@ -23,3 +23,3 @@ ``` js | ||
api_secret: 'dXbCgzYBMibj8ZwuQMd2NXr6rtvjZ8', | ||
env: 'test' | ||
env: 'demo' | ||
}); | ||
@@ -29,3 +29,3 @@ ``` | ||
The ```env``` parameter is optional and can be omitted if the requests are made to the live environment. | ||
The possible values for this parameter are ```test``` or ```sandbox``` and the API credentials need to be from the specified environment. | ||
The possible values for this parameter are ```demo``` or ```sandbox``` and the API credentials need to be from the specified environment. | ||
@@ -36,2 +36,17 @@ You can get the API Key and API Secret values from the [Settings](https://checkbook.io/account/settings) page. | ||
## OAuth | ||
If you wish to send requests on behalf of another user, this user will use OAuth in order to generate a key that may be used on their behalf. You can get more details on our [OAuth documentation page](https://checkbook.io/docs/api/products/#oauth). | ||
Once you obtain the bearer token for a user, you can use it to send API requests on its behalf: | ||
``` js | ||
var CheckbookAPI = require('checkbook-api'); | ||
var Checkbook = new CheckbookAPI({ | ||
bearer: '3658db04db340ce57b35fde7a56f669be222d96e33219bf28409812d1ca364b5', | ||
env: 'demo' | ||
}); | ||
``` | ||
## Usage | ||
@@ -81,35 +96,35 @@ | ||
* __Checkbook.checks__ | ||
* ```list(query, callback)``` [:book:](https://checkbook.io/docs/api#get--v3-check) | ||
* ```get(check_id, callback)``` [:book:](https://checkbook.io/docs/api#get--v3-check-(check_id)) | ||
* ```delete(check_id, callback)``` [:book:](https://checkbook.io/docs/api#delete--v3-check-(check_id)) | ||
* ```sendDigitalCheck(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api#post--v3-check-digital) | ||
* ```sendPhysicalCheck(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api#post--v3-check-physical) | ||
* ```list(query, callback)``` [:book:](https://checkbook.io/docs/api/reference/#get--v3-check) | ||
* ```get(check_id, callback)``` [:book:](https://checkbook.io/docs/api/reference/#get--v3-check-(check_id)) | ||
* ```delete(check_id, callback)``` [:book:](https://checkbook.io/docs/api/reference/#delete--v3-check-(check_id)) | ||
* ```sendDigitalCheck(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-check-digital) | ||
* ```sendPhysicalCheck(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-check-physical) | ||
* ```sendMultipleChecksCSV(params, callback[, idempotencyKey])``` | ||
* __Checkbook.invoices__ | ||
* ```list(query, callback)``` [:book:](https://checkbook.io/docs/api#get--v3-invoice) | ||
* ```get(invoice_id, callback)``` [:book:](https://checkbook.io/docs/api#get--v3-invoice-(invoice_id)) | ||
* ```delete(invoice_id, callback)``` [:book:](https://checkbook.io/docs/api#delete--v3-invoice-(invoice_id)) | ||
* ```sendInvoice(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api#post--v3-invoice) | ||
* ```list(query, callback)``` [:book:](https://checkbook.io/docs/api/reference/#get--v3-invoice) | ||
* ```get(invoice_id, callback)``` [:book:](https://checkbook.io/docs/api/reference/#get--v3-invoice-(invoice_id)) | ||
* ```delete(invoice_id, callback)``` [:book:](https://checkbook.io/docs/api/reference/#delete--v3-invoice-(invoice_id)) | ||
* ```sendInvoice(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-invoice) | ||
* ```payInvoice(params, callback[, idempotencyKey])``` | ||
* __Checkbook.subscriptions__ | ||
* ```list(query, callback)``` [:book:](https://checkbook.io/docs/api#get--v3-subscription) | ||
* ```get(subscription_id, callback)``` [:book:](https://checkbook.io/docs/api#get--v3-subscription-(subscription_id)) | ||
* ```delete(subscription_id, callback)``` [:book:](https://checkbook.io/docs/api#delete--v3-subscription-(subscription_id)) | ||
* ```update(subscription_id, params, callback)``` [:book:](https://checkbook.io/docs/api#put--v3-subscription-(subscription_id)) | ||
* ```sendRecurringCheck(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api#post--v3-subscription-check) | ||
* ```sendRecurringInvoice(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api#post--v3-subscription-invoice) | ||
* ```list(query, callback)``` [:book:](https://checkbook.io/docs/api/reference/#get--v3-subscription) | ||
* ```get(subscription_id, callback)``` [:book:](https://checkbook.io/docs/api/reference/#get--v3-subscription-(subscription_id)) | ||
* ```delete(subscription_id, callback)``` [:book:](https://checkbook.io/docs/api/reference/#delete--v3-subscription-(subscription_id)) | ||
* ```update(subscription_id, params, callback)``` [:book:](https://checkbook.io/docs/api/reference/#put--v3-subscription-(subscription_id)) | ||
* ```sendRecurringCheck(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-subscription-check) | ||
* ```sendRecurringInvoice(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-subscription-invoice) | ||
* __Checkbook.banks__ | ||
* ```list(callback)``` [:book:](https://checkbook.io/docs/api#get--v3-bank) | ||
* ```institutions(callback)``` [:book:](https://checkbook.io/docs/api#get--v3-bank-institutions) | ||
* ```delete(bank_id, callback)``` [:book:](https://checkbook.io/docs/api#delete--v3-bank-(bank_id)) | ||
* ```instantAccountVerification(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api#post--v3-bank-iav) | ||
* ```addBankAccount(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api#post--v3-bank) | ||
* ```verifyMicrodesposits(params, callback)``` [:book:](https://checkbook.io/docs/api#post--v3-bank-verify) | ||
* ```list(callback)``` [:book:](https://checkbook.io/docs/api/reference/#get--v3-bank) | ||
* ```institutions(callback)``` [:book:](https://checkbook.io/docs/api/reference/#get--v3-bank-institutions) | ||
* ```delete(bank_id, callback)``` [:book:](https://checkbook.io/docs/api/reference/#delete--v3-bank-(bank_id)) | ||
* ```instantAccountVerification(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-bank-iav) | ||
* ```addBankAccount(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-bank) | ||
* ```verifyMicrodesposits(params, callback)``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-bank-verify) | ||
* __Checkbook.users__ | ||
* ```create(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api#post--v3-user) | ||
* ```update(params, callback)``` [:book:](https://checkbook.io/docs/api#put--v3-user) | ||
* ```create(params, callback[, idempotencyKey])``` [:book:](https://checkbook.io/docs/api/reference/#post--v3-user) | ||
* ```update(params, callback)``` [:book:](https://checkbook.io/docs/api/reference/#put--v3-user) | ||
@@ -137,6 +152,6 @@ --- | ||
* [API Endpoints](https://checkbook.io/docs/api#document-api_endpoints) | ||
* [Error Codes](https://checkbook.io/docs/api#document-error_codes) | ||
* [Idempotency](https://checkbook.io/docs/api#document-idempotent_requests) | ||
* [API Endpoints](https://checkbook.io/docs/api/reference/) | ||
* [Error Codes](https://checkbook.io/docs/api/products/#error-codes) | ||
* [Idempotency](https://checkbook.io/docs/api/products/#idempotent-requests) | ||
@@ -5,3 +5,3 @@ var CheckbookAPI = require("../lib/checkbook"); | ||
api_secret: 'dXbCgzYBMibj8ZwuQMd2NXr6rtvjZ8', | ||
env: 'test' | ||
env: 'demo' | ||
}); | ||
@@ -8,0 +8,0 @@ |
@@ -5,3 +5,3 @@ var CheckbookAPI = require("../lib/checkbook"); | ||
api_secret: 'dXbCgzYBMibj8ZwuQMd2NXr6rtvjZ8', | ||
env: 'test' | ||
env: 'demo' | ||
}); | ||
@@ -8,0 +8,0 @@ |
@@ -5,3 +5,3 @@ var CheckbookAPI = require("../lib/checkbook"); | ||
api_secret: 'dXbCgzYBMibj8ZwuQMd2NXr6rtvjZ8', | ||
env: 'test' | ||
env: 'demo' | ||
}); | ||
@@ -8,0 +8,0 @@ |
@@ -5,3 +5,3 @@ var CheckbookAPI = require("../lib/checkbook"); | ||
api_secret: 'dXbCgzYBMibj8ZwuQMd2NXr6rtvjZ8', | ||
env: 'test' | ||
env: 'demo' | ||
}); | ||
@@ -8,0 +8,0 @@ |
@@ -5,3 +5,3 @@ var CheckbookAPI = require("../lib/checkbook"); | ||
api_secret: 'dXbCgzYBMibj8ZwuQMd2NXr6rtvjZ8', | ||
env: 'test' | ||
env: 'demo' | ||
}); | ||
@@ -8,0 +8,0 @@ |
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
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
147371
690
151
0