diff --git a/src/components/specific/payment/storage-preview/StoragePreview.vue b/src/components/specific/payment/storage-preview/StoragePreview.vue
index 85873b64a..22aa71194 100644
--- a/src/components/specific/payment/storage-preview/StoragePreview.vue
+++ b/src/components/specific/payment/storage-preview/StoragePreview.vue
@@ -10,15 +10,25 @@
/>
-
+
- {{ $t("StoragePreview.actualStorage") }}
+
+ {{ $t("StoragePreview.actualStorage") }}
+
- 125MB
+
+ {{ formatBytes(spaceInfo.smartDataSize) }}
+
- 500MB
+
+ {{ formatBytes(spaceInfo.smartDataSizeAvailable) }}
+
@@ -28,10 +38,14 @@
- {{ $t("StoragePreview.newStorage") }}
+
+ {{ $t("StoragePreview.newStorage") }}
+
- 125MB
+
+ {{ formatBytes(spaceInfo.smartDataSize) }}
+
10GB
@@ -45,6 +59,9 @@
diff --git a/src/components/specific/payment/subscription-form/SubscriptionForm.vue b/src/components/specific/payment/subscription-form/SubscriptionForm.vue
index 965527a85..7082f045c 100644
--- a/src/components/specific/payment/subscription-form/SubscriptionForm.vue
+++ b/src/components/specific/payment/subscription-form/SubscriptionForm.vue
@@ -10,16 +10,12 @@ import { useUser } from "@/state/user.js";
export default {
props: {
- organization: {
- type: Object,
- required: true
- },
space: {
type: Object,
required: true
}
},
- setup() {
+ setup(props) {
const { user } = useUser();
onMounted(() => {
@@ -28,13 +24,13 @@ export default {
product: 12403,
method: "inline",
disableLogout: true,
- referring_domain: "platform self service",
+ referring_domain: "platform",
// User data
email: user.value.email,
// passthrough: {
- // organization_id: "1663",
- // cloud_id: "673"
+ // organization_id: props.space.organization.id,
+ // cloud_id: props.space.id
// },
// Checkout frame
diff --git a/src/components/specific/subscription/storage-informations/StorageInformations.vue b/src/components/specific/subscription/storage-informations/StorageInformations.vue
index a07418af8..e9f1ba9e6 100644
--- a/src/components/specific/subscription/storage-informations/StorageInformations.vue
+++ b/src/components/specific/subscription/storage-informations/StorageInformations.vue
@@ -50,13 +50,11 @@
import { ref, watch } from "vue";
import { useRouter } from "vue-router";
import { routeNames } from "@/router";
-
import { usePayment } from "@/state/payment.js";
-
+import { formatBytes } from "@/utils/files.js";
+// Components
import ProgressBar from "@/components/generic/progress-bar/ProgressBar";
-import { formatBytesV2 } from "@/utils/files.js";
-
export default {
components: {
ProgressBar
@@ -91,8 +89,8 @@ export default {
return {
// References
spaceInformation,
- formatBytes: formatBytesV2,
// Methods
+ formatBytes,
goToPayment
};
}
diff --git a/src/services/PaymentService.js b/src/services/PaymentService.js
index 0d5a6da87..90feb6e01 100644
--- a/src/services/PaymentService.js
+++ b/src/services/PaymentService.js
@@ -21,10 +21,14 @@ class PaymentService {
}
}
- retrieveOrganizationPlatformSubscriptions(organization) {
- return privateApiClient.get(
- `/payment/organization/${organization.id}/platform-subscription`
- );
+ async retrieveOrganizationPlatformSubscriptions(organization) {
+ try {
+ return await privateApiClient.get(
+ `/payment/organization/${organization.id}/platform-subscription`
+ );
+ } catch (error) {
+ console.log(error);
+ }
}
async retrieveSpaceInformation(space) {
@@ -53,6 +57,7 @@ class PaymentService {
// calculation of the remaining size
const remainingSizePercent = 100 - size.remainingSmartDataSizePercent;
+
return {
remainingSizePercent,
isPlatformPaid,
@@ -61,6 +66,16 @@ class PaymentService {
...size
};
}
+
+ async generatePlatformSubscription(space) {
+ try {
+ return await privateApiClient.post(
+ `/payment/organization/${space.organization.id}/cloud/${space.id}/subscription/generate-platform-subscription`
+ );
+ } catch (error) {
+ console.log(error);
+ }
+ }
}
const service = new PaymentService();
diff --git a/src/state/payment.js b/src/state/payment.js
index 92f3137d7..7fc07e2b1 100644
--- a/src/state/payment.js
+++ b/src/state/payment.js
@@ -42,15 +42,15 @@ const retrieveSpaceInformation = space => {
return PaymentService.retrieveSpaceInformation(space);
};
-const subscribeDataPack = async () => {
- // TODO
+const generatePlatformSubscription = space => {
+ return PaymentService.generatePlatformSubscription(space);
};
-const updateDataPack = async () => {
+const createDataPackSubscription = async () => {
// TODO
};
-const createPaddleSubscriptionUrl = async () => {
+const updateDataPackSubscription = async () => {
// TODO
};
@@ -61,8 +61,8 @@ export function usePayment() {
retrieveOrganizationPlaformSubscriptions,
retrievePlaformSubscriptionPayments,
retrieveSpaceInformation,
- subscribeDataPack,
- updateDataPack,
- createPaddleSubscriptionUrl
+ generatePlatformSubscription,
+ createDataPackSubscription,
+ updateDataPackSubscription
};
}
diff --git a/src/utils/files.js b/src/utils/files.js
index e9cee1e64..3a39faa69 100644
--- a/src/utils/files.js
+++ b/src/utils/files.js
@@ -3,23 +3,7 @@ function fileExtension(fileName) {
return parts.length > 1 ? parts[parts.length - 1] : "";
}
-function formatBytes(bytes) {
- if (bytes >= 1000000000000) {
- return `${Number(bytes / 1000000000000).toFixed(2)} TB`;
- }
- if (bytes >= 1000000000) {
- return `${Number(bytes / 1000000000).toFixed(2)} GB`;
- }
- if (bytes >= 1000000) {
- return `${Number(bytes / 1000000).toFixed(2)} MB`;
- }
- if (bytes >= 1000) {
- return `${Number(bytes / 1000).toFixed(2)} KB`;
- }
- return `${bytes} B`;
-}
-
-function formatBytesV2(bytes, decimals = 2) {
+function formatBytes(bytes, decimals = 2) {
if (bytes) {
const dm = decimals < 0 ? 0 : decimals;
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
@@ -39,4 +23,4 @@ function generateFileKey(fileName, fileSize) {
return key;
}
-export { fileExtension, formatBytes, formatBytesV2, generateFileKey };
+export { fileExtension, formatBytes, generateFileKey };
diff --git a/src/views/payment/Payment.vue b/src/views/payment/Payment.vue
index 329353089..9100558fe 100644
--- a/src/views/payment/Payment.vue
+++ b/src/views/payment/Payment.vue
@@ -15,13 +15,10 @@
-
+
-
+
diff --git a/src/views/space-board/SpaceBoard.vue b/src/views/space-board/SpaceBoard.vue
index 1938fdb9d..9710d0ead 100644
--- a/src/views/space-board/SpaceBoard.vue
+++ b/src/views/space-board/SpaceBoard.vue
@@ -17,15 +17,6 @@
-