mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 07:10:53 +00:00
26 lines
843 B
TypeScript
26 lines
843 B
TypeScript
// To run this script:
|
|
// export $(grep -v '^#' config.env | xargs) && ts-node ./Scripts/PaymentProvider/CouponCodeGenerator.ts > coupons.csv
|
|
|
|
import BillingService from 'CommonServer/Services/BillingService';
|
|
import Sleep from 'Common/Types/Sleep';
|
|
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
|
|
|
|
const main: PromiseVoidFunction = async (): Promise<void> => {
|
|
for (let i: number = 0; i < 2000; i++) {
|
|
const code: string = await BillingService.generateCouponCode({
|
|
name: 'Name',
|
|
percentOff: 100,
|
|
durationInMonths: 12,
|
|
maxRedemptions: 1,
|
|
});
|
|
//eslint-disable-next-line no-console
|
|
console.log(code);
|
|
await Sleep.sleep(50);
|
|
}
|
|
};
|
|
|
|
main().catch((err: Error) => {
|
|
//eslint-disable-next-line no-console
|
|
console.error(err);
|
|
});
|