@amohamud23/notihub 1.1.47 → 1.1.49

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");
@@ -1975,13 +1975,20 @@ var PaymentSession = class _PaymentSession {
1975
1975
  throw new Error("Could not fetch payment session");
1976
1976
  }
1977
1977
  }
1978
- static async updatePaymentSession(id, intent) {
1978
+ /**
1979
+ * Updates a payment session.
1980
+ * @param id - The ID of the payment session to update.
1981
+ * @param intent - The intent of the payment session to update.
1982
+ * @returns A promise that resolves when the payment session is updated.
1983
+ */
1984
+ static async updatePaymentSession(sessionId, intent) {
1979
1985
  const command = new import_lib_dynamodb16.UpdateCommand({
1980
1986
  TableName: _PaymentSession.TABLE_NAME,
1981
- Key: { id },
1982
- UpdateExpression: "set #status = :status",
1987
+ Key: { sessionId },
1988
+ UpdateExpression: "set #status = :status, #updatedAt = :updatedAt",
1983
1989
  ExpressionAttributeValues: {
1984
- ":status": intent
1990
+ ":status": intent,
1991
+ ":updatedAt": (/* @__PURE__ */ new Date()).toISOString()
1985
1992
  }
1986
1993
  });
1987
1994
  try {
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.
@@ -760,7 +760,13 @@ declare class PaymentSession {
760
760
  static TABLE_NAME: string;
761
761
  static createPaymentSession(paymentSession: INotiHubPaymentSession): Promise<INotiHubPaymentSession>;
762
762
  static getPaymentSessionById(sessionId: string): Promise<INotiHubPaymentSession>;
763
- static updatePaymentSession(id: string, intent: string): Promise<void>;
763
+ /**
764
+ * Updates a payment session.
765
+ * @param id - The ID of the payment session to update.
766
+ * @param intent - The intent of the payment session to update.
767
+ * @returns A promise that resolves when the payment session is updated.
768
+ */
769
+ static updatePaymentSession(sessionId: string, intent: string): Promise<void>;
764
770
  }
765
771
 
766
772
  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.
@@ -760,7 +760,13 @@ declare class PaymentSession {
760
760
  static TABLE_NAME: string;
761
761
  static createPaymentSession(paymentSession: INotiHubPaymentSession): Promise<INotiHubPaymentSession>;
762
762
  static getPaymentSessionById(sessionId: string): Promise<INotiHubPaymentSession>;
763
- static updatePaymentSession(id: string, intent: string): Promise<void>;
763
+ /**
764
+ * Updates a payment session.
765
+ * @param id - The ID of the payment session to update.
766
+ * @param intent - The intent of the payment session to update.
767
+ * @returns A promise that resolves when the payment session is updated.
768
+ */
769
+ static updatePaymentSession(sessionId: string, intent: string): Promise<void>;
764
770
  }
765
771
 
766
772
  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");
@@ -2009,13 +2009,20 @@ var PaymentSession = class _PaymentSession {
2009
2009
  throw new Error("Could not fetch payment session");
2010
2010
  }
2011
2011
  }
2012
- static async updatePaymentSession(id, intent) {
2012
+ /**
2013
+ * Updates a payment session.
2014
+ * @param id - The ID of the payment session to update.
2015
+ * @param intent - The intent of the payment session to update.
2016
+ * @returns A promise that resolves when the payment session is updated.
2017
+ */
2018
+ static async updatePaymentSession(sessionId, intent) {
2013
2019
  const command = new UpdateCommand14({
2014
2020
  TableName: _PaymentSession.TABLE_NAME,
2015
- Key: { id },
2016
- UpdateExpression: "set #status = :status",
2021
+ Key: { sessionId },
2022
+ UpdateExpression: "set #status = :status, #updatedAt = :updatedAt",
2017
2023
  ExpressionAttributeValues: {
2018
- ":status": intent
2024
+ ":status": intent,
2025
+ ":updatedAt": (/* @__PURE__ */ new Date()).toISOString()
2019
2026
  }
2020
2027
  });
2021
2028
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.1.47",
3
+ "version": "1.1.49",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",