You've already forked AstralRinth
forked from didirus/AstralRinth
Fix resubscription of servers with failed payments (#3696)
* Fix resubscription of servers with failed payments Resolves MOD-55 * run fix
This commit is contained in:
@@ -361,7 +361,14 @@
|
||||
"
|
||||
color="green"
|
||||
>
|
||||
<button @click="resubscribePyro(subscription.id)">
|
||||
<button
|
||||
@click="
|
||||
resubscribePyro(
|
||||
subscription.id,
|
||||
$dayjs(getPyroCharge(subscription).due).isBefore($dayjs()),
|
||||
)
|
||||
"
|
||||
>
|
||||
Resubscribe <RightArrowIcon />
|
||||
</button>
|
||||
</ButtonStyled>
|
||||
@@ -1098,7 +1105,7 @@ async function fetchCapacityStatuses(serverId, product) {
|
||||
}
|
||||
}
|
||||
|
||||
const resubscribePyro = async (subscriptionId) => {
|
||||
const resubscribePyro = async (subscriptionId, wasSuspended) => {
|
||||
try {
|
||||
await useBaseFetch(`billing/subscription/${subscriptionId}`, {
|
||||
internal: true,
|
||||
@@ -1108,6 +1115,21 @@ const resubscribePyro = async (subscriptionId) => {
|
||||
},
|
||||
});
|
||||
await refresh();
|
||||
if (wasSuspended) {
|
||||
data.$notify({
|
||||
group: "main",
|
||||
title: "Resubscription request submitted",
|
||||
text: "If the server is currently suspended, it may take up to 10 minutes for another charge attempt to be made.",
|
||||
type: "success",
|
||||
});
|
||||
} else {
|
||||
data.$notify({
|
||||
group: "main",
|
||||
title: "Success",
|
||||
text: "Server subscription resubscribed successfully",
|
||||
type: "success",
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
data.$notify({
|
||||
group: "main",
|
||||
|
||||
Reference in New Issue
Block a user