@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 +16 -9
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +16 -9
- package/package.json +1 -1
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(
|
|
1836
|
+
static async getStripeSubscriptionsByCustomerId(stripe_customerId) {
|
|
1837
1837
|
const command = new import_lib_dynamodb15.QueryCommand({
|
|
1838
1838
|
TableName: _StripeSubscription.TABLE_NAME,
|
|
1839
|
-
IndexName: "
|
|
1840
|
-
KeyConditionExpression: "
|
|
1839
|
+
IndexName: "StripeCustomerIdIndex",
|
|
1840
|
+
KeyConditionExpression: "stripe_customerId = :stripe_customerId",
|
|
1841
1841
|
ExpressionAttributeValues: {
|
|
1842
|
-
":
|
|
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
|
|
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
|
-
|
|
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: {
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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(
|
|
1866
|
+
static async getStripeSubscriptionsByCustomerId(stripe_customerId) {
|
|
1867
1867
|
const command = new QueryCommand13({
|
|
1868
1868
|
TableName: _StripeSubscription.TABLE_NAME,
|
|
1869
|
-
IndexName: "
|
|
1870
|
-
KeyConditionExpression: "
|
|
1869
|
+
IndexName: "StripeCustomerIdIndex",
|
|
1870
|
+
KeyConditionExpression: "stripe_customerId = :stripe_customerId",
|
|
1871
1871
|
ExpressionAttributeValues: {
|
|
1872
|
-
":
|
|
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
|
|
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
|
-
|
|
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: {
|
|
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 {
|