@goweekdays/core 0.0.20 → 0.0.22

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
+ ## 0.0.22
4
+
5
+ ### Patch Changes
6
+
7
+ - cf1bf01: add invoice payment
8
+
9
+ ## 0.0.21
10
+
11
+ ### Patch Changes
12
+
13
+ - 336f407: add billing contact management
14
+
3
15
  ## 0.0.20
4
16
 
5
17
  ### 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(): {
@@ -969,6 +979,7 @@ declare function useSubscriptionService(): {
969
979
  seats: number;
970
980
  amount: number;
971
981
  }) => Promise<void>;
982
+ processSubscriptionPayment: (invoiceNumber: string, subscriptionId: string) => Promise<void>;
972
983
  };
973
984
 
974
985
  declare function useSubscriptionController(): {
@@ -984,6 +995,11 @@ declare function useSubscriptionController(): {
984
995
  updateSubscriptionSeats: (req: Request, res: Response, next: NextFunction) => Promise<void>;
985
996
  updatePromoCodeById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
986
997
  updateStatusById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
998
+ updatePaymentMethodById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
999
+ addBillingContactById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1000
+ updateBillingContactByAddedAt: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1001
+ deleteBillingContactByAddedAt: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1002
+ processSubscriptionPayment: (req: Request, res: Response, next: NextFunction) => Promise<void>;
987
1003
  };
988
1004
 
989
1005
  declare const CustomerSchema: z.ZodEffects<z.ZodObject<{
@@ -1482,11 +1498,15 @@ declare function useAddressRepo(): {
1482
1498
  createIndex: () => Promise<void>;
1483
1499
  add: (value: TAddress, session?: ClientSession) => Promise<ObjectId>;
1484
1500
  getByUserId: (user: string | ObjectId) => Promise<TAddress | null>;
1501
+ getByOrgId: (org: string | ObjectId) => Promise<TAddress | null>;
1502
+ updateById: (_id: string | ObjectId, value: Pick<TAddress, "country" | "city" | "address" | "continuedAddress" | "province" | "postalCode" | "taxId">, session?: ClientSession) => Promise<string>;
1485
1503
  };
1486
1504
 
1487
1505
  declare function useAddressController(): {
1488
1506
  add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1489
1507
  getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1508
+ getByOrgId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1509
+ updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1490
1510
  };
1491
1511
 
1492
1512
  declare function useOrgRepo(): {
@@ -2600,4 +2620,4 @@ declare const PAYPAL_API_URL: string;
2600
2620
  declare const XENDIT_SECRET_KEY: string;
2601
2621
  declare const XENDIT_BASE_URL: string;
2602
2622
 
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 };
2623
+ 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 };