Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
iamraphson committed Nov 2, 2017
0 parents commit a894190
Show file tree
Hide file tree
Showing 17 changed files with 415 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
8 changes: 8 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "vue",
"rules": {
"space-before-function-paren": [2, "never"],
"indent": ["error",4],
"camelcase": [2, {"properties": "never"}]
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
npm-debug.log
.idea
package-lock.json
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Ayeni Olusegun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Paystack Component for Vue 2.x
24 changes: 24 additions & 0 deletions build/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
let path = require('path')
let webpack = require('webpack')

module.exports = {
entry: {
'paystack': './examples/commonjs/app.js'
},
output: {
path: path.resolve(__dirname, '../dist'),
publicPath: '/dist/',
filename: '[name].js'
},
module: {
rules: [{
test: /\.vue$/,
loader: 'vue-loader'
}, {
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}]
},
devtool: 'eval-source-map'
}
45 changes: 45 additions & 0 deletions build/webpack.dist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var path = require('path')
var webpack = require('webpack')

module.exports = {
entry: {
'paystack': './src/index.js'
},
output: {
path: path.resolve(__dirname, '../dist'),
publicPath: '/dist/',
filename: '[name].min.js',
library: 'VuePaystack',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
rules: [{
enforce: 'pre',
test: /\.(js|vue)$/,
exclude: /node_modules/,
loader: 'eslint-loader'
}, {
test: /\.vue$/,
loader: 'vue-loader'
}, {
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}]
},
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
include: /\.min\.js$/,
compress: {
warnings: false
}
})
],
devtool: 'source-map'
}
2 changes: 2 additions & 0 deletions dist/paystack.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/paystack.min.js.map

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions examples/commonjs/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<template>
<div class="App">
<p class="App-intro">
<paystack
:amount="amount"
:email="email"
:paystackkey="paystackkey"
:reference="reference"
:callback="callback"
:close="close"
></paystack>
</p>
</div>
</template>

<script type="text/javascript">
import paystack from '../../src';
import axios from 'axios';
export default {
components: {
paystack
},
data(){
return{
paystackBtnText: "Pay Me, My Money",
paystackkey: "pk_test_xxxxxxxxxxxxxxxxxxxxxxx",
email: "[email protected]",
amount: 1000000
}
},
computed: {
reference(){
let text = "";
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( let i=0; i < 10; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
},
methods: {
callback: function(response){
console.log(response)
},
close: function(){
console.log("Payment closed")
}
}
}
</script>
<style>
.App {
text-align: center;
}
.App-intro {
font-size: large;
}
.payButton{
color: #61DAFB;
width: 250px;
height: 50px;
font-weight: 800;
}
</style>
5 changes: 5 additions & 0 deletions examples/commonjs/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './App.vue'
new Vue({
render: h => h(App)
}).$mount('#app')
10 changes: 10 additions & 0 deletions examples/commonjs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>vue-paystack</title>
</head>
<body>
<div id="app"></div>
<script src="../../dist/paystack.js"></script>
</body>
</html>
70 changes: 70 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<html>

<head>
<title>Vue PayStack Example</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="../dist/paystack.min.js"></script>
<style>
body {
font-size: 1em;
font-family: 'Tahoma', sans-serif;
}

.payButton{
color: #61DAFB;
width: 250px;
height: 50px;
font-weight: 800;
}
</style>
</head>

<body>
<div id="app">
<paystack
:amount="amount"
:email="email"
:paystackkey="paystackkey"
:reference="reference"
:callback="callback"
:close="close"
></paystack>
</div>

<script type="text/javascript">
new Vue({
el: '#app',
components:{
'paystack': VuePaystack.default
},
computed: {
reference(){
let text = "";
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

for( let i=0; i < 10; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));

return text;
}
},
methods: {
callback: function(response){
console.log(response)
},
close: function(){
console.log("Payment closed")
}
},
data: {
paystackBtnText: "Pay Me, My Money",
paystackkey: "pk_test_xxxxxxxxxxxxxxxxxxxxxx",
email: "[email protected]",
amount: 1000000,
}
});
</script>
</body>

</html>
51 changes: 51 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "vue-paystack",
"version": "1.0.0",
"description": "Vue Paystack Component for Vue 2.x.",
"main": "dist/paystack.min.js",
"scripts": {
"lint": "eslint src --ext=js,vue || exit 0",
"lint:fix": "eslint src --ext=js,vue --fix || exit 0",
"dev": "webpack-dev-server --content-base ./examples/commonjs --env=webpack.dev --open --hot",
"dist": "webpack --env=webpack.dist"
},
"repository": {
"type": "git",
"url": "git+https://github.com/iamraphson/vue-paystack.git"
},
"files": [
"dist",
"src"
],
"keywords": [
"PayStack",
"Vue",
"Vuejs",
"Vue 2",
"Payment Gateway"
],
"author": "Ayeni Olusegun",
"license": "MIT",
"bugs": {
"url": "https://github.com/iamraphson/vue-paystack/issues"
},
"homepage": "",
"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.18.0",
"css-loader": "^0.28.1",
"eslint-config-vue": "^2.0.2",
"eslint-loader": "^1.7.1",
"eslint-plugin-vue": "^2.0.1",
"standard": "^10.0.3",
"vue": "^2.3.3",
"vue-loader": "^12.0.4",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.5.1",
"webpack-dev-server": "^2.4.5"
},
"dependencies": {
"axios": "^0.17.0"
}
}
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import paystack from './paystack.vue'

export default paystack
Loading

0 comments on commit a894190

Please sign in to comment.