Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Commit

Permalink
Rename number26 to n26
Browse files Browse the repository at this point in the history
  • Loading branch information
PierrickP committed Jul 21, 2016
1 parent 3635b9b commit 5e7950e
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
global:
# GH_TOKEN
- secure: "P0ksGaQg9x2OA2+Ue7M8DRMNBS1RrMK4pi5vV4HeGlTDNoZvWhMbmb5RwtykXBR12H8BTzrnsxA5BfMzzVh+F/88eoSL5WJV7n/Ea39xxiATA2edBjbpCFSsAHI8JQWTT0uo2dD5XeLWAx2ZTELRX2PVr6dn7yeJ2PlF39HXXqzi7QeZ+FlHX5dHckrx+9MX9/+qBKzLZegeQHUDgYs7SxFDJ+IshYVY6SMF+fvy7JIVIcQhAZzlyYADaraHmluGuFuNVmfRDOVaDSJX+WQoGfo7UrQawY4hDZRZzXcIBXJSczJJ+JPBXuDDUKznvVifsHR96dxQrOUdyRF3zjRSW3CxFm58loTecsekV1s0f88K0tYfjjreUh5qoPWI2bue5Mqk8AC7hkkWRvOQX9XRrlfzqz5wEWTYIzU44Nv4NzkuBjtgQUMnA7WuMiwjngjGLwHVJfw7TuliYca089xtX6ZocUUXwB834vh2sLIIn/dPLYovOEsWkgav8uzHpizSZwap/gpchbUnIrUeahFjyfr1g5xbzyqkodCe5UhSGjI7OcPbS4WH8/pE7z4Vuz2ZMYcKsdCfyeorzaZ24ERGXQEVA+gA9rWtUM9gyPqdkq2btq75Xxy2lP7HsyA6D637q9Qmn86jgNItVSaFjTaS9AobzaDC8bMDvDV7N6rHLuQ="
- GIT_DEPLOY_REPO=https://[email protected]/PierrickP/number26.git
- GIT_DEPLOY_REPO=https://[email protected]/PierrickP/n26.git

before_install:
- export TZ=Europe/Berlin
Expand Down
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# Number26 :credit_card:
# N26 :credit_card:

[![npm](https://img.shields.io/npm/v/number26.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/number26) [![Travis branch](https://img.shields.io/travis/PierrickP/number26/master.svg?maxAge=2592000)](https://travis-ci.org/PierrickP/number26) [![Coveralls](https://img.shields.io/coveralls/jekyll/jekyll.svg?maxAge=2592000)](https://coveralls.io/github/PierrickP/number26) [![bitHound](https://img.shields.io/bithound/dependencies/github/PierrickP/number26.svg?maxAge=2592000)](https://www.bithound.io/github/PierrickP/number26) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/PierrickP/number26/develop/LICENSE.md)
:warning: [number26 was renamed to *n26*](https://n26.com/number26-is-n26/)

Un-official node.js module for interact with your number26 account
[![npm](https://img.shields.io/npm/v/n26.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/n26) [![Travis branch](https://img.shields.io/travis/PierrickP/n26/master.svg?maxAge=2592000)](https://travis-ci.org/PierrickP/n26) [![Coveralls](https://img.shields.io/coveralls/jekyll/jekyll.svg?maxAge=2592000)](https://coveralls.io/github/PierrickP/n26) [![bitHound](https://img.shields.io/bithound/dependencies/github/PierrickP/n26.svg?maxAge=2592000)](https://www.bithound.io/github/PierrickP/n26) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/PierrickP/n26/develop/LICENSE.md)

Open a free [Number26 account here :gift:](https://my.number26.de/?uc=MZMEF)
Un-official node.js module for interact with your n26 (previously number26) account

[![NPM](https://nodei.co/npm/number26.png)](https://nodei.co/npm/number26/)
Open a free [N26 account here :gift:](https://my.number26.de/?uc=MZMEF)

[Api docs](http://pierrickpaul.fr/number26/)
[![NPM](https://nodei.co/npm/n26.png)](https://nodei.co/npm/n26/)

## What's Number26 ?
[Api docs](http://pierrickpaul.fr/n26/)

> NUMBER26 is Europe's first bank account developed entirely for smartphones. With your NUMBER26 bank account, MasterCard® and mobile app, you can conveniently transfer money from anywhere and keep track of your finances at all times. With MoneyBeam you're able to send money via sms or e-mail without the need to enter all the account details.
## What's N26 ?

> N26 is Europe's first bank account developed entirely for smartphones. With your N26 bank account, MasterCard® and mobile app, you can conveniently transfer money from anywhere and keep track of your finances at all times. With MoneyBeam you're able to send money via sms or e-mail without the need to enter all the account details.
>
> There are no costs or fees, which means you can withdraw money at any ATM worldwide, free of charge. No ATM around you? Just use CASH26 to withdraw and deposit cash at your supermarket.
[Open a free account here :gift:](https://my.number26.de/?uc=MZMEF)

## This module

Number26 has some un-official apis.
n26 has some un-official apis.
This module provide you clean functions to interact with your account.

Not all endpoints are available yet.
Expand All @@ -37,7 +39,7 @@ Not all endpoints are available yet.

### Dependencies

number26 depends on:
n26 depends on:

+ [bluebird](https://www.npmjs.com/package/bluebird): Bluebird is a full featured promise library with unmatched performance.
+ [moment](https://www.npmjs.com/package/moment): A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
Expand All @@ -47,14 +49,14 @@ number26 depends on:

#### How to install

`npm i number26 --save`
`npm i n26 --save`

#### Exemple

```JavaScript
const Number26 = require('number26');
const N26 = require('n26');

const myAccount = new Number26('[email protected]', 'password')
const myAccount = new N26('[email protected]', 'password')
.then((account) => account.transactions({text: 'Lafayette'})
.then((transactions) => {
/*
Expand Down Expand Up @@ -90,7 +92,7 @@ const myAccount = new Number26('[email protected]', 'password')

#### API

[Api docs](http://pierrickpaul.fr/number26/)
[Api docs](http://pierrickpaul.fr/n26/)

### Testing

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./lib/number26');
module.exports = require('./lib/n26');
2 changes: 1 addition & 1 deletion lib/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const utils = require('./utils');
*/

/**
* Number26 Account
* N26 Account
*/
class Account {
/**
Expand Down
4 changes: 2 additions & 2 deletions lib/number26.js → lib/n26.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const utils = require('./utils');
* @param {String} offline_partner_id
*/

class number26 {
class n26 {
/**
* Authentification and return a new Account instance
*
Expand Down Expand Up @@ -59,4 +59,4 @@ class number26 {
}
}

module.exports = number26;
module.exports = n26;
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "number26",
"version": "1.2.0",
"description": "Un-official node.js module for interact with your number26 account",
"name": "n26",
"version": "1.3.0",
"description": "Un-official node.js module for interact with your N26 (previously Number26) account",
"main": "index.js",
"scripts": {
"test": "istanbul cover _mocha tests/index.js && if [ \"$CONTINUOUS_INTEGRATION\" = \"true\" ]; then cat ./coverage/lcov.info | ./node_modules/.bin/coveralls; fi",
Expand All @@ -11,6 +11,7 @@
"deployDocs": "npm run docs && sh ./scripts/deployDocs.sh"
},
"keywords": [
"n26",
"number26",
"bank",
"es6",
Expand All @@ -23,10 +24,10 @@
},
"repository": {
"type": "git",
"url": "https://github.com/PierrickP/number26"
"url": "https://github.com/PierrickP/n26"
},
"bugs": {
"url": "https://github.com/PierrickP/number26/issues"
"url": "https://github.com/PierrickP/n26/issues"
},
"devDependencies": {
"chai": "^3.2.0",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const nock = require('nock');

const Number26 = require('../../index');
const N26 = require('../../index');

const data = require('./data');

Expand All @@ -15,5 +15,5 @@ module.exports = (cb) => {
})
.reply(200, data.account);

return new Number26('[email protected]', 'password').asCallback(cb);
return new N26('[email protected]', 'password').asCallback(cb);
};
14 changes: 7 additions & 7 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const chai = require('chai');
const dirtyChai = require('dirty-chai');
const expect = chai.expect;

const Number26 = require('../index');
const N26 = require('../index');

chai.use(dirtyChai);

Expand All @@ -27,14 +27,14 @@ describe('Create instance', () => {
});

it('should pass identifiants to oauth endpoint', () => {
return new Number26('[email protected]', 'password')
return new N26('[email protected]', 'password')
.catch((err) => {
expect(err).to.be.null();
});
});

it('should create a new instance', () => {
return new Number26('[email protected]', 'password')
return new N26('[email protected]', 'password')
.then((m) => {
expect(m.logged).to.be.true();
expect(m.email).to.be.eql('[email protected]');
Expand Down Expand Up @@ -63,8 +63,8 @@ describe('Create instance', () => {
.reply(200, data.account);

return Promise.all([
new Number26('[email protected]', 'password'),
new Number26('[email protected]', 'password')
new N26('[email protected]', 'password'),
new N26('[email protected]', 'password')
])
.then((instance1, instance2) => {
expect(instance1).to.not.be.equal(instance2);
Expand All @@ -88,7 +88,7 @@ describe('Create instance', () => {
})
.reply(400, {error: 'invalid_grant', error_description: 'Bad credentials'});

return new Number26('[email protected]', 'password')
return new N26('[email protected]', 'password')
.catch((err) => {
expect(err).to.be.eql({error: 'invalid_grant', error_description: 'Bad credentials'});
});
Expand All @@ -105,7 +105,7 @@ describe('Create instance', () => {
})
.reply(500, '');

return new Number26('[email protected]', 'password')
return new N26('[email protected]', 'password')
.catch((err) => {
expect(err).to.be.equal(500);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/static/barzahlen.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const chai = require('chai');
const dirtyChai = require('dirty-chai');
const expect = chai.expect;

const number26 = require('../../index');
const n26 = require('../../index');

chai.use(dirtyChai);

Expand Down Expand Up @@ -42,7 +42,7 @@ describe('barzahlen', () => {
offline_partner_id: '34154'
}]);

return number26.barzahlen({
return n26.barzahlen({
nelat: 52.52207036136366,
nelon: 13.391647338867186,
swlat: 52.51120638909939,
Expand Down
20 changes: 10 additions & 10 deletions tests/unmock.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ const questions = [{
type: 'input',
name: 'email',
message: 'Account email:',
default: process.env.NUMBER26_EMAIL || config.get('email')
default: process.env.N26_EMAIL || config.get('email')
}, {
type: 'password',
name: 'password',
message: 'Password account:',
default: process.env.NUMBER26_PASSWORD
default: process.env.N26_PASSWORD
}, {
type: 'checkbox',
message: 'Select options',
Expand All @@ -35,19 +35,19 @@ const questions = [{
checked: config.get('options.statement') ? config.get('options.statement') : true
}, {
name: 'Invitation',
default: process.env.NUMBER26_OPTIONS_INVITE || config.get('options.invite')
default: process.env.N26_OPTIONS_INVITE || config.get('options.invite')
}, {
name: 'Transfer',
default: process.env.NUMBER26_OPTIONS_TRANSFER || config.get('options.transfer')
default: process.env.N26_OPTIONS_TRANSFER || config.get('options.transfer')
}, {
name: 'Unpair',
default: process.env.NUMBER26_OPTIONS_UNPAIR || config.get('options.unpair')
default: process.env.N26_OPTIONS_UNPAIR || config.get('options.unpair')
}]
}, {
type: 'password',
name: 'pin',
message: 'Pin number:',
default: process.env.NUMBER26_PIN,
default: process.env.N26_PIN,
validate: (pin) => pin.length === 4,
when: hasOptions(['Transfer', 'Unpair'])
}, {
Expand All @@ -59,27 +59,27 @@ const questions = [{
type: 'input',
name: 'transferIBAN',
message: 'IBAN transfer:',
default: process.env.NUMBER26_OPTIONS_TRANSFER_IBAN || config.get('transfer.iban'),
default: process.env.N26_OPTIONS_TRANSFER_IBAN || config.get('transfer.iban'),
validate: (iban) => /[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}/.test(iban),
when: hasOptions('Transfer')
}, {
type: 'input',
name: 'transferBIC',
message: 'BIC transfer:',
default: process.env.NUMBER26_OPTIONS_TRANSFER_BIC || config.get('transfer.bic'),
default: process.env.N26_OPTIONS_TRANSFER_BIC || config.get('transfer.bic'),
validate: (bic) => /([a-zA-Z]{4}[a-zA-Z]{2}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?)/.test(bic),
when: hasOptions('Transfer')
}, {
type: 'input',
name: 'transferNAME',
message: 'NAME transfer:',
default: process.env.NUMBER26_OPTIONS_TRANSFER_NAME || config.get('transfer.name'),
default: process.env.N26_OPTIONS_TRANSFER_NAME || config.get('transfer.name'),
when: hasOptions('Transfer')
}, {
type: 'input',
name: 'cardNumber',
message: '10 digits on card:',
default: process.env.NUMBER26_OPTIONS_UNPAIR_CARDNUMBER || config.get('unpair.cardNumber'),
default: process.env.N26_OPTIONS_UNPAIR_CARDNUMBER || config.get('unpair.cardNumber'),
validate: (cardNumber) => cardNumber.length === 10,
when: hasOptions('Unpair')
}];
Expand Down
4 changes: 2 additions & 2 deletions tests/unmock/barzahlen.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const chai = require('chai');
const dirtyChai = require('dirty-chai');
const expect = chai.expect;

const Number26 = require('../../index');
const N26 = require('../../index');

chai.use(dirtyChai);

Expand Down Expand Up @@ -50,7 +50,7 @@ describe('Barzahlen', () => {
});

it('should get barzahlen', () => {
return Number26.barzahlen({
return N26.barzahlen({
nelat: 52.6078,
nelon: 13.5338,
swlat: 52.4165,
Expand Down
4 changes: 2 additions & 2 deletions tests/unmock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const chai = require('chai');
const dirtyChai = require('dirty-chai');
const expect = chai.expect;

const Number26 = require('../../index');
const N26 = require('../../index');

chai.use(dirtyChai);

Expand Down Expand Up @@ -128,7 +128,7 @@ describe('Create instance', function () { // eslint-disable-line func-names
this.timeout(60000);

it('should create instance', () => {
return new Number26(global.CONFIG.email, global.CONFIG.password)
return new N26(global.CONFIG.email, global.CONFIG.password)
.then((m) => {
expect(m).to.be.exist();
global.n26 = m;
Expand Down
28 changes: 1 addition & 27 deletions tests/unmock/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,6 @@ const transactionFields = {
AA: commonTransactionFields.concat(['currencyCode', 'originalAmount', 'originalCurrency', 'exchangeRate', 'merchantCity', 'mcc', 'mccGroup', 'merchantName', 'merchantId', 'transactionTerminal'])
};

const transactionProperties = [
'id',
'userId',
'type',
'amount',
'smartLinkId',
'currencyCode',
'originalAmount',
'originalCurrency',
'exchangeRate',
'merchantCity',
'visibleTS',
'mcc',
'mccGroup',
'merchantName',
'merchantId',
'recurring',
'linkId',
'accountId',
'category',
'cardId',
'pending',
'transactionNature',
'tags'
];

describe('Transactions', () => {
it('should get transactions - limit 2', () => {
return global.n26.transactions({limit: 2})
Expand Down Expand Up @@ -71,7 +45,7 @@ describe('Transactions', () => {
return global.n26.transactions()
.then((transactions) => {
return global.n26.transaction(transactions[0].id).then(detail => {
transactionProperties.forEach(property => {
transactionFields[detail.type].forEach(property => {
expect(detail).to.have.deep.property(property);
});
});
Expand Down

0 comments on commit 5e7950e

Please sign in to comment.