@goweekdays/core 0.1.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @goweekdays/core
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 794d115: Add paid invoice webhook
8
+
9
+ ## 1.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - df4839f: Initial release with Paypal integration
14
+
3
15
  ## 0.1.1
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -939,7 +939,7 @@ declare function useSubscriptionService(): {
939
939
  currency: string;
940
940
  perSeatPrice: number;
941
941
  seats: number;
942
- transactionId: string;
942
+ transactionId?: string | undefined;
943
943
  promoCode?: string | undefined;
944
944
  org: {
945
945
  name: string;
@@ -996,6 +996,13 @@ declare function useSubscriptionService(): {
996
996
  }>;
997
997
  processSubscriptions: (batchSize?: number, maxRetries?: number) => Promise<void>;
998
998
  updateSeatsById: (value: {
999
+ transactionId?: string | undefined;
1000
+ subscriptionId: string;
1001
+ seats: number;
1002
+ amount: number;
1003
+ }) => Promise<void>;
1004
+ updateSubscriptionSeats: (value: {
1005
+ transactionId?: string | undefined;
999
1006
  subscriptionId: string;
1000
1007
  seats: number;
1001
1008
  amount: number;
@@ -1540,7 +1547,7 @@ declare function useOrgRepo(): {
1540
1547
  createTextIndex: () => Promise<void>;
1541
1548
  createUniqueIndex: () => Promise<void>;
1542
1549
  add: (value: TOrg, session?: ClientSession) => Promise<ObjectId>;
1543
- getOrgs: ({ search, page, limit, sort, status, }?: {
1550
+ getAll: ({ search, page, limit, sort, status, }?: {
1544
1551
  search?: string | undefined;
1545
1552
  page?: number | undefined;
1546
1553
  limit?: number | undefined;
@@ -1573,6 +1580,7 @@ declare function useOrgController(): {
1573
1580
  createOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1574
1581
  getOrgsByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1575
1582
  getByName: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1583
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1576
1584
  };
1577
1585
 
1578
1586
  type TMember = {
@@ -1897,7 +1905,7 @@ declare function useInvoiceRepo(): {
1897
1905
  createIndex: () => Promise<void>;
1898
1906
  createUniqueIndex: () => Promise<void>;
1899
1907
  add: (value: TInvoice, session?: ClientSession) => Promise<void>;
1900
- getByDueDate: (dueDate: Date, status?: TInvoice["status"]) => Promise<{
1908
+ getByDueDate: (id: string | ObjectId, dueDate: Date, status?: TInvoice["status"]) => Promise<{
1901
1909
  type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1902
1910
  status: "pending" | "cancelled" | "paid" | "overdue";
1903
1911
  amount: number;
@@ -1987,10 +1995,37 @@ declare function useInvoiceRepo(): {
1987
1995
  } | undefined;
1988
1996
  createdAt?: Date | undefined;
1989
1997
  } | null>;
1998
+ getByTransactionId: (id: string) => Promise<{
1999
+ type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
2000
+ status: "pending" | "cancelled" | "paid" | "overdue";
2001
+ amount: number;
2002
+ invoiceNumber: string;
2003
+ dueDate: Date;
2004
+ items: {
2005
+ description: string;
2006
+ unitPrice: number;
2007
+ quantity: number;
2008
+ total: number;
2009
+ seats?: number | undefined;
2010
+ }[];
2011
+ _id?: ObjectId | undefined;
2012
+ updatedAt?: Date | undefined;
2013
+ metadata?: {
2014
+ description?: string | undefined;
2015
+ userId?: string | ObjectId | undefined;
2016
+ orgId?: string | ObjectId | undefined;
2017
+ transactionId?: string | undefined;
2018
+ currency?: string | undefined;
2019
+ subscriptionId?: string | ObjectId | undefined;
2020
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
2021
+ } | undefined;
2022
+ createdAt?: Date | undefined;
2023
+ } | null>;
1990
2024
  };
1991
2025
 
1992
2026
  declare function useInvoiceService(): {
1993
2027
  processOverDueInvoices: (BATCH_SIZE?: number, MAX_RETRIES?: number) => Promise<void>;
2028
+ paypalPaidInvoiceWebhookHandler: (invoiceId: string, status: string) => Promise<"Payment processed successfully." | undefined>;
1994
2029
  };
1995
2030
 
1996
2031
  declare function useInvoiceController(): {
@@ -2621,6 +2656,22 @@ declare function usePriceController(): {
2621
2656
  getByNameType: (req: Request, res: Response, next: NextFunction) => Promise<void>;
2622
2657
  };
2623
2658
 
2659
+ declare function usePaypalService(): {
2660
+ createInvoice: (data: {
2661
+ invoiceNumber?: string | undefined;
2662
+ invoiceDate?: string | undefined;
2663
+ invoiceDueDate?: string | undefined;
2664
+ customerEmail: string;
2665
+ customerName?: string | undefined;
2666
+ quantity: number;
2667
+ ratePerSeat: number;
2668
+ currency: string;
2669
+ items?: Record<string, any>[] | undefined;
2670
+ note?: string | undefined;
2671
+ }) => Promise<string>;
2672
+ getInvoiceById: (invoiceId: string) => Promise<any>;
2673
+ };
2674
+
2624
2675
  declare const MONGO_URI: string;
2625
2676
  declare const MONGO_DB: string;
2626
2677
  declare const PORT: number;
@@ -2657,4 +2708,4 @@ declare const PAYPAL_API_URL: string;
2657
2708
  declare const XENDIT_SECRET_KEY: string;
2658
2709
  declare const XENDIT_BASE_URL: string;
2659
2710
 
2660
- export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, CardPayment, CardPaymentSchema, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DirectDebit, DirectDebitSchema, EWalletPayment, EWalletPaymentSchema, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MCapBldgAct, MComment, MEntity, MFile, MMember, MONGO_DB, MONGO_URI, MOrder, MOrg, MPaymentMethod, MPromoCode, MRole, MSubscription, MToken, MUser, MUserRole, MVerification, MWorkflow, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TAddress, TAttachment, TBillingRecipient, TCapBldgAct, TCapBldgActAssmtCriteria, TCapBldgActBasicInfo, TCapBldgActInitRevEval, TComment, TCounter, TEntity, TFile, TInvoice, TMember, TMiniRole, TOrder, TOrderMetadata, TOrg, TPayment, TPaymentMethod$1 as TPaymentMethod, TPaymentMethodType, TPrice, TPriceType, TPromoCode, TPromoTier, TRole, TSubscription, TToken, TUser, TUserRole, TVerification, TVerificationMetadata, TWorkflow, TWorkflowStep, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, addressSchema, isDev, schema, useAddressController, useAddressRepo, useAuthController, useAuthService, useCapBldgActController, useCapBldgActRepo, useCapBldgActService, useCommentController, useCommentRepo, useCommentService, useCounterModel, useCounterRepo, useEntityController, useEntityRepo, useEntityService, useFileController, useFileRepo, useFileService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useInvoiceService, useMemberController, useMemberRepo, useOrderController, useOrderRepo, useOrgController, useOrgRepo, useOrgService, usePaymentController, usePaymentMethodController, usePaymentMethodRepo, usePaymentMethodService, usePaymentModel, usePaymentRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useTokenRepo, useUserController, useUserRepo, useUserService, useVerificationController, useVerificationRepo, useVerificationService, useWorkflowController, useWorkflowRepo, useWorkflowService, useXenditService, validateCardPayment, validateDirectDebit, validateEWalletPayment };
2711
+ export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, CardPayment, CardPaymentSchema, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DirectDebit, DirectDebitSchema, EWalletPayment, EWalletPaymentSchema, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MCapBldgAct, MComment, MEntity, MFile, MMember, MONGO_DB, MONGO_URI, MOrder, MOrg, MPaymentMethod, MPromoCode, MRole, MSubscription, MToken, MUser, MUserRole, MVerification, MWorkflow, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TAddress, TAttachment, TBillingRecipient, TCapBldgAct, TCapBldgActAssmtCriteria, TCapBldgActBasicInfo, TCapBldgActInitRevEval, TComment, TCounter, TEntity, TFile, TInvoice, TMember, TMiniRole, TOrder, TOrderMetadata, TOrg, TPayment, TPaymentMethod$1 as TPaymentMethod, TPaymentMethodType, TPrice, TPriceType, TPromoCode, TPromoTier, TRole, TSubscription, TToken, TUser, TUserRole, TVerification, TVerificationMetadata, TWorkflow, TWorkflowStep, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, addressSchema, isDev, schema, useAddressController, useAddressRepo, useAuthController, useAuthService, useCapBldgActController, useCapBldgActRepo, useCapBldgActService, useCommentController, useCommentRepo, useCommentService, useCounterModel, useCounterRepo, useEntityController, useEntityRepo, useEntityService, useFileController, useFileRepo, useFileService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useInvoiceService, useMemberController, useMemberRepo, useOrderController, useOrderRepo, useOrgController, useOrgRepo, useOrgService, usePaymentController, usePaymentMethodController, usePaymentMethodRepo, usePaymentMethodService, usePaymentModel, usePaymentRepo, usePaypalService, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useTokenRepo, useUserController, useUserRepo, useUserService, useVerificationController, useVerificationRepo, useVerificationService, useWorkflowController, useWorkflowRepo, useWorkflowService, useXenditService, validateCardPayment, validateDirectDebit, validateEWalletPayment };