Skip to content

Commit

Permalink
Cleanup stripe leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
MrNaif2018 committed Feb 25, 2022
1 parent 303b3c8 commit 55270c4
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 123 deletions.
46 changes: 3 additions & 43 deletions components/Checkout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.content
transition(name="fade")

form.payment(v-if="status !== 'failure'", @submit.prevent="beforePay")
form.payment(@submit.prevent="beforePay")
h3 Please enter your payment details:

.field
Expand Down Expand Up @@ -43,21 +43,13 @@
:class="{ 'is-danger': errors.has('notes') }")

.field
button.button.is-success.pay-with-stripe(:disabled="errors.any()",
:class="{ 'is-loading': isLoading }")
button.button.is-success(:disabled="errors.any()")
| Generate invoice

.statusFailure.has-text-centered(v-if="status === 'failure'")
h3 Oh No!
p Something went wrong!
button.button(@click="clearCheckout") Please try again

</template>

<script>
import { mapActions, mapGetters } from "vuex"
const STRIPE_URL = process.env.STRIPE_URL
import { mapGetters } from "vuex"
export default {
name: "Checkout",
Expand All @@ -67,10 +59,6 @@ export default {
type: [Number, String],
required: true,
},
stripeUrl: {
type: String,
default: STRIPE_URL,
},
promocode: {
type: String,
default: null,
Expand All @@ -84,27 +72,13 @@ export default {
default: "",
},
},
data() {
return {
stripePublishableKey: process.env.STRIPE_PUBLISHABLE_KEY,
}
},
computed: {
...mapGetters("checkout", ["isStripeCardCompleted", "status", "isLoading"]),
...mapGetters(["emailRequired"]),
},
methods: {
...mapActions("cart", [
"clearCheckout",
"pay",
"setIsStripeCardCompleted",
"setStatus",
]),
async beforePay() {
const isAllFieldsValid = await this.$validator.validateAll()
if (!isAllFieldsValid) {
this.setStatus("failure")
return
}
await this.$emit("pay")
Expand All @@ -122,18 +96,4 @@ export default {
flex-direction: column;
margin: 0 auto;
}
.stripe-card {
margin-bottom: 10px;
&.input {
display: block;
}
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.25s ease-out;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
</style>
49 changes: 0 additions & 49 deletions store/checkout/actions.js

This file was deleted.

7 changes: 0 additions & 7 deletions store/checkout/getters.js

This file was deleted.

17 changes: 0 additions & 17 deletions store/checkout/mutations.js

This file was deleted.

7 changes: 0 additions & 7 deletions store/checkout/state.js

This file was deleted.

0 comments on commit 55270c4

Please sign in to comment.