Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: remove the manual client-side subscription handling

thecodrr5d65ed12096c
diff --git a/apps/web/src/common/upgrade.js b/apps/web/src/common/upgrade.js
index 23cf66a16..7967f3ee7 100644
--- a/apps/web/src/common/upgrade.js
+++ b/apps/web/src/common/upgrade.js
@@ -1,20 +1,10 @@
-import { db } from "./index";
-
-window.onload = async function (e) {
- const refno = getParameterByName("refno");
- if (refno) {
- console.log(refno);
- await db.user.upgrade(refno);
- window.location.hash = "#";
- }
-};
-
function upgrade(user) {
const { TwoCoInlineCart: cart } = window;
if (!cart) return;
cart.setup.setMerchant("250327951921"); // your Merchant code
cart.billing.setEmail(user.email); // customer email address
cart.shipping.setEmail(user.email); // customer Delivery email
+ cart.cart.setExternalCustomerReference(user.Id);
cart.cart.setTest(true);
cart.products.add({
@@ -25,16 +15,5 @@ function upgrade(user) {
cart.cart.setCartLockedFlag(true);
cart.cart.checkout().then(console.log); // start checkout process
}
-//http://localhost:3000/#/?refno=121822593&total=6.99&total-currency=USD&signature=06b250570afca7ccd6cb54d4d1dc63a7c4c3e1adf28be4cdb57a9f4569bfbbce
-
-function getParameterByName(name, url) {
- if (!url) url = window.location.href;
- name = name.replace(/[[\]]/g, "\\$&");
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return "";
- return decodeURIComponent(results[2].replace(/\+/g, " "));
-}
export { upgrade };