-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Julien Bouquillon
committed
Nov 5, 2021
1 parent
ccc1c86
commit c6338c2
Showing
20 changed files
with
4,654 additions
and
10,820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"presets": ["@babel/env"], | ||
"plugins": ["@babel/plugin-proposal-object-rest-spread"] | ||
"presets": ["@babel/env"], | ||
"plugins": ["@babel/plugin-proposal-object-rest-spread"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": false | ||
} | ||
}, | ||
"extends": ["eslint:recommended"], | ||
"env": { | ||
"es6": true, | ||
"browser": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"indent": ["error", 4, { "SwitchCase": 1 }] | ||
"parser": "@babel/eslint-parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": false | ||
} | ||
}, | ||
"extends": ["eslint:recommended"], | ||
"env": { | ||
"es6": true, | ||
"browser": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"no-unused-vars": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [master, alpha, beta, next] | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v2 | ||
with: | ||
semantic_version: 17 | ||
extra_plugins: | | ||
@semantic-release/[email protected] | ||
@semantic-release/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: ["*"] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: lts/* | ||
|
||
- name: Install | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
- name: Unit tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
*.DS_Store | ||
creds.js | ||
test.js | ||
test.js | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,40 +14,42 @@ For example i use a Stripe webhook to automate actions in Sellsy. | |
|
||
## Features | ||
|
||
- Works with your oauth private app id | ||
- Simple promise call for all methods in http://api.sellsy.fr/documentation/methodes | ||
- Works with your oauth private app id | ||
- Simple promise call for all methods in http://api.sellsy.fr/documentation/methodes | ||
|
||
## QuickStart | ||
|
||
`npm i --save node-sellsy` | ||
|
||
```js | ||
|
||
var Sellsy = require('node-sellsy'); | ||
var Sellsy = require("node-sellsy"); | ||
|
||
var sellsy = new Sellsy({ | ||
creds: { | ||
consumerKey: 'myConsumerKey', | ||
consumerSecret: 'myConsumerSecret', | ||
userToken: 'myUserToken', | ||
userSecret: 'myUserSecret' | ||
} | ||
consumerKey: "myConsumerKey", | ||
consumerSecret: "myConsumerSecret", | ||
userToken: "myUserToken", | ||
userSecret: "myUserSecret", | ||
}, | ||
}); | ||
|
||
var params = { | ||
search: { | ||
contains: 'test', | ||
} | ||
contains: "test", | ||
}, | ||
}; | ||
|
||
sellsy.api({ | ||
method: 'Client.getList', | ||
params: params | ||
}).then(data => { | ||
console.log('data', data); | ||
}).catch(e => { | ||
console.log('error:', e); | ||
}); | ||
sellsy | ||
.api({ | ||
method: "Client.getList", | ||
params: params, | ||
}) | ||
.then((data) => { | ||
console.log("data", data); | ||
}) | ||
.catch((e) => { | ||
console.log("error:", e); | ||
}); | ||
``` | ||
|
||
## API | ||
|
@@ -65,32 +67,31 @@ Then, define the endPoint when creating your `Sellsy` instance : | |
```js | ||
var sellsy = new Sellsy({ | ||
creds, | ||
endPoint: 'http://path/to/sellsy/proxy' | ||
endPoint: "http://path/to/sellsy/proxy", | ||
}); | ||
``` | ||
|
||
|
||
### Higher-level API methods : | ||
|
||
#### Customer | ||
|
||
- `sellsy.customers.create(data)` | ||
- `sellsy.customers.get({ email: '[email protected]' })` | ||
- `sellsy.customers.create(data)` | ||
- `sellsy.customers.get({ email: '[email protected]' })` | ||
|
||
#### Document | ||
|
||
- `sellsy.documents.create(data)` | ||
- `sellsy.documents.createPayment(docType, docId, paymentData)` | ||
- `sellsy.documents.getList(docType, search)` | ||
- `sellsy.documents.getById(docType, docId)` | ||
- `sellsy.documents.updateStep(docType, docId, step)` | ||
- `sellsy.documents.create(data)` | ||
- `sellsy.documents.createPayment(docType, docId, paymentData)` | ||
- `sellsy.documents.getList(docType, search)` | ||
- `sellsy.documents.getById(docType, docId)` | ||
- `sellsy.documents.updateStep(docType, docId, step)` | ||
|
||
## Scripts | ||
|
||
- **npm run readme** : `node ./node_modules/node-readme/bin/node-readme.js` | ||
- **npm run test** : `find ./spec -iname '*.spec.js' -exec ./node_modules/.bin/babel-node {} \; | ./node_modules/.bin/tap-spec` | ||
- **npm run zuul** : `./node_modules/zuul/bin/zuul -- spec/**/*.spec.js` | ||
- **npm run build** : `babel -d ./dist ./src` | ||
- **npm run readme** : `node ./node_modules/node-readme/bin/node-readme.js` | ||
- **npm run test** : `find ./spec -iname '*.spec.js' -exec ./node_modules/.bin/babel-node {} \; | ./node_modules/.bin/tap-spec` | ||
- **npm run zuul** : `./node_modules/zuul/bin/zuul -- spec/**/*.spec.js` | ||
- **npm run build** : `babel -d ./dist ./src` | ||
|
||
## Examples | ||
|
||
|
@@ -99,17 +100,17 @@ var sellsy = new Sellsy({ | |
```js | ||
let sellsy = new Sellsy({ | ||
creds: { | ||
consumerKey: 'myConsumerKey', | ||
consumerSecret: 'myConsumerSecret', | ||
userToken: 'myUserToken', | ||
userSecret: 'myUserSecret' | ||
} | ||
consumerKey: "myConsumerKey", | ||
consumerSecret: "myConsumerSecret", | ||
userToken: "myUserToken", | ||
userSecret: "myUserSecret", | ||
}, | ||
}); | ||
|
||
const customerIdent = "1234"; | ||
const amountHorsTaxes = 42; | ||
|
||
sellsy.customers.get({ ident: customerIdent }).then(customer => { | ||
sellsy.customers.get({ ident: customerIdent }).then((customer) => { | ||
const documentData = { | ||
document: { | ||
doctype: "invoice", | ||
|
@@ -118,26 +119,27 @@ sellsy.customers.get({ ident: customerIdent }).then(customer => { | |
currency: "1", | ||
displayedDate: new Date().getTime() / 1000, | ||
subject: "Sujet de la facture", | ||
tags: "bookeo,stripe" | ||
tags: "bookeo,stripe", | ||
}, | ||
row: { | ||
"1": { | ||
1: { | ||
// use 'item' for object from catalog | ||
row_type: "once", | ||
row_name: "titre ligne facture", | ||
row_linkedid: null, | ||
row_notes: "notes ligne facture", | ||
row_tax: 20, | ||
row_unitAmount: amountHorsTaxes, | ||
row_qt: 1 | ||
} | ||
} | ||
row_qt: 1, | ||
}, | ||
}, | ||
}; | ||
|
||
return sellsy.documents.create(documentData); | ||
}); | ||
``` | ||
Then you can use | ||
|
||
Then you can use | ||
|
||
`sellsy.documents.updateStep(createdDocument.type, createdDocument.id, 'paid')` to mark invoice as paid and `sellsy.documents.createPayment` to record the payment method | ||
|
||
|
@@ -188,11 +190,10 @@ Then you can use | |
duration: 1.8s | ||
``` | ||
|
||
|
||
## Author | ||
|
||
Julien Bouquillon <[email protected]> http://github.com/revolunet and [contributors](https://github.com/revolunet/node-sellsy/graphs/contributors) | ||
|
||
## License | ||
|
||
- **MIT** : http://opensource.org/licenses/MIT | ||
- **MIT** : http://opensource.org/licenses/MIT |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.