Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : added a customization feel to the paystack component so that a… #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 70 additions & 41 deletions examples/commonjs/App.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
<template>
<div class="App">
<p class="App-intro">
<paystack
:amount="amount"
:email="email"
:firstname="firstname"
:lastname="lastname"
:accessCode="accessCode"
:splitCode="splitCode"
:split="split"
:paystackkey="paystackkey"
:reference="genReference"
:callback="callback"
:close="close"
:embed="false"
>
<i>Pay me, My Money</i>
</paystack>
</p>
</div>
<div class="App">
<p class="App-intro">
<paystack
:amount="amount"
:email="email"
:firstname="firstname"
:lastname="lastname"
:accessCode="accessCode"
:splitCode="splitCode"
:split="split"
:paystackkey="paystackkey"
:reference="genReference"
:callback="callback"
:close="close"
:embed="false"
>
<i>Pay me, My Money</i>
</paystack>
<paystack
:amount="amount"
:email="email"
:firstname="firstname"
:lastname="lastname"
:accessCode="accessCode"
:splitCode="splitCode"
:split="split"
:paystackkey="paystackkey"
:reference="genReference"
:callback="callback"
:close="close"
:embed="false"
:custombutton="true"
>
<button
style="
border-radius: 5px;
color: white;
padding: 15px;
background: crimson;
border: 1px solid;
cursor: pointer;
margin: 20px;
"
>
PAY WITH CUSTOM BUTTON
</button>
</paystack>
</p>
</div>
</template>

<script type="text/javascript">
Expand All @@ -29,34 +58,34 @@ export default {
},
data(){
return{
paystackkey: "pk_test_xxxxxxxxxxxxxxxxxxxxxxx",
firstname: "Foo",
lastname: "Bar",
email: "[email protected]",
amount: 200000,
splitCode: "",
split: {},
channels: ['card']
paystackkey: "pk_test_xxxxxxxxxxxxxxxxxxxxxxx",
firstname: "Foo",
lastname: "Bar",
email: "[email protected]",
amount: 200000,
splitCode: "",
split: {},
channels: ['card']
}
},
computed: {
genReference(){
let text = "";
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
genReference(){
let text = "";
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

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

return text;
}
return text;
}
},
methods: {
callback: function(response){
console.log(response)
},
close: function(){
console.log("Payment closed")
}
callback: function(response){
console.log(response)
},
close: function(){
console.log("Payment closed")
}
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion examples/commonjs/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import App from './App.vue'
new Vue({
render: h => h(App)
render: h => h(App)
}).$mount('#app')
22 changes: 18 additions & 4 deletions src/paystack.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<template>
<button
<div
v-if="!embed"
class="payButton"
class="payContainer"
@click="payWithPaystack"
>
<slot>Make Payment</slot>
</button>
<slot v-if="custombutton" />
<button
v-if="!custombutton"
class="payButton"
>
<slot
v-if="!custombutton"
>
Make Payment
</slot>
</button>
</div>
<div
v-else
id="paystackEmbedContainer"
Expand All @@ -15,6 +25,10 @@
<script type="text/javascript">
export default {
props: {
custombutton: {
type:Boolean,
default : false
},
embed: {
type: Boolean,
default: false
Expand Down