@goweekdays/core 0.0.21 → 0.1.1

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.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c66ec60: Paypal integration patch
8
+
9
+ ## 0.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 2018818: Add paypal integration
14
+
15
+ ## 0.0.22
16
+
17
+ ### Patch Changes
18
+
19
+ - cf1bf01: add invoice payment
20
+
3
21
  ## 0.0.21
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -827,8 +827,8 @@ type TSubscription = {
827
827
  _id?: ObjectId;
828
828
  user?: ObjectId | string;
829
829
  org?: ObjectId | string;
830
- customerId: string;
831
- paymentMethodId: string;
830
+ customerId?: string;
831
+ paymentMethodId?: string;
832
832
  amount: number;
833
833
  description?: string;
834
834
  currency: string;
@@ -934,6 +934,27 @@ declare const addressSchema: Joi.ObjectSchema<any>;
934
934
  declare function MAddress(value: any): TAddress;
935
935
 
936
936
  declare function useSubscriptionService(): {
937
+ subscribe: (value: {
938
+ user: string;
939
+ currency: string;
940
+ perSeatPrice: number;
941
+ seats: number;
942
+ transactionId: string;
943
+ promoCode?: string | undefined;
944
+ org: {
945
+ name: string;
946
+ type: string;
947
+ email: string;
948
+ busInst?: string;
949
+ contact: string;
950
+ description: string;
951
+ };
952
+ }) => Promise<{
953
+ message: string;
954
+ data: {
955
+ org: string;
956
+ };
957
+ }>;
937
958
  getByUserId: (id: string) => Promise<any>;
938
959
  getStatusByUser: (user: string) => Promise<string>;
939
960
  createAffiliateSubscription: (value: {
@@ -979,9 +1000,11 @@ declare function useSubscriptionService(): {
979
1000
  seats: number;
980
1001
  amount: number;
981
1002
  }) => Promise<void>;
1003
+ processSubscriptionPayment: (invoiceNumber: string, subscriptionId: string) => Promise<void>;
982
1004
  };
983
1005
 
984
1006
  declare function useSubscriptionController(): {
1007
+ subscribe: (req: Request, res: Response, next: NextFunction) => Promise<void>;
985
1008
  add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
986
1009
  getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
987
1010
  getByOrgId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -998,6 +1021,7 @@ declare function useSubscriptionController(): {
998
1021
  addBillingContactById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
999
1022
  updateBillingContactByAddedAt: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1000
1023
  deleteBillingContactByAddedAt: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1024
+ processSubscriptionPayment: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1001
1025
  };
1002
1026
 
1003
1027
  declare const CustomerSchema: z.ZodEffects<z.ZodObject<{
@@ -1427,6 +1451,8 @@ declare function useXenditService(): {
1427
1451
  eWalletLinkOnly: (value: Record<string, any>) => Promise<any>;
1428
1452
  directDebitLinkOnly: (value: Record<string, any>) => Promise<any>;
1429
1453
  cardLinkOnly: (value: Record<string, any>) => Promise<any>;
1454
+ getPaymentMethodsByCustomerId: (customerId: string) => Promise<any>;
1455
+ updatePaymentMethodStatusById: (id: string, status: string) => Promise<any>;
1430
1456
  };
1431
1457
 
1432
1458
  type TPaymentMethod$1 = {
@@ -1490,6 +1516,8 @@ declare function usePaymentMethodController(): {
1490
1516
  getByOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1491
1517
  linkOnly: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1492
1518
  getPaymentMethodById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1519
+ getPaymentMethodsByCustomerId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1520
+ updatePaymentMethodStatusById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1493
1521
  };
1494
1522
 
1495
1523
  declare function useAddressRepo(): {
@@ -1497,7 +1525,7 @@ declare function useAddressRepo(): {
1497
1525
  add: (value: TAddress, session?: ClientSession) => Promise<ObjectId>;
1498
1526
  getByUserId: (user: string | ObjectId) => Promise<TAddress | null>;
1499
1527
  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>;
1528
+ updateById: (_id: string | ObjectId, value: Pick<TAddress, "org" | "country" | "city" | "address" | "continuedAddress" | "province" | "postalCode" | "taxId">, session?: ClientSession) => Promise<string>;
1501
1529
  };
1502
1530
 
1503
1531
  declare function useAddressController(): {
@@ -1741,6 +1769,7 @@ declare const TInvoice: z.ZodObject<{
1741
1769
  seats?: number | undefined;
1742
1770
  }>, "many">;
1743
1771
  metadata: z.ZodEffects<z.ZodOptional<z.ZodDefault<z.ZodObject<{
1772
+ transactionId: z.ZodOptional<z.ZodString>;
1744
1773
  userId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1745
1774
  orgId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1746
1775
  billingCycle: z.ZodOptional<z.ZodEnum<["monthly", "yearly", "quarterly"]>>;
@@ -1751,6 +1780,7 @@ declare const TInvoice: z.ZodObject<{
1751
1780
  description?: string | undefined;
1752
1781
  userId?: string | ObjectId | undefined;
1753
1782
  orgId?: string | ObjectId | undefined;
1783
+ transactionId?: string | undefined;
1754
1784
  currency?: string | undefined;
1755
1785
  subscriptionId?: string | ObjectId | undefined;
1756
1786
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1758,6 +1788,7 @@ declare const TInvoice: z.ZodObject<{
1758
1788
  description?: string | undefined;
1759
1789
  userId?: string | ObjectId | undefined;
1760
1790
  orgId?: string | ObjectId | undefined;
1791
+ transactionId?: string | undefined;
1761
1792
  currency?: string | undefined;
1762
1793
  subscriptionId?: string | ObjectId | undefined;
1763
1794
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1765,6 +1796,7 @@ declare const TInvoice: z.ZodObject<{
1765
1796
  description?: string | undefined;
1766
1797
  userId?: string | ObjectId | undefined;
1767
1798
  orgId?: string | ObjectId | undefined;
1799
+ transactionId?: string | undefined;
1768
1800
  currency?: string | undefined;
1769
1801
  subscriptionId?: string | ObjectId | undefined;
1770
1802
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1772,6 +1804,7 @@ declare const TInvoice: z.ZodObject<{
1772
1804
  description?: string | undefined;
1773
1805
  userId?: string | ObjectId | undefined;
1774
1806
  orgId?: string | ObjectId | undefined;
1807
+ transactionId?: string | undefined;
1775
1808
  currency?: string | undefined;
1776
1809
  subscriptionId?: string | ObjectId | undefined;
1777
1810
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1797,6 +1830,7 @@ declare const TInvoice: z.ZodObject<{
1797
1830
  description?: string | undefined;
1798
1831
  userId?: string | ObjectId | undefined;
1799
1832
  orgId?: string | ObjectId | undefined;
1833
+ transactionId?: string | undefined;
1800
1834
  currency?: string | undefined;
1801
1835
  subscriptionId?: string | ObjectId | undefined;
1802
1836
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1821,6 +1855,7 @@ declare const TInvoice: z.ZodObject<{
1821
1855
  description?: string | undefined;
1822
1856
  userId?: string | ObjectId | undefined;
1823
1857
  orgId?: string | ObjectId | undefined;
1858
+ transactionId?: string | undefined;
1824
1859
  currency?: string | undefined;
1825
1860
  subscriptionId?: string | ObjectId | undefined;
1826
1861
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1849,6 +1884,7 @@ declare function useInvoiceModel(db: Db): {
1849
1884
  description?: string | undefined;
1850
1885
  userId?: string | ObjectId | undefined;
1851
1886
  orgId?: string | ObjectId | undefined;
1887
+ transactionId?: string | undefined;
1852
1888
  currency?: string | undefined;
1853
1889
  subscriptionId?: string | ObjectId | undefined;
1854
1890
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1880,6 +1916,7 @@ declare function useInvoiceRepo(): {
1880
1916
  description?: string | undefined;
1881
1917
  userId?: string | ObjectId | undefined;
1882
1918
  orgId?: string | ObjectId | undefined;
1919
+ transactionId?: string | undefined;
1883
1920
  currency?: string | undefined;
1884
1921
  subscriptionId?: string | ObjectId | undefined;
1885
1922
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1906,6 +1943,7 @@ declare function useInvoiceRepo(): {
1906
1943
  description?: string | undefined;
1907
1944
  userId?: string | ObjectId | undefined;
1908
1945
  orgId?: string | ObjectId | undefined;
1946
+ transactionId?: string | undefined;
1909
1947
  currency?: string | undefined;
1910
1948
  subscriptionId?: string | ObjectId | undefined;
1911
1949
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1942,6 +1980,7 @@ declare function useInvoiceRepo(): {
1942
1980
  description?: string | undefined;
1943
1981
  userId?: string | ObjectId | undefined;
1944
1982
  orgId?: string | ObjectId | undefined;
1983
+ transactionId?: string | undefined;
1945
1984
  currency?: string | undefined;
1946
1985
  subscriptionId?: string | ObjectId | undefined;
1947
1986
  billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
@@ -1960,13 +1999,13 @@ declare function useInvoiceController(): {
1960
1999
  getByDueDateStatus: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1961
2000
  };
1962
2001
 
1963
- declare const TPaymentMethod: z.ZodEnum<["CARD", "DIRECT_DEBIT", "VIRTUAL_ACCOUNT", "EWALLET", "OVER_THE_COUNTER", "QR_CODE"]>;
2002
+ declare const TPaymentMethod: z.ZodEnum<["CARD", "DIRECT_DEBIT", "VIRTUAL_ACCOUNT", "EWALLET", "OVER_THE_COUNTER", "QR_CODE", "PAYPAL"]>;
1964
2003
  type TPaymentMethodType = z.infer<typeof TPaymentMethod>;
1965
2004
  declare const TPayment: z.ZodObject<{
1966
2005
  _id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1967
2006
  invoiceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1968
2007
  amount: z.ZodNumber;
1969
- paymentMethod: z.ZodEnum<["CARD", "DIRECT_DEBIT", "VIRTUAL_ACCOUNT", "EWALLET", "OVER_THE_COUNTER", "QR_CODE"]>;
2008
+ paymentMethod: z.ZodEnum<["CARD", "DIRECT_DEBIT", "VIRTUAL_ACCOUNT", "EWALLET", "OVER_THE_COUNTER", "QR_CODE", "PAYPAL"]>;
1970
2009
  status: z.ZodEnum<["pending", "completed", "failed", "refunded"]>;
1971
2010
  metadata: z.ZodEffects<z.ZodObject<{
1972
2011
  userId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
@@ -2034,7 +2073,7 @@ declare const TPayment: z.ZodObject<{
2034
2073
  payment?: string | undefined;
2035
2074
  subscriptionId?: string | ObjectId | undefined;
2036
2075
  };
2037
- paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER";
2076
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2038
2077
  invoiceId: string;
2039
2078
  amount: number;
2040
2079
  _id?: string | ObjectId | undefined;
@@ -2053,7 +2092,7 @@ declare const TPayment: z.ZodObject<{
2053
2092
  payment?: string | undefined;
2054
2093
  subscriptionId?: string | ObjectId | undefined;
2055
2094
  };
2056
- paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER";
2095
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2057
2096
  amount: number;
2058
2097
  _id?: string | ObjectId | undefined;
2059
2098
  updatedAt?: Date | undefined;
@@ -2316,7 +2355,7 @@ declare function usePaymentModel(db: Db): {
2316
2355
  payment?: string | undefined;
2317
2356
  subscriptionId?: string | ObjectId | undefined;
2318
2357
  };
2319
- paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER";
2358
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2320
2359
  invoiceId: string;
2321
2360
  amount: number;
2322
2361
  _id?: string | ObjectId | undefined;
@@ -2336,7 +2375,7 @@ declare function usePaymentModel(db: Db): {
2336
2375
  payment?: string | undefined;
2337
2376
  subscriptionId?: string | ObjectId | undefined;
2338
2377
  };
2339
- paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER";
2378
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2340
2379
  invoiceId: string;
2341
2380
  amount: number;
2342
2381
  _id?: string | ObjectId | undefined;
@@ -2356,7 +2395,7 @@ declare function usePaymentModel(db: Db): {
2356
2395
  payment?: string | undefined;
2357
2396
  subscriptionId?: string | ObjectId | undefined;
2358
2397
  };
2359
- paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER";
2398
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2360
2399
  invoiceId: string;
2361
2400
  amount: number;
2362
2401
  _id?: string | ObjectId | undefined;
@@ -2395,7 +2434,7 @@ declare function usePaymentRepo(): {
2395
2434
  payment?: string | undefined;
2396
2435
  subscriptionId?: string | ObjectId | undefined;
2397
2436
  };
2398
- paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER";
2437
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2399
2438
  invoiceId: string;
2400
2439
  amount: number;
2401
2440
  _id?: string | ObjectId | undefined;