@goweekdays/core 0.0.4 → 0.0.5

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
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 1bf704a: Implement org subscription
8
+
3
9
  ## 0.0.4
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ type TVerificationMetadata = {
9
9
  app?: string;
10
10
  role?: string;
11
11
  referralCode?: string;
12
+ org?: string | ObjectId;
12
13
  };
13
14
  type TVerification = {
14
15
  _id?: ObjectId;
@@ -33,15 +34,17 @@ declare class MVerification implements TVerification {
33
34
  }
34
35
 
35
36
  declare function useVerificationRepo(): {
37
+ createIndex: () => Promise<void>;
36
38
  createTextIndex: () => Promise<void>;
37
39
  add: (value: TVerification, session?: ClientSession) => Promise<ObjectId>;
38
- getVerifications: ({ search, page, limit, sort, status, type, }?: {
40
+ getVerifications: ({ search, page, limit, sort, status, type, email, }?: {
39
41
  search?: string | undefined;
40
42
  page?: number | undefined;
41
43
  limit?: number | undefined;
42
44
  sort?: {} | undefined;
43
45
  status?: string | undefined;
44
46
  type?: string | undefined;
47
+ email?: string | undefined;
45
48
  }) => Promise<{
46
49
  items: any[];
47
50
  pages: number;
@@ -66,11 +69,12 @@ declare function useVerificationService(): {
66
69
  message: string;
67
70
  }>;
68
71
  getById: (id: string) => Promise<TVerification>;
69
- getVerifications: ({ search, page, status, type, limit, }?: {
72
+ getVerifications: ({ search, page, status, type, email, limit, }?: {
70
73
  search?: string | undefined;
71
74
  page?: number | undefined;
72
75
  status?: string | undefined;
73
76
  type?: string | undefined;
77
+ email?: string | undefined;
74
78
  limit?: number | undefined;
75
79
  }) => Promise<{
76
80
  items: any[];
@@ -301,7 +305,9 @@ declare function useAuthController(): {
301
305
 
302
306
  type TRole = {
303
307
  _id?: ObjectId;
308
+ org?: string | ObjectId;
304
309
  name?: string;
310
+ description?: string;
305
311
  permissions?: Array<string>;
306
312
  type?: string;
307
313
  status?: string;
@@ -313,7 +319,9 @@ type TRole = {
313
319
  type TMiniRole = Pick<TRole, "name" | "permissions">;
314
320
  declare class MRole implements TRole {
315
321
  _id: ObjectId;
322
+ org: string | ObjectId;
316
323
  name?: string;
324
+ description?: string;
317
325
  permissions?: Array<string>;
318
326
  type?: string;
319
327
  status?: string;
@@ -812,7 +820,8 @@ declare function useCommentController(): {
812
820
 
813
821
  type TSubscription = {
814
822
  _id?: ObjectId;
815
- user: ObjectId | string;
823
+ user?: ObjectId | string;
824
+ org?: ObjectId | string;
816
825
  subscriptionId: string;
817
826
  status?: string;
818
827
  createdAt?: string;
@@ -824,7 +833,7 @@ declare function MSubscription(value: TSubscription): TSubscription;
824
833
  declare function useSubscriptionRepo(): {
825
834
  createIndex: () => Promise<void>;
826
835
  createUniqueIndex: () => Promise<void>;
827
- add: (value: TSubscription) => Promise<ObjectId>;
836
+ add: (value: TSubscription, session?: ClientSession) => Promise<ObjectId>;
828
837
  getById: (_id: string | ObjectId) => Promise<TSubscription | null>;
829
838
  getBySubscriptionId: (subscriptionId: string) => Promise<TSubscription | null>;
830
839
  getByUserId: (user: string | ObjectId) => Promise<TSubscription | null>;
@@ -842,12 +851,53 @@ declare function useSubscriptionRepo(): {
842
851
  updateStatus: (_id: string | ObjectId, status: string) => Promise<string>;
843
852
  };
844
853
 
854
+ type TOrg = {
855
+ _id?: ObjectId;
856
+ name: string;
857
+ description: string;
858
+ type?: string;
859
+ email?: string;
860
+ contact?: string;
861
+ busInst?: string;
862
+ status?: string;
863
+ createdAt?: string;
864
+ updatedAt?: string;
865
+ deletedAt?: string;
866
+ };
867
+ declare function MOrg(value: TOrg): TOrg;
868
+
869
+ type TAddress = {
870
+ _id?: ObjectId;
871
+ type: string;
872
+ user: ObjectId | string;
873
+ org?: ObjectId | string;
874
+ country: string;
875
+ address: string;
876
+ continuedAddress?: string;
877
+ city: string;
878
+ province: string;
879
+ postalCode: string;
880
+ taxId: string;
881
+ };
882
+ declare function MAddress(value: any): TAddress;
883
+
845
884
  declare function useSubscriptionService(): {
846
885
  getByUserId: (id: string) => Promise<TSubscription>;
847
- getSubscriptionStatus: (subscriptionId: string) => Promise<any>;
848
- cancelSubscription: (subscriptionId: string) => Promise<{
849
- message: string;
850
- }>;
886
+ getStatusByUser: (user: string) => Promise<string>;
887
+ createAffiliateSubscription: ({ user, amount, payment_method_id, customer_id, }?: {
888
+ user?: string | undefined;
889
+ amount?: number | undefined;
890
+ payment_method_id?: string | undefined;
891
+ customer_id?: string | undefined;
892
+ }) => Promise<string>;
893
+ createOrgSubscription: (value: {
894
+ user: string;
895
+ amount: number;
896
+ payment_method_id: string;
897
+ customer_id: string;
898
+ organization: TOrg;
899
+ billingAddress: TAddress;
900
+ }) => Promise<string>;
851
901
  };
852
902
 
853
903
  declare function useSubscriptionController(): {
@@ -855,7 +905,199 @@ declare function useSubscriptionController(): {
855
905
  getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
856
906
  getSubscriptions: (req: Request, res: Response, next: NextFunction) => Promise<void>;
857
907
  getSubscriptionStatus: (req: Request, res: Response, next: NextFunction) => Promise<void>;
858
- cancelSubscription: (req: Request, res: Response, next: NextFunction) => Promise<void>;
908
+ createAffiliateSubscription: (req: Request, res: Response, next: NextFunction) => Promise<void>;
909
+ createOrgSubscription: (req: Request, res: Response, next: NextFunction) => Promise<void>;
910
+ };
911
+
912
+ declare function useXenditService(): {
913
+ createCustomer: ({ mobile_number, email, type, given_names, surname, }?: {
914
+ mobile_number?: string | undefined;
915
+ email?: string | undefined;
916
+ type?: string | undefined;
917
+ given_names?: string | undefined;
918
+ surname?: string | undefined;
919
+ }) => Promise<any>;
920
+ linkPaymentMethodEWallet: ({ customerId, type, success_return_url, failure_return_url, cancel_return_url, }?: {
921
+ customerId?: string | undefined;
922
+ type?: string | undefined;
923
+ success_return_url?: string | undefined;
924
+ failure_return_url?: string | undefined;
925
+ cancel_return_url?: string | undefined;
926
+ }) => Promise<any>;
927
+ initGCashLinkingAndPaymentRequest: ({ amount, currency, countryCode, customerId, success_return_url, failure_return_url, }?: {
928
+ amount?: number | undefined;
929
+ currency?: string | undefined;
930
+ countryCode?: string | undefined;
931
+ customerId?: string | undefined;
932
+ success_return_url?: string | undefined;
933
+ failure_return_url?: string | undefined;
934
+ }) => Promise<any>;
935
+ initSubscription: ({ customer, currency, amount, paymentMethod, description, interval, }?: {
936
+ customer?: string | undefined;
937
+ currency?: string | undefined;
938
+ amount?: number | undefined;
939
+ paymentMethod?: string | undefined;
940
+ description?: string | undefined;
941
+ interval?: string | undefined;
942
+ }) => Promise<any>;
943
+ linkPaymentMethodCard: ({ success_return_url, failure_return_url, card_number, expiry_month, expiry_year, cvv, cardholder_name, currency, }?: {
944
+ success_return_url?: string | undefined;
945
+ failure_return_url?: string | undefined;
946
+ card_number?: string | undefined;
947
+ expiry_month?: string | undefined;
948
+ expiry_year?: string | undefined;
949
+ cvv?: string | undefined;
950
+ cardholder_name?: string | undefined;
951
+ currency?: string | undefined;
952
+ }) => Promise<any>;
953
+ eWalletSubsequentPayment: ({ amount, currency, payment_method_id, customer_id, description, }?: {
954
+ amount?: number | undefined;
955
+ currency?: string | undefined;
956
+ payment_method_id?: string | undefined;
957
+ customer_id?: string | undefined;
958
+ description?: string | undefined;
959
+ }) => Promise<any>;
960
+ checkSubscriptionStatus: (subscriptionId: string) => Promise<string>;
961
+ cancelSubscription: (subscriptionId: string) => Promise<string>;
962
+ };
963
+
964
+ type TPaymentMethod = {
965
+ _id?: ObjectId;
966
+ user?: ObjectId | string;
967
+ org?: ObjectId | string;
968
+ name: string;
969
+ description?: string;
970
+ type: string;
971
+ number: string;
972
+ expiry?: string;
973
+ cvv?: string;
974
+ paymentId: string;
975
+ customerId?: string;
976
+ status?: string;
977
+ createdAt?: string;
978
+ deletedAt?: string;
979
+ };
980
+ declare function MPaymentMethod(value: TPaymentMethod): TPaymentMethod;
981
+
982
+ declare function usePaymentMethodRepo(): {
983
+ createIndex: () => Promise<void>;
984
+ add: (value: TPaymentMethod, session?: ClientSession) => Promise<string>;
985
+ getByUser: (user: string | ObjectId) => Promise<bson.Document[]>;
986
+ deleteById: (_id: string | ObjectId) => Promise<string>;
987
+ createUniqueIndex: () => Promise<void>;
988
+ getByPaymentMethodId: (paymentId: string | ObjectId) => Promise<TPaymentMethod | null>;
989
+ };
990
+
991
+ declare function usePaymentMethodService(): {
992
+ linkEWallet: ({ user, mobile_number, type, success_return_url, failure_return_url, cancel_return_url, }?: {
993
+ user?: string | undefined;
994
+ mobile_number?: string | undefined;
995
+ type?: string | undefined;
996
+ success_return_url?: string | undefined;
997
+ failure_return_url?: string | undefined;
998
+ cancel_return_url?: string | undefined;
999
+ }) => Promise<any>;
1000
+ linkCard: ({ user, type, success_return_url, failure_return_url, card_number, expiry_month, expiry_year, cvv, cardholder_name, currency, }?: {
1001
+ user?: string | undefined;
1002
+ type?: string | undefined;
1003
+ success_return_url?: string | undefined;
1004
+ failure_return_url?: string | undefined;
1005
+ card_number?: string | undefined;
1006
+ expiry_month?: string | undefined;
1007
+ expiry_year?: string | undefined;
1008
+ cvv?: string | undefined;
1009
+ cardholder_name?: string | undefined;
1010
+ currency?: string | undefined;
1011
+ }) => Promise<any>;
1012
+ };
1013
+
1014
+ declare function usePaymentMethodController(): {
1015
+ linkEWalletController: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1016
+ getByUser: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1017
+ };
1018
+
1019
+ declare function useAddressRepo(): {
1020
+ createIndex: () => Promise<void>;
1021
+ add: (value: TAddress, session?: ClientSession) => Promise<ObjectId>;
1022
+ getByUserId: (user: string | ObjectId) => Promise<TAddress | null>;
1023
+ };
1024
+
1025
+ declare function useAddressController(): {
1026
+ add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1027
+ getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1028
+ };
1029
+
1030
+ declare function useOrgRepo(): {
1031
+ createIndex: () => Promise<void>;
1032
+ createTextIndex: () => Promise<void>;
1033
+ createUniqueIndex: () => Promise<void>;
1034
+ add: (value: TOrg, session?: ClientSession) => Promise<ObjectId>;
1035
+ getOrgs: ({ search, page, limit, sort, status, }?: {
1036
+ search?: string | undefined;
1037
+ page?: number | undefined;
1038
+ limit?: number | undefined;
1039
+ sort?: {} | undefined;
1040
+ status?: string | undefined;
1041
+ }) => Promise<{
1042
+ items: any[];
1043
+ pages: number;
1044
+ pageRange: string;
1045
+ }>;
1046
+ getById: (_id: string | ObjectId) => Promise<TOrg>;
1047
+ updateFieldById: ({ _id, field, value }?: {
1048
+ _id: string | ObjectId;
1049
+ field: string;
1050
+ value: string;
1051
+ }, session?: ClientSession) => Promise<string>;
1052
+ deleteById: (_id: string | ObjectId) => Promise<string>;
1053
+ };
1054
+
1055
+ declare function useOrgService(): {
1056
+ createOrg: ({ user, name, description }?: {
1057
+ user?: string | undefined;
1058
+ name?: string | undefined;
1059
+ description?: string | undefined;
1060
+ }) => Promise<string>;
1061
+ };
1062
+
1063
+ declare function useOrgController(): {
1064
+ createOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1065
+ getOrgsByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1066
+ };
1067
+
1068
+ type TMember = {
1069
+ _id?: ObjectId;
1070
+ org: string | ObjectId;
1071
+ name: string;
1072
+ user: string | ObjectId;
1073
+ role: string | ObjectId;
1074
+ status?: string;
1075
+ createdAt?: string;
1076
+ updatedAt?: string;
1077
+ deletedAt?: string;
1078
+ };
1079
+ declare function MMember(value: TMember): TMember;
1080
+
1081
+ declare function useMemberRepo(): {
1082
+ createIndex: () => Promise<void>;
1083
+ createUniqueIndex: () => Promise<void>;
1084
+ createTextIndex: () => Promise<void>;
1085
+ add: (value: TMember, session?: ClientSession) => Promise<string>;
1086
+ getById: (_id: string | ObjectId) => Promise<TMember | null>;
1087
+ getByOrgId: (org: string | ObjectId) => Promise<TMember[]>;
1088
+ getOrgsByUserId: ({ search, page, limit, sort, user, status, }?: {
1089
+ user: string | ObjectId;
1090
+ page: number;
1091
+ limit?: number | undefined;
1092
+ search?: string | undefined;
1093
+ sort?: Record<string, number> | undefined;
1094
+ status?: string | undefined;
1095
+ }) => Promise<{
1096
+ items: any[];
1097
+ pages: number;
1098
+ pageRange: string;
1099
+ }>;
1100
+ updateStatusByUserId: (user: string | ObjectId, status: string) => Promise<string>;
859
1101
  };
860
1102
 
861
1103
  declare const MONGO_URI: string;
@@ -891,5 +1133,7 @@ declare const SPACES_BUCKET: string;
891
1133
  declare const PAYPAL_CLIENT_ID: string;
892
1134
  declare const PAYPAL_CLIENT_SECRET: string;
893
1135
  declare const PAYPAL_API_URL: string;
1136
+ declare const XENDIT_SECRET_KEY: string;
1137
+ declare const XENDIT_BASE_URL: string;
894
1138
 
895
- export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MCapBldgAct, MComment, MEntity, MFile, MONGO_DB, MONGO_URI, 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, TAttachment, TCapBldgAct, TCapBldgActAssmtCriteria, TCapBldgActBasicInfo, TCapBldgActInitRevEval, TComment, TEntity, TFile, TMiniRole, TRole, TSubscription, TToken, TUser, TUserRole, TVerification, TVerificationMetadata, TWorkflow, TWorkflowStep, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, isDev, useAuthController, useAuthService, useCapBldgActController, useCapBldgActRepo, useCapBldgActService, useCommentController, useCommentRepo, useCommentService, useEntityController, useEntityRepo, useEntityService, useFileController, useFileRepo, useFileService, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useTokenRepo, useUserController, useUserRepo, useUserService, useVerificationController, useVerificationRepo, useVerificationService, useWorkflowController, useWorkflowRepo, useWorkflowService };
1139
+ export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MCapBldgAct, MComment, MEntity, MFile, MMember, MONGO_DB, MONGO_URI, MOrg, MPaymentMethod, 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, TEntity, TFile, TMember, TMiniRole, TOrg, TPaymentMethod, TRole, TSubscription, TToken, TUser, TUserRole, TVerification, TVerificationMetadata, TWorkflow, TWorkflowStep, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, isDev, useAddressController, useAddressRepo, useAuthController, useAuthService, useCapBldgActController, useCapBldgActRepo, useCapBldgActService, useCommentController, useCommentRepo, useCommentService, useEntityController, useEntityRepo, useEntityService, useFileController, useFileRepo, useFileService, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePaymentMethodController, usePaymentMethodRepo, usePaymentMethodService, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useTokenRepo, useUserController, useUserRepo, useUserService, useVerificationController, useVerificationRepo, useVerificationService, useWorkflowController, useWorkflowRepo, useWorkflowService, useXenditService };