diff --git a/package.json b/package.json index 4752bd45..db5d3c3c 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "vue": "^2.6.14", "vue-feather-icons": "^5.1.0", "vue-i18n": "^8.27.0", - "vue-paystack": "^2.0.4", "vue-recaptcha-v3": "^1.9.0", "vue-router": "^3.5.3", "vuex": "^3.6.2" diff --git a/resources/js/components/Others/ChargePaymentPopup.vue b/resources/js/components/Others/ChargePaymentPopup.vue index f55fd5b4..0142e5d5 100644 --- a/resources/js/components/Others/ChargePaymentPopup.vue +++ b/resources/js/components/Others/ChargePaymentPopup.vue @@ -11,7 +11,7 @@ }" > @@ -31,30 +31,23 @@
- - - - - {{ $t('Select') }} - - - + + +
+ +
+ + {{ $t('Select') }} + +
@@ -75,8 +68,8 @@ import { loadScript } from '@paypal/paypal-js' import PaymentMethod from './PaymentMethod' import Spinner from '../FilesView/Spinner' import { events } from '../../bus' -import paystack from 'vue-paystack' import { mapGetters } from 'vuex' +import axios from "axios"; export default { name: 'ChargePaymentPopup', @@ -87,7 +80,6 @@ export default { PopupContent, PopupHeader, ButtonBase, - paystack, Spinner, }, data() { @@ -96,21 +88,31 @@ export default { isMethodsLoaded: false, isMethodLoading: false, }, + paystack: { + isGettingCheckoutLink: false, + }, } }, computed: { ...mapGetters(['singleChargeAmount', 'config', 'user']), }, methods: { - pickedPaymentMethod(driver) { - if (driver === 'paystack') { - this.$closePopup() - } - if (driver === 'paypal' && !this.paypal.isMethodsLoaded) { - this.PayPalInitialization() - } - }, - async PayPalInitialization() { + payByPaystack() { + this.paystack.isGettingCheckoutLink = true + + axios + .post('/api/paystack/checkout', { + amount: this.singleChargeAmount * 100, + }) + .then((response) => { + window.location = response.data.data.authorization_url + }) + }, + async payByPayPal() { + if (this.paypal.isMethodLoading) { + return + } + this.paypal.isMethodLoading = true let paypal @@ -166,9 +168,6 @@ export default { // todo: temporary reload function setTimeout(() => document.location.reload(), 500) }, - paystackClosed() { - // ... - }, }, created() { events.$on('popup:close', () => (this.paypal.isMethodsLoaded = false)) diff --git a/resources/js/components/Subscription/ChangeSubscriptionPopup.vue b/resources/js/components/Subscription/ChangeSubscriptionPopup.vue index 07135a59..c1d5acc5 100644 --- a/resources/js/components/Subscription/ChangeSubscriptionPopup.vue +++ b/resources/js/components/Subscription/ChangeSubscriptionPopup.vue @@ -44,15 +44,12 @@