@amohamud23/notihub 1.1.46 → 1.1.48

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/dist/index.cjs CHANGED
@@ -1833,13 +1833,13 @@ var StripeSubscription = class _StripeSubscription {
1833
1833
  * @param customer - The customer ID to retrieve subscriptions for.
1834
1834
  * @returns A promise that resolves to an array of stripe subscription objects.
1835
1835
  */
1836
- static async getStripeSubscriptionsByCustomerId(customerId) {
1836
+ static async getStripeSubscriptionsByCustomerId(stripe_customerId) {
1837
1837
  const command = new import_lib_dynamodb15.QueryCommand({
1838
1838
  TableName: _StripeSubscription.TABLE_NAME,
1839
- IndexName: "CustomerIndex",
1840
- KeyConditionExpression: "customerId = :customerId",
1839
+ IndexName: "StripeCustomerIdIndex",
1840
+ KeyConditionExpression: "stripe_customerId = :stripe_customerId",
1841
1841
  ExpressionAttributeValues: {
1842
- ":customerId": customerId
1842
+ ":stripe_customerId": stripe_customerId
1843
1843
  }
1844
1844
  });
1845
1845
  try {
@@ -1847,7 +1847,7 @@ var StripeSubscription = class _StripeSubscription {
1847
1847
  return result.Items || [];
1848
1848
  } catch (error) {
1849
1849
  console.error(
1850
- `Error fetching stripe subscriptions for customerId: ${customerId}`,
1850
+ `Error fetching stripe subscriptions for stripe_customerId: ${stripe_customerId}`,
1851
1851
  error
1852
1852
  );
1853
1853
  throw new Error("Could not fetch stripe subscriptions by customerId");
@@ -1962,10 +1962,10 @@ var PaymentSession = class _PaymentSession {
1962
1962
  throw new Error("Could not create payment session");
1963
1963
  }
1964
1964
  }
1965
- static async getPaymentSessionById(id) {
1965
+ static async getPaymentSessionById(sessionId) {
1966
1966
  const command = new import_lib_dynamodb16.GetCommand({
1967
1967
  TableName: _PaymentSession.TABLE_NAME,
1968
- Key: { id }
1968
+ Key: { sessionId }
1969
1969
  });
1970
1970
  try {
1971
1971
  const result = await ddbDocClient.send(command);
@@ -1991,26 +1991,6 @@ var PaymentSession = class _PaymentSession {
1991
1991
  throw new Error("Could not update payment session");
1992
1992
  }
1993
1993
  }
1994
- static async getPaymentSessionBySessionId(sessionId) {
1995
- const command = new import_lib_dynamodb16.QueryCommand({
1996
- TableName: _PaymentSession.TABLE_NAME,
1997
- IndexName: "SessionIdIndex",
1998
- KeyConditionExpression: "sessionId = :sessionId",
1999
- ExpressionAttributeValues: {
2000
- ":sessionId": sessionId
2001
- }
2002
- });
2003
- try {
2004
- const result = await ddbDocClient.send(command);
2005
- if (!result.Items || result.Items.length === 0) {
2006
- return null;
2007
- }
2008
- return result.Items[0] || null;
2009
- } catch (error) {
2010
- console.error("Error fetching payment session:", error);
2011
- throw new Error("Could not fetch payment session");
2012
- }
2013
- }
2014
1994
  };
2015
1995
  var PaymentSession_default = PaymentSession;
2016
1996
 
package/dist/index.d.cts CHANGED
@@ -732,7 +732,7 @@ declare class StripeSubscription {
732
732
  * @param customer - The customer ID to retrieve subscriptions for.
733
733
  * @returns A promise that resolves to an array of stripe subscription objects.
734
734
  */
735
- static getStripeSubscriptionsByCustomerId(customerId: string): Promise<INotiHubStripeSubscription[]>;
735
+ static getStripeSubscriptionsByCustomerId(stripe_customerId: string): Promise<INotiHubStripeSubscription[]>;
736
736
  static getStripeSubscriptionsByStripeCustomerId(stripeCustomerId: string): Promise<INotiHubStripeSubscription | null>;
737
737
  /**
738
738
  * Creates a new stripe subscription.
@@ -759,9 +759,8 @@ declare class PaymentSession {
759
759
  static ENV: string;
760
760
  static TABLE_NAME: string;
761
761
  static createPaymentSession(paymentSession: INotiHubPaymentSession): Promise<INotiHubPaymentSession>;
762
- static getPaymentSessionById(id: string): Promise<INotiHubPaymentSession>;
762
+ static getPaymentSessionById(sessionId: string): Promise<INotiHubPaymentSession>;
763
763
  static updatePaymentSession(id: string, intent: string): Promise<void>;
764
- static getPaymentSessionBySessionId(sessionId: string): Promise<INotiHubPaymentSession | null>;
765
764
  }
766
765
 
767
766
  declare const TABLES: {
package/dist/index.d.ts CHANGED
@@ -732,7 +732,7 @@ declare class StripeSubscription {
732
732
  * @param customer - The customer ID to retrieve subscriptions for.
733
733
  * @returns A promise that resolves to an array of stripe subscription objects.
734
734
  */
735
- static getStripeSubscriptionsByCustomerId(customerId: string): Promise<INotiHubStripeSubscription[]>;
735
+ static getStripeSubscriptionsByCustomerId(stripe_customerId: string): Promise<INotiHubStripeSubscription[]>;
736
736
  static getStripeSubscriptionsByStripeCustomerId(stripeCustomerId: string): Promise<INotiHubStripeSubscription | null>;
737
737
  /**
738
738
  * Creates a new stripe subscription.
@@ -759,9 +759,8 @@ declare class PaymentSession {
759
759
  static ENV: string;
760
760
  static TABLE_NAME: string;
761
761
  static createPaymentSession(paymentSession: INotiHubPaymentSession): Promise<INotiHubPaymentSession>;
762
- static getPaymentSessionById(id: string): Promise<INotiHubPaymentSession>;
762
+ static getPaymentSessionById(sessionId: string): Promise<INotiHubPaymentSession>;
763
763
  static updatePaymentSession(id: string, intent: string): Promise<void>;
764
- static getPaymentSessionBySessionId(sessionId: string): Promise<INotiHubPaymentSession | null>;
765
764
  }
766
765
 
767
766
  declare const TABLES: {
package/dist/index.js CHANGED
@@ -1863,13 +1863,13 @@ var StripeSubscription = class _StripeSubscription {
1863
1863
  * @param customer - The customer ID to retrieve subscriptions for.
1864
1864
  * @returns A promise that resolves to an array of stripe subscription objects.
1865
1865
  */
1866
- static async getStripeSubscriptionsByCustomerId(customerId) {
1866
+ static async getStripeSubscriptionsByCustomerId(stripe_customerId) {
1867
1867
  const command = new QueryCommand13({
1868
1868
  TableName: _StripeSubscription.TABLE_NAME,
1869
- IndexName: "CustomerIndex",
1870
- KeyConditionExpression: "customerId = :customerId",
1869
+ IndexName: "StripeCustomerIdIndex",
1870
+ KeyConditionExpression: "stripe_customerId = :stripe_customerId",
1871
1871
  ExpressionAttributeValues: {
1872
- ":customerId": customerId
1872
+ ":stripe_customerId": stripe_customerId
1873
1873
  }
1874
1874
  });
1875
1875
  try {
@@ -1877,7 +1877,7 @@ var StripeSubscription = class _StripeSubscription {
1877
1877
  return result.Items || [];
1878
1878
  } catch (error) {
1879
1879
  console.error(
1880
- `Error fetching stripe subscriptions for customerId: ${customerId}`,
1880
+ `Error fetching stripe subscriptions for stripe_customerId: ${stripe_customerId}`,
1881
1881
  error
1882
1882
  );
1883
1883
  throw new Error("Could not fetch stripe subscriptions by customerId");
@@ -1978,7 +1978,6 @@ var StripeSubscriptions_default = StripeSubscription;
1978
1978
  import {
1979
1979
  GetCommand as GetCommand14,
1980
1980
  PutCommand as PutCommand15,
1981
- QueryCommand as QueryCommand14,
1982
1981
  UpdateCommand as UpdateCommand14
1983
1982
  } from "@aws-sdk/lib-dynamodb";
1984
1983
  var PaymentSession = class _PaymentSession {
@@ -1997,10 +1996,10 @@ var PaymentSession = class _PaymentSession {
1997
1996
  throw new Error("Could not create payment session");
1998
1997
  }
1999
1998
  }
2000
- static async getPaymentSessionById(id) {
1999
+ static async getPaymentSessionById(sessionId) {
2001
2000
  const command = new GetCommand14({
2002
2001
  TableName: _PaymentSession.TABLE_NAME,
2003
- Key: { id }
2002
+ Key: { sessionId }
2004
2003
  });
2005
2004
  try {
2006
2005
  const result = await ddbDocClient.send(command);
@@ -2026,26 +2025,6 @@ var PaymentSession = class _PaymentSession {
2026
2025
  throw new Error("Could not update payment session");
2027
2026
  }
2028
2027
  }
2029
- static async getPaymentSessionBySessionId(sessionId) {
2030
- const command = new QueryCommand14({
2031
- TableName: _PaymentSession.TABLE_NAME,
2032
- IndexName: "SessionIdIndex",
2033
- KeyConditionExpression: "sessionId = :sessionId",
2034
- ExpressionAttributeValues: {
2035
- ":sessionId": sessionId
2036
- }
2037
- });
2038
- try {
2039
- const result = await ddbDocClient.send(command);
2040
- if (!result.Items || result.Items.length === 0) {
2041
- return null;
2042
- }
2043
- return result.Items[0] || null;
2044
- } catch (error) {
2045
- console.error("Error fetching payment session:", error);
2046
- throw new Error("Could not fetch payment session");
2047
- }
2048
- }
2049
2028
  };
2050
2029
  var PaymentSession_default = PaymentSession;
2051
2030
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.1.46",
3
+ "version": "1.1.48",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",