mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-27 10:40:38 +00:00
create new subscription if stripe was previously cancelled
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -95,6 +95,9 @@ export default {
|
|||||||
},
|
},
|
||||||
subscriptionDriver() {
|
subscriptionDriver() {
|
||||||
return this.user.data.relationships.subscription.data.attributes.driver
|
return this.user.data.relationships.subscription.data.attributes.driver
|
||||||
|
},
|
||||||
|
subscription() {
|
||||||
|
return this.user.data.relationships.subscription
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -129,11 +132,30 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
payByStripe() {
|
payByStripe() {
|
||||||
axios
|
// Subscribe to the new plan
|
||||||
.post(`/api/subscriptions/swap/${this.selectedPlan.data.id}`)
|
if (['inactive', 'cancelled', 'completed'].includes(this.subscription.data.attributes.status)) {
|
||||||
.then((response) => {
|
axios
|
||||||
console.log(response);
|
.post('/api/stripe/checkout', {
|
||||||
})
|
planCode: this.selectedPlan.data.meta.driver_plan_id.stripe,
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
window.location = response.data.url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change active subscription
|
||||||
|
if (this.subscription.data.attributes.status === 'active') {
|
||||||
|
axios
|
||||||
|
.post(`/api/subscriptions/swap/${this.selectedPlan.data.id}`)
|
||||||
|
.then(() => {
|
||||||
|
this.$closePopup()
|
||||||
|
|
||||||
|
events.$emit('toaster', {
|
||||||
|
type: 'success',
|
||||||
|
message: this.$t('Your subscription was successfully changed.'),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
payByPaystack() {
|
payByPaystack() {
|
||||||
axios
|
axios
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
class="block h-full w-full rounded-lg"
|
class="block h-full w-full rounded-lg"
|
||||||
:class="{'bg-theme': bar.percentage > 0, 'bg-gray-200': bar.percentage === 0}"
|
:class="{'bg-theme': bar.percentage > 0, 'dark:bg-gray-700 bg-gray-200': bar.percentage === 0}"
|
||||||
></span>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user