Skip to content

Commit

Permalink
chore: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon committed Nov 5, 2021
1 parent ccc1c86 commit c6338c2
Show file tree
Hide file tree
Showing 20 changed files with 4,654 additions and 10,820 deletions.
4 changes: 2 additions & 2 deletions .babelrc
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"]
}
21 changes: 0 additions & 21 deletions .circleci/config.yml

This file was deleted.

32 changes: 16 additions & 16 deletions .eslintrc
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"
}
}
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
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 }}
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
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
3 changes: 2 additions & 1 deletion .gitignore
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
93 changes: 47 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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",
Expand All @@ -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

Expand Down Expand Up @@ -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
77 changes: 0 additions & 77 deletions dist/Customers.js

This file was deleted.

Loading

0 comments on commit c6338c2

Please sign in to comment.