Skip to content

Commit cda50b7

Browse files
committed
prepping v0.0.1 release
1 parent 6c98bcb commit cda50b7

File tree

8 files changed

+143
-77
lines changed

8 files changed

+143
-77
lines changed

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: node_js
2+
3+
node_js:
4+
- node
5+
- 8.0.0
6+
- 9.0.0
7+
- 10.0.0
8+
9+
sudo: false
10+
11+
install:
12+
- npm install
13+
14+
after_script:
15+
- npm run coverage
16+
17+
notifications:
18+
email:
19+

config/ravepay.js

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
'use strict';
1+
'use strict'
22

3-
const Env = use('Env');
3+
const Env = use('Env')
44

55
module.exports = {
6-
/*
7-
|-----------------------------------------------------------------
8-
| Public Key
9-
|-----------------------------------------------------------------
10-
|
11-
|
12-
|
13-
|
14-
|
15-
|
16-
*/
17-
publicKey: Env.get('FLUTTERWAVE_RAVE_API_PUBLIC_KEY'),
18-
6+
/*
7+
|-----------------------------------------------------------------
8+
| Public Key
9+
|-----------------------------------------------------------------
10+
|
11+
|
12+
|
13+
|
14+
|
15+
|
16+
*/
17+
publicKey: Env.get('FLUTTERWAVE_RAVE_API_PUBLIC_KEY'),
18+
1919
/*
20-
|-----------------------------------------------------------------
21-
| Private Key
22-
|-----------------------------------------------------------------
23-
|
24-
|
25-
|
26-
|
27-
|
28-
|
29-
*/
30-
privateKey: Env.get('FLUTTERWAVE_RAVE_API_SECRET_KEY'),
31-
20+
|-----------------------------------------------------------------
21+
| Private Key
22+
|-----------------------------------------------------------------
23+
|
24+
|
25+
|
26+
|
27+
|
28+
|
29+
*/
30+
privateKey: Env.get('FLUTTERWAVE_RAVE_API_SECRET_KEY'),
31+
3232
/*
33-
|-----------------------------------------------------------------
34-
| Encryption Key
35-
|-----------------------------------------------------------------
36-
|
37-
|
38-
|
39-
|
40-
|
41-
|
42-
*/
43-
33+
|-----------------------------------------------------------------
34+
| Encryption Key
35+
|-----------------------------------------------------------------
36+
|
37+
|
38+
|
39+
|
40+
|
41+
|
42+
*/
43+
4444
encryptionKey: Env.get('FLUTTERWAVE_RAVE_API_ENCRYPT_KEY'),
45-
45+
4646
/*
47-
|-----------------------------------------------------------------
48-
| Merchant ID
49-
|-----------------------------------------------------------------
50-
|
51-
|
52-
|
53-
|
54-
|
55-
|
56-
*/
57-
47+
|-----------------------------------------------------------------
48+
| Merchant ID
49+
|-----------------------------------------------------------------
50+
|
51+
|
52+
|
53+
|
54+
|
55+
|
56+
*/
57+
5858
merchantId: Env.get('FLUTTERWAVE_RAVE_API_MERCHANT_ID')
5959

60-
};
60+
}

instructions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
const path = require('path')
1212

1313
module.exports = async function (cli) {
14-
try{
14+
try {
1515
await cli.makeConfig('ravepay.js', path.join(__dirname, 'config/ravepay.js'))
1616
cli.command.completed('create', 'config/ravepay.js')
17-
}catch(error){
17+
} catch (error) {
1818
// ignore if ravepay.js already exists
1919
}
2020
}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name":"adonisjs-flutterwave-rave",
3-
"version":"0.0.1",
4-
"description":"An addon/plugin package to provide Flutterwave (Rave) payment services in AdonisJS 4.0+",
2+
"name": "adonisjs-flutterwave-rave",
3+
"version": "0.0.1",
4+
"description": "An addon/plugin package to provide Flutterwave (Rave) payment services in AdonisJS 4.0+",
55
"main": "index.js",
66
"files": [
77
"src",
@@ -43,9 +43,9 @@
4343
]
4444
},
4545
"dependencies": {
46-
"@adonisjs/generic-exceptions": "^2.0.1",
47-
"ravepay":"^1.1.2",
48-
"debug": "^3.1.2"
46+
"@adonisjs/generic-exceptions": "^2.0.1",
47+
"ravepay": "^1.1.2",
48+
"debug": "^3.1.2"
4949
},
5050
"devDependencies": {
5151
"@adonisjs/fold": "^4.0.9",

providers/FlutterwaveRaveProvider.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
const { ServiceProvider } = require('@adonisjs/fold')
44

55
class FlutterwaveRaveProvider extends ServiceProvider {
6-
register () {
7-
this.app.singleton('Adonis/Addons/FlutterwaveRave', () => {
8-
const Config = this.app.use('Adonis/Src/Config')
9-
const Env = this.app.use('Env')
10-
const FlutterwaveRave = require('../src/FlutterwaveRave')
11-
return (new FlutterwaveRave(require('ravepay'), Config, Env)).agent
12-
})
13-
}
6+
register () {
7+
this.app.singleton('Adonis/Addons/FlutterwaveRave', () => {
8+
const Config = this.app.use('Adonis/Src/Config')
9+
const Env = this.app.use('Env')
10+
const FlutterwaveRave = require('../src/FlutterwaveRave')
11+
return (new FlutterwaveRave(require('ravepay'), Config, Env)).agent
12+
})
13+
}
1414
}
1515

1616
module.exports = FlutterwaveRaveProvider

src/FlutterwaveRave/index.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
'use strict';
1+
'use strict'
22

3-
//const Event = use('Event')
3+
// const Event = use('Event')
44

55
class FlutterwaveRaveAPIClient {
6-
constructor(Agent, Config, Env) {
7-
this.agent = new Agent(
8-
Config.get('ravepay.publicKey'),
9-
Config.get('ravepay.privateKey')
10-
(Env.get('NODE_ENV') !== 'development') // production flag
11-
);
12-
13-
}
6+
constructor (Agent, Config, Env) {
7+
this.agent = new Agent(Config.get('ravepay.publicKey'), Config.get('ravepay.privateKey'), (Env.get('NODE_ENV') !== 'development'))
8+
}
149
};
1510

1611
module.exports = FlutterwaveRaveAPIClient

test/flutterwave-rave.spec.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict'
2+
3+
/*
4+
* adonis-bugsnag
5+
*
6+
* (c) Harminder Virk <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
const test = require('japa')
13+
const { Config, Env } = require('@adonisjs/sink')
14+
const FlutterwaveRave = require('../src/FlutterwaveRave/index.js')
15+
16+
let FlutterwaveRaveStub = null
17+
18+
test.group('AdonisJS FlutterwaveRave Test(s)', (group) => {
19+
group.beforeEach(() => {
20+
FlutterwaveRaveStub = require('./setup/api-stub.js')
21+
22+
this.config = new Config()
23+
this.env = new Env()
24+
})
25+
26+
test('instantiate without errors or side-effects [yet]', (assert) => {
27+
this.config.set('ravepay.publicKey', 'FLWPUBK-e64d8e6748e94f8a309e09349ebc8e4e-C')
28+
this.config.set('ravepay.privateKey', 'FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X')
29+
this.env.set('NODE_ENV', 'development')
30+
31+
const FlutterwaveRaveInstance = new FlutterwaveRave(FlutterwaveRaveStub, this.config, this.env)
32+
33+
assert.isTrue(typeof FlutterwaveRaveInstance.Card.charge === 'function')
34+
assert.isTrue(typeof FlutterwaveRaveInstance.TokenCharge.card === 'function')
35+
})
36+
})

test/setup/api-stub.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
const RaveAPI = function (pubKey, priKey, prodFlag) {
3+
this.pubKey = pubKey
4+
this.priKey = priKey
5+
this.prodFlag = prodFlag
6+
}
7+
8+
RaveAPI.prototype.Card = {
9+
charge: function () {}
10+
}
11+
12+
RaveAPI.prototype.TokenCharge = {
13+
card: function () {}
14+
}
15+
16+
module.exports = RaveAPI

0 commit comments

Comments
 (0)