Skip to content
Merged
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
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
<meta charset="utf-8">
<title>Incentify</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<script src="https://checkout.stripe.com/checkout.js"></script>
</head>
<body>
<!-- built files will be auto injected -->
<app></app>
</body>
<form action="http://localhost:3000/stripe/charge" method="POST">
<!-- <form action="http://localhost:3000/stripe/charge" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_IF0JbVVp7Swqk9quPb0tJMyG"
Expand All @@ -18,6 +19,6 @@
data-description="Pay for your {{data.name}} commitment"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-locale="auto">
</script>
</script> -->
</form>
</html>
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div id="app" v-bind:class="{ 'no-margin': $route.path === '/' }">
<!-- route outlet -->
<top-branding class="header" v-show="$route.path !== '/'" ></top-branding>
<router-view></router-view>
<router-view keep-alive></router-view>
<navbar class="navbar" v-show="$route.path !== '/'"></navbar>
</div>
</template>
Expand Down
2 changes: 0 additions & 2 deletions src/components/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@ export default {
});
},
logout() {
console.log("hi")
localStorage.removeItem('token')
this.$router.go('/');
}
},
created() {
this.$http.get(process.env.API_URL + '/users').then((response) => {
// success callback
console.log(response);
this.profileData.email = response.body[0].email;
}, (response) => {
// error callback
Expand Down
39 changes: 38 additions & 1 deletion src/components/add-goal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</p>
</div>
<button class="button is-info is-fullwidth" @click="commit()">Commit</button>
<button class="button" @click.prevent="purchaseStuff()">PURCHASE</button>
</div>
</template>

Expand All @@ -27,6 +28,10 @@
],
data() {
return {
stripe_token: {},
price: 1000,
stripe_instance: {},
order_status: 'READY',
showIntegration$Input: true,
activeTab: {
tab: 1,
Expand All @@ -41,6 +46,17 @@
}
};
},
ready() {
this.stripe_instance = StripeCheckout.configure({
key: 'pk_test_t5EdiYNBA1LOp7En1xhBOYVp', //put your own publishable key here
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: function(token) {
this.stripe_token= token;
this.sendData2Server();
}
});
},
methods: {
commit() {
var shortname = this.integrationShortName.toLowerCase();
Expand All @@ -52,7 +68,28 @@
// error callback
this.failure = !this.failure;
});
}
},
purchaseStuff() {
this.stripe_instance.open({
name: 'Incentify',
description: 'New Commitment',
amount: this.price
})
// console.log('attempting to get a token');
},
sendData2Server() {
console.log("data 2 server");
this.order_status= "PENDING";
this.$http.post(process.env.API_URL + '/stripe/process_payment', {token_id: this.stripe_token.id, price: this.price})
.then((response) => {
// console.log(response.body);
this.order_status= "Successfully Completed";
},(response) => {
// error callback
// console.log(response.body);
this.order_status= "Failed";
});
},
}
};
</script>
Expand Down
1 change: 0 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const router = new VueRouter();

// get rid of 300ms tap delay
FastClick.attach(document.body);
console.log(process.env.API_URL);

router.map({
'/': {
Expand Down