This commit is contained in:
Emily
2025-04-25 19:20:13 +02:00
parent 82b0f6aac4
commit 6a157b81c9
5 changed files with 23 additions and 26 deletions

View File

@@ -203,7 +203,7 @@ function reloadPage() {
<div class="flex flex-col items-end"> <div class="flex flex-col items-end">
<div class="justify-center w-full hidden xl:flex gap-3"> <div class="justify-center w-full hidden xl:flex gap-3">
<a href="https://docs.litlyx.com/techs/wordpress"> <a href="https://docs.litlyx.com/techs/shopify">
<img class="cursor-pointer" :src="'tech-icons/shopify.png'" alt="Litlyx-Shopify"> <img class="cursor-pointer" :src="'tech-icons/shopify.png'" alt="Litlyx-Shopify">
</a> </a>
</div> </div>

View File

@@ -17,7 +17,7 @@ definePageMeta({ layout: 'none' });
</div> </div>
<div class="poppins"> <div class="poppins">
We hope Lilyx can help you make better metrics-driven decision to help your business. We hope Litlyx can help you make better metrics-driven decision to help your business.
</div> </div>
<NuxtLink to="/?just_logged=true" class="text-accent mt-10 bg-menu px-6 py-2 rounded-lg hover:bg-black font-semibold poppins cursor-pointer"> <NuxtLink to="/?just_logged=true" class="text-accent mt-10 bg-menu px-6 py-2 rounded-lg hover:bg-black font-semibold poppins cursor-pointer">

View File

@@ -1,38 +1,32 @@
import { getPlanFromId } from "@data/PLANS"; import { getPlanFromId } from "@data/PLANS";
import { PaymentServiceHelper } from "~/server/services/PaymentServiceHelper";
// import StripeService from '~/server/services/StripeService'; // import StripeService from '~/server/services/StripeService';
export default defineEventHandler(async event => { export default defineEventHandler(async event => {
const data = await getRequestDataOld(event, { requireSchema: false, allowGuests: false, allowLitlyx: false }); const data = await getRequestData(event, [], []);
if (!data) return; if (!data) return;
const { project, pid } = data; const { project, pid, user } = data;
// const body = await readBody(event); const body = await readBody(event);
// const { planId } = body; const { planId } = body;
const PLAN = getPlanFromId(planId);
// const PLAN = getPlanFromId(planId); if (!PLAN) {
console.error('PLAN', planId, 'NOT EXIST');
return setResponseStatus(event, 400, 'Plan not exist');
}
// if (!PLAN) { const [ok, res] = await PaymentServiceHelper.create_payment(user.id, PLAN.ID);
// console.error('PLAN', planId, 'NOT EXIST');
// return setResponseStatus(event, 400, 'Plan not exist');
// }
// const checkout = await StripeService.createPayment( if (!ok) {
// StripeService.testMode ? PLAN.PRICE_TEST : PLAN.PRICE, console.error('Cannot create payment', { plan: PLAN });
// 'https://dashboard.litlyx.com/payment_ok', return setResponseStatus(event, 400, res.message ?? 'Cannot create payment');
// pid, }
// project.customer_id
// );
// if (!checkout) { return res.url;
// console.error('Cannot create payment', { plan: PLAN });
// return setResponseStatus(event, 400, 'Cannot create payment');
// }
// return checkout.url;
return '';
}); });

View File

@@ -8,7 +8,7 @@ type PaymentServiceResponse<T> = Promise<OkResponse<T> | ErrorResponse>
export class PaymentServiceHelper { export class PaymentServiceHelper {
static BASE_URL = 'https://test-payments.litlyx.com/payment'; static BASE_URL = 'https://payments.litlyx.com/payment';
private static async send(endpoint: string, body: Record<string, any>): PaymentServiceResponse<any> { private static async send(endpoint: string, body: Record<string, any>): PaymentServiceResponse<any> {
try { try {
@@ -22,6 +22,9 @@ export class PaymentServiceHelper {
}) })
return [true, res]; return [true, res];
} catch (ex: any) { } catch (ex: any) {
console.log('---')
console.log(ex.response?._data);
console.log('---')
console.error(ex); console.error(ex);
return [false, ex]; return [false, ex];
} }

View File

@@ -41,7 +41,7 @@ export const ZBodyCreatePayment = z.object({
plan_id: z.number() plan_id: z.number()
}); });
paymentRouter.post('/create', json(), async (req, res) => { paymentRouter.post('/create_payment', json(), async (req, res) => {
try { try {
const createPaymentData = ZBodyCreatePayment.parse(req.body); const createPaymentData = ZBodyCreatePayment.parse(req.body);