mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
web: allow requesting refunds from settings
This commit is contained in:
committed by
Abdullah Atta
parent
a0229729b7
commit
7f873f240e
@@ -1357,6 +1357,40 @@ function AccountStatus(props) {
|
|||||||
tip="Update the payment method you used to purchase this subscription."
|
tip="Update the payment method you used to purchase this subscription."
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="list"
|
||||||
|
onClick={async () => {
|
||||||
|
const refundSubscription = await confirm({
|
||||||
|
title: "Request refund?",
|
||||||
|
message:
|
||||||
|
"You will only be issued a refund if you are eligible as per our refund policy. Your account will be immediately downgraded to Basic and your funds will be transferred to your account within 24 hours.",
|
||||||
|
negativeButtonText: "No",
|
||||||
|
positiveButtonText: "Yes"
|
||||||
|
});
|
||||||
|
if (refundSubscription) {
|
||||||
|
const error = await TaskManager.startTask({
|
||||||
|
id: "refund-subscription",
|
||||||
|
type: "modal",
|
||||||
|
title: "Requesting refund for your subscription",
|
||||||
|
subtitle: "Please wait...",
|
||||||
|
action: () => db.subscriptions.refund()
|
||||||
|
});
|
||||||
|
if (error instanceof Error) {
|
||||||
|
showToast("error", error.message);
|
||||||
|
} else {
|
||||||
|
showToast(
|
||||||
|
"success",
|
||||||
|
"Your refund has been issued. Please wait 24 hours before reaching out to us in case you do not receive your funds."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Tip
|
||||||
|
text="Request refund"
|
||||||
|
tip="If you are eligible for a refund, your account will be immediately downgraded to Basic and your funds will be transferred to your account within 24 hours."
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="list"
|
variant="list"
|
||||||
sx={{ ":hover": { borderColor: "error" } }}
|
sx={{ ":hover": { borderColor: "error" } }}
|
||||||
|
|||||||
@@ -34,6 +34,16 @@ export default class Subscriptions {
|
|||||||
await http.delete(`${hosts.SUBSCRIPTIONS_HOST}/subscriptions`, token);
|
await http.delete(`${hosts.SUBSCRIPTIONS_HOST}/subscriptions`, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async refund() {
|
||||||
|
const token = await this._tokenManager.getAccessToken();
|
||||||
|
if (!token) return;
|
||||||
|
await http.post(
|
||||||
|
`${hosts.SUBSCRIPTIONS_HOST}/subscriptions/refund`,
|
||||||
|
null,
|
||||||
|
token
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async updateUrl() {
|
async updateUrl() {
|
||||||
const token = await this._tokenManager.getAccessToken();
|
const token = await this._tokenManager.getAccessToken();
|
||||||
if (!token) return;
|
if (!token) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user