CLASSROOMIO-T-152: Add payment link + reload on org login

This commit is contained in:
Rotimi Best
2023-09-14 23:04:51 +01:00
parent 530ea721a2
commit bc7a5e1e4d
16 changed files with 133 additions and 91 deletions
+18
View File
@@ -0,0 +1,18 @@
import type { Course } from '../types';
export const isCourseFree = (cost: number) => !(Number(cost) > 0);
export const getStudentInviteLink = (_course: Course, orgSiteName: string) => {
const hash = encodeURIComponent(
btoa(
JSON.stringify({
groupId: _course.group?.id,
name: _course.title,
description: _course.description,
orgSiteName
})
)
);
return `https://${orgSiteName}.classroomio.com/invite/s/${hash}`;
};
@@ -1,7 +1,8 @@
export default (currency: string | undefined) => {
return new Intl.NumberFormat('en-US', {
const locale = currency == 'NGN' ? 'en-NG' : 'en-US';
return new Intl.NumberFormat(locale, {
style: 'currency',
currency: currency,
minimumFractionDigits: 2,
minimumFractionDigits: 2
});
};
+1 -1
View File
@@ -3,7 +3,7 @@ import type { MailService } from '@sendgrid/mail';
import { SENDGRID_API_KEY } from '$env/static/private';
export const SENDGRID_FROM = 'Rotimi Best <best@classroomio.com>';
export const SENDGRID_FROM_NOTIFY = 'ClassroomIO <notify@classroomio.com>';
export const SENDGRID_FROM_NOREPLY = 'ClassroomIO <noreply@classroomio.com>';
export let sendgrid: MailService;
+2 -1
View File
@@ -8,6 +8,7 @@ interface CourseMetadata {
videoUrl?: '';
showDiscount: false;
discount: 0;
paymentLink?: string;
reward?: {
show: boolean;
description: string;
@@ -94,7 +95,7 @@ export interface Course {
logo?: string;
slug?: any; // type unknown;
metadata?: CourseMetadata;
cost?: number;
cost: number;
currency?: string;
group?: Group;
organization?: Organization;