@goweekdays/core 0.0.18 → 0.0.21

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,23 @@
1
1
  # @goweekdays/core
2
2
 
3
+ ## 0.0.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 336f407: add billing contact management
8
+
9
+ ## 0.0.20
10
+
11
+ ### Patch Changes
12
+
13
+ - 44d5c6e: update dependencies
14
+
15
+ ## 0.0.19
16
+
17
+ ### Patch Changes
18
+
19
+ - 2fce77e: update dependencies
20
+
3
21
  ## 0.0.18
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ import { ObjectId, ClientSession, Db, Collection } from 'mongodb';
3
3
  import * as bson from 'bson';
4
4
  import { Request, Response, NextFunction } from 'express';
5
5
  import { paginate } from '@goweekdays/utils';
6
- import { z } from 'zod';
7
6
  import Joi from 'joi';
7
+ import { z } from 'zod';
8
8
 
9
9
  type TVerificationMetadata = {
10
10
  name?: string;
@@ -819,6 +819,10 @@ declare function useCommentController(): {
819
819
  getComments: (req: Request, res: Response, next: NextFunction) => Promise<void>;
820
820
  };
821
821
 
822
+ type TBillingRecipient = {
823
+ addedAt?: Date | string;
824
+ email: string;
825
+ };
822
826
  type TSubscription = {
823
827
  _id?: ObjectId;
824
828
  user?: ObjectId | string;
@@ -835,12 +839,13 @@ type TSubscription = {
835
839
  maxSeats?: number;
836
840
  status?: string;
837
841
  billingCycle: "monthly" | "yearly";
842
+ billingContacts?: Array<TBillingRecipient>;
838
843
  nextBillingDate?: Date;
839
844
  lastPaymentStatus?: string;
840
845
  failedAttempts?: number;
841
- createdAt?: string;
842
- updatedAt?: string;
843
- deletedAt?: string;
846
+ createdAt?: string | Date;
847
+ updatedAt?: string | Date;
848
+ deletedAt?: string | Date;
844
849
  };
845
850
  declare function MSubscription(value: TSubscription): TSubscription;
846
851
 
@@ -873,8 +878,8 @@ declare function useSubscriptionRepo(): {
873
878
  markSubscriptionAsFailed: ({ _id, failed }?: {
874
879
  _id: string | ObjectId;
875
880
  failed?: boolean | undefined;
876
- }, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
877
- markSubscriptionAsCanceled: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
881
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
882
+ markSubscriptionAsCanceled: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
878
883
  updateSeatsById: ({ _id, currentSeats, maxSeats, paidSeats, amount, status, nextBillingDate, }?: {
879
884
  _id: string | ObjectId;
880
885
  currentSeats: number;
@@ -883,13 +888,17 @@ declare function useSubscriptionRepo(): {
883
888
  amount: number;
884
889
  status?: string | undefined;
885
890
  nextBillingDate?: string | undefined;
886
- }, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
891
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
887
892
  updateMaxSeatsById: ({ _id, seats }?: {
888
893
  _id: string | ObjectId;
889
894
  seats: number;
890
- }, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
891
- updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
892
- updatePromoCodeById: (_id: string | ObjectId, promoCode: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
895
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
896
+ updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
897
+ updatePromoCodeById: (_id: string | ObjectId, promoCode: string, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
898
+ updatePaymentMethodById: (_id: string | ObjectId, paymentMethodId: string, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
899
+ addBillingContactById: (_id: string | ObjectId, email: string) => Promise<string>;
900
+ updateBillingContactByAddedAt: (_id: string | ObjectId, addedAt: string | Date, email: string) => Promise<string>;
901
+ deleteBillingContactByAddedAt: (_id: string | ObjectId, addedAt: string | Date) => Promise<string>;
893
902
  };
894
903
 
895
904
  type TOrg = {
@@ -921,6 +930,7 @@ type TAddress = {
921
930
  postalCode: string;
922
931
  taxId: string;
923
932
  };
933
+ declare const addressSchema: Joi.ObjectSchema<any>;
924
934
  declare function MAddress(value: any): TAddress;
925
935
 
926
936
  declare function useSubscriptionService(): {
@@ -984,6 +994,10 @@ declare function useSubscriptionController(): {
984
994
  updateSubscriptionSeats: (req: Request, res: Response, next: NextFunction) => Promise<void>;
985
995
  updatePromoCodeById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
986
996
  updateStatusById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
997
+ updatePaymentMethodById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
998
+ addBillingContactById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
999
+ updateBillingContactByAddedAt: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1000
+ deleteBillingContactByAddedAt: (req: Request, res: Response, next: NextFunction) => Promise<void>;
987
1001
  };
988
1002
 
989
1003
  declare const CustomerSchema: z.ZodEffects<z.ZodObject<{
@@ -1482,11 +1496,15 @@ declare function useAddressRepo(): {
1482
1496
  createIndex: () => Promise<void>;
1483
1497
  add: (value: TAddress, session?: ClientSession) => Promise<ObjectId>;
1484
1498
  getByUserId: (user: string | ObjectId) => Promise<TAddress | null>;
1499
+ getByOrgId: (org: string | ObjectId) => Promise<TAddress | null>;
1500
+ updateById: (_id: string | ObjectId, value: Pick<TAddress, "country" | "city" | "address" | "continuedAddress" | "province" | "postalCode" | "taxId">, session?: ClientSession) => Promise<string>;
1485
1501
  };
1486
1502
 
1487
1503
  declare function useAddressController(): {
1488
1504
  add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1489
1505
  getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1506
+ getByOrgId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1507
+ updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1490
1508
  };
1491
1509
 
1492
1510
  declare function useOrgRepo(): {
@@ -2600,4 +2618,4 @@ declare const PAYPAL_API_URL: string;
2600
2618
  declare const XENDIT_SECRET_KEY: string;
2601
2619
  declare const XENDIT_BASE_URL: string;
2602
2620
 
2603
- 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, 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, 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 };
2621
+ 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 };