@goweekdays/core 2.10.2 → 2.11.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,11 @@
1
1
  # @goweekdays/core
2
2
 
3
+ ## 2.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - eaba24c: implement subscription seats and promo code update
8
+
3
9
  ## 2.10.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -843,9 +843,19 @@ type TSubscription = {
843
843
  createdAt?: Date | string;
844
844
  updatedAt?: Date | string;
845
845
  };
846
+ declare const schemaSubscriptionCompute: Joi.ObjectSchema<any>;
847
+ declare const schemaSubscribe: Joi.ObjectSchema<any>;
848
+ type TSubscribe = {
849
+ seats: number;
850
+ plan: string;
851
+ promoCode?: string;
852
+ org: string;
853
+ user: string;
854
+ };
846
855
  declare const schemaSubscription: Joi.ObjectSchema<any>;
847
856
  declare const schemaSubscriptionUpdate: Joi.ObjectSchema<any>;
848
857
  declare const schemaSubscriptionSeats: Joi.ObjectSchema<any>;
858
+ declare const schemaSubscriptionPromoCode: Joi.ObjectSchema<any>;
849
859
  declare function modelSubscription(data: any): TSubscription;
850
860
 
851
861
  declare function useSubscriptionRepo(): {
@@ -875,18 +885,33 @@ declare function useSubscriptionRepo(): {
875
885
  };
876
886
 
877
887
  declare function useSubscriptionController(): {
888
+ computeFee: (req: Request, res: Response, next: NextFunction) => Promise<void>;
889
+ add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
878
890
  getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
879
891
  getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
880
892
  getByOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
881
893
  updateSeats: (req: Request, res: Response, next: NextFunction) => Promise<void>;
894
+ updatePromoCode: (req: Request, res: Response, next: NextFunction) => Promise<void>;
882
895
  };
883
896
 
884
897
  declare function useSubscriptionService(): {
885
- updateSeats: ({ id, user, amount, seats, }?: {
886
- id?: string | undefined;
887
- user?: string | undefined;
888
- amount?: number | undefined;
889
- seats?: number | undefined;
898
+ add: (value: TSubscribe) => Promise<string>;
899
+ computeFee: (value: {
900
+ seats: number;
901
+ promoCode?: string;
902
+ org: string;
903
+ plan: string;
904
+ }) => Promise<{
905
+ monthlyAmount: number;
906
+ proratedAmount: number;
907
+ subscriptionAmount: number;
908
+ currency: string;
909
+ }>;
910
+ updateSeats: (value: TSubscribe) => Promise<string>;
911
+ updatePromoCode: (value: {
912
+ org: string;
913
+ promoCode?: string;
914
+ user: string;
890
915
  }) => Promise<string>;
891
916
  processInvoices: () => Promise<void>;
892
917
  processSuspensions: () => Promise<void>;
@@ -900,7 +925,7 @@ type TSubscriptionTransaction = {
900
925
  subscription: string | ObjectId;
901
926
  amount: number;
902
927
  currency: string;
903
- type: "initiate" | "add-seat" | "remove-seat" | "renewal";
928
+ type: "initiate" | "add-seat" | "remove-seat" | "renewal" | "promo-applied" | "promo-removed" | "promo-expired" | "promo-updated";
904
929
  description?: string;
905
930
  createdBy: string | ObjectId;
906
931
  createdByName?: string;
@@ -1229,4 +1254,4 @@ declare const XENDIT_BASE_URL: string;
1229
1254
  declare const DOMAIN: string;
1230
1255
  declare const APP_ORG: string;
1231
1256
 
1232
- export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, APP_ORG, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PAYPAL_WEBHOOK_ID, PORT, PaypalWebhookHeaders, 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, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TJobPost, TLedgerBill, TMember, TOrg, TPermission, TPermissionGroup, TPlan, TPromo, TRole, TSubscription, TSubscriptionTransaction, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, currencies, isDev, ledgerBillStatuses, ledgerBillTypes, modelApp, modelJobPost, modelLedgerBill, modelMember, modelOrg, modelPermission, modelPermissionGroup, modelPlan, modelPromo, modelRole, modelSubscription, modelSubscriptionTransaction, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaJobPost, schemaJobPostUpdate, schemaLedgerBill, schemaLedgerBillingSummary, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaOrgAdd, schemaOrgUpdate, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaPlan, schemaPromo, schemaRole, schemaRoleUpdate, schemaSubscription, schemaSubscriptionSeats, schemaSubscriptionTransaction, schemaSubscriptionUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useJobPostController, useJobPostRepo, useJobPostService, useLedgerBillingController, useLedgerBillingRepo, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePaypalService, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, usePlanController, usePlanRepo, usePlanService, usePromoController, usePromoRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useSubscriptionTransactionController, useSubscriptionTransactionRepo, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
1257
+ export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, APP_ORG, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PAYPAL_WEBHOOK_ID, PORT, PaypalWebhookHeaders, 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, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TJobPost, TLedgerBill, TMember, TOrg, TPermission, TPermissionGroup, TPlan, TPromo, TRole, TSubscribe, TSubscription, TSubscriptionTransaction, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, currencies, isDev, ledgerBillStatuses, ledgerBillTypes, modelApp, modelJobPost, modelLedgerBill, modelMember, modelOrg, modelPermission, modelPermissionGroup, modelPlan, modelPromo, modelRole, modelSubscription, modelSubscriptionTransaction, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaJobPost, schemaJobPostUpdate, schemaLedgerBill, schemaLedgerBillingSummary, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaOrgAdd, schemaOrgUpdate, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaPlan, schemaPromo, schemaRole, schemaRoleUpdate, schemaSubscribe, schemaSubscription, schemaSubscriptionCompute, schemaSubscriptionPromoCode, schemaSubscriptionSeats, schemaSubscriptionTransaction, schemaSubscriptionUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useJobPostController, useJobPostRepo, useJobPostService, useLedgerBillingController, useLedgerBillingRepo, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePaypalService, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, usePlanController, usePlanRepo, usePlanService, usePromoController, usePromoRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useSubscriptionTransactionController, useSubscriptionTransactionRepo, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };