Set real subscription price and recurring cron job

This commit is contained in:
austinkelsay 2024-11-14 13:23:05 -06:00
parent 6040cdf879
commit 18b1271326
No known key found for this signature in database
GPG Key ID: 44CB4EC6D9F2FA02
3 changed files with 7 additions and 7 deletions

View File

@ -27,7 +27,7 @@ const SubscriptionPaymentButtons = ({ onSuccess, onError, onRecurringSubscriptio
const router = useRouter();
const lnAddress = process.env.NEXT_PUBLIC_LIGHTNING_ADDRESS;
const amount = 25;
const amount = 70000;
useEffect(() => {
initializeBitcoinConnect();
@ -94,9 +94,9 @@ const SubscriptionPaymentButtons = ({ onSuccess, onError, onRecurringSubscriptio
const initNwcOptions = {
name: "plebdevs.com",
requestMethods: ['pay_invoice'],
maxAmount: 25,
maxAmount: 70000,
editable: false,
budgetRenewal: 'daily',
budgetRenewal: 'monthly',
expiresAt: yearFromNow,
};
await newNwc.initNWC(initNwcOptions);
@ -259,7 +259,7 @@ const SubscriptionPaymentButtons = ({ onSuccess, onError, onRecurringSubscriptio
<AlbyButton handleSubmit={handleRecurringSubscription} />
<span className='my-4 text-lg font-bold'>or</span>
<p className='text-lg font-bold'>Manually enter NWC URL</p>
<span className='text-sm text-gray-500'>*make sure you set a budget of at least 25000 sats and set budget renewal to monthly</span>
<span className='text-sm text-gray-500'>*make sure you set a budget of at least 70000 sats and set budget renewal to monthly</span>
<input
type="text"
value={nwcInput}

View File

@ -187,13 +187,13 @@ export const updateUserSubscription = async (userId, isSubscribed, nwc) => {
export const findExpiredSubscriptions = async () => {
try {
const now = new Date();
const oneDayAndOneHourAgo = new Date(now.getTime() - 1 * 24 * 60 * 60 * 1000 - 1 * 60 * 60 * 1000);
const oneMonthAndOneHourAgo = new Date(now.getTime() - 1 * 30 * 24 * 60 * 60 * 1000 - 1 * 60 * 60 * 1000);
const result = await prisma.role.findMany({
where: {
subscribed: true,
lastPaymentAt: {
lt: oneDayAndOneHourAgo
lt: oneMonthAndOneHourAgo
}
},
select: {

View File

@ -3,7 +3,7 @@ import { webln } from "@getalby/sdk";
import { LightningAddress } from '@getalby/lightning-tools';
const lnAddress = process.env.LIGHTNING_ADDRESS;
const amount = 25; // Set the subscription amount in satoshis
const amount = 70000; // Set the subscription amount in satoshis
export default async function handler(req, res) {
// if (req.headers.authorization !== process.env.CRON_SECRET) {