@amohamud23/notihub 1.1.48 → 1.1.50
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 +12 -30
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +12 -30
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1828,12 +1828,7 @@ var StripeSubscription = class _StripeSubscription {
|
|
|
1828
1828
|
throw new Error("Could not fetch stripe subscription");
|
|
1829
1829
|
}
|
|
1830
1830
|
}
|
|
1831
|
-
|
|
1832
|
-
* Retrieves stripe subscriptions by customer ID.
|
|
1833
|
-
* @param customer - The customer ID to retrieve subscriptions for.
|
|
1834
|
-
* @returns A promise that resolves to an array of stripe subscription objects.
|
|
1835
|
-
*/
|
|
1836
|
-
static async getStripeSubscriptionsByCustomerId(stripe_customerId) {
|
|
1831
|
+
static async getStripeSubscriptionsByStripeCustomerId(stripe_customerId) {
|
|
1837
1832
|
const command = new import_lib_dynamodb15.QueryCommand({
|
|
1838
1833
|
TableName: _StripeSubscription.TABLE_NAME,
|
|
1839
1834
|
IndexName: "StripeCustomerIdIndex",
|
|
@@ -1842,26 +1837,6 @@ var StripeSubscription = class _StripeSubscription {
|
|
|
1842
1837
|
":stripe_customerId": stripe_customerId
|
|
1843
1838
|
}
|
|
1844
1839
|
});
|
|
1845
|
-
try {
|
|
1846
|
-
const result = await ddbDocClient.send(command);
|
|
1847
|
-
return result.Items || [];
|
|
1848
|
-
} catch (error) {
|
|
1849
|
-
console.error(
|
|
1850
|
-
`Error fetching stripe subscriptions for stripe_customerId: ${stripe_customerId}`,
|
|
1851
|
-
error
|
|
1852
|
-
);
|
|
1853
|
-
throw new Error("Could not fetch stripe subscriptions by customerId");
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
static async getStripeSubscriptionsByStripeCustomerId(stripeCustomerId) {
|
|
1857
|
-
const command = new import_lib_dynamodb15.QueryCommand({
|
|
1858
|
-
TableName: _StripeSubscription.TABLE_NAME,
|
|
1859
|
-
IndexName: "StripeCustomerIdIndex",
|
|
1860
|
-
KeyConditionExpression: "stripe_customerId = :stripeCustomerId",
|
|
1861
|
-
ExpressionAttributeValues: {
|
|
1862
|
-
":stripeCustomerId": stripeCustomerId
|
|
1863
|
-
}
|
|
1864
|
-
});
|
|
1865
1840
|
try {
|
|
1866
1841
|
const result = await ddbDocClient.send(command);
|
|
1867
1842
|
if (!result.Items || result.Items.length === 0) {
|
|
@@ -1975,13 +1950,20 @@ var PaymentSession = class _PaymentSession {
|
|
|
1975
1950
|
throw new Error("Could not fetch payment session");
|
|
1976
1951
|
}
|
|
1977
1952
|
}
|
|
1978
|
-
|
|
1953
|
+
/**
|
|
1954
|
+
* Updates a payment session.
|
|
1955
|
+
* @param id - The ID of the payment session to update.
|
|
1956
|
+
* @param intent - The intent of the payment session to update.
|
|
1957
|
+
* @returns A promise that resolves when the payment session is updated.
|
|
1958
|
+
*/
|
|
1959
|
+
static async updatePaymentSession(sessionId, intent) {
|
|
1979
1960
|
const command = new import_lib_dynamodb16.UpdateCommand({
|
|
1980
1961
|
TableName: _PaymentSession.TABLE_NAME,
|
|
1981
|
-
Key: {
|
|
1982
|
-
UpdateExpression: "set #status = :status",
|
|
1962
|
+
Key: { sessionId },
|
|
1963
|
+
UpdateExpression: "set #status = :status, #updatedAt = :updatedAt",
|
|
1983
1964
|
ExpressionAttributeValues: {
|
|
1984
|
-
":status": intent
|
|
1965
|
+
":status": intent,
|
|
1966
|
+
":updatedAt": (/* @__PURE__ */ new Date()).toISOString()
|
|
1985
1967
|
}
|
|
1986
1968
|
});
|
|
1987
1969
|
try {
|
package/dist/index.d.cts
CHANGED
|
@@ -727,13 +727,7 @@ declare class StripeSubscription {
|
|
|
727
727
|
* @returns A promise that resolves to the stripe subscription object or null if not found.
|
|
728
728
|
*/
|
|
729
729
|
static getStripeSubscriptionById(id: string): Promise<INotiHubStripeSubscription | null>;
|
|
730
|
-
|
|
731
|
-
* Retrieves stripe subscriptions by customer ID.
|
|
732
|
-
* @param customer - The customer ID to retrieve subscriptions for.
|
|
733
|
-
* @returns A promise that resolves to an array of stripe subscription objects.
|
|
734
|
-
*/
|
|
735
|
-
static getStripeSubscriptionsByCustomerId(stripe_customerId: string): Promise<INotiHubStripeSubscription[]>;
|
|
736
|
-
static getStripeSubscriptionsByStripeCustomerId(stripeCustomerId: string): Promise<INotiHubStripeSubscription | null>;
|
|
730
|
+
static getStripeSubscriptionsByStripeCustomerId(stripe_customerId: string): Promise<INotiHubStripeSubscription | null>;
|
|
737
731
|
/**
|
|
738
732
|
* Creates a new stripe subscription.
|
|
739
733
|
* @param stripeSubscription - The stripe subscription object to create.
|
|
@@ -760,7 +754,13 @@ declare class PaymentSession {
|
|
|
760
754
|
static TABLE_NAME: string;
|
|
761
755
|
static createPaymentSession(paymentSession: INotiHubPaymentSession): Promise<INotiHubPaymentSession>;
|
|
762
756
|
static getPaymentSessionById(sessionId: string): Promise<INotiHubPaymentSession>;
|
|
763
|
-
|
|
757
|
+
/**
|
|
758
|
+
* Updates a payment session.
|
|
759
|
+
* @param id - The ID of the payment session to update.
|
|
760
|
+
* @param intent - The intent of the payment session to update.
|
|
761
|
+
* @returns A promise that resolves when the payment session is updated.
|
|
762
|
+
*/
|
|
763
|
+
static updatePaymentSession(sessionId: string, intent: string): Promise<void>;
|
|
764
764
|
}
|
|
765
765
|
|
|
766
766
|
declare const TABLES: {
|
package/dist/index.d.ts
CHANGED
|
@@ -727,13 +727,7 @@ declare class StripeSubscription {
|
|
|
727
727
|
* @returns A promise that resolves to the stripe subscription object or null if not found.
|
|
728
728
|
*/
|
|
729
729
|
static getStripeSubscriptionById(id: string): Promise<INotiHubStripeSubscription | null>;
|
|
730
|
-
|
|
731
|
-
* Retrieves stripe subscriptions by customer ID.
|
|
732
|
-
* @param customer - The customer ID to retrieve subscriptions for.
|
|
733
|
-
* @returns A promise that resolves to an array of stripe subscription objects.
|
|
734
|
-
*/
|
|
735
|
-
static getStripeSubscriptionsByCustomerId(stripe_customerId: string): Promise<INotiHubStripeSubscription[]>;
|
|
736
|
-
static getStripeSubscriptionsByStripeCustomerId(stripeCustomerId: string): Promise<INotiHubStripeSubscription | null>;
|
|
730
|
+
static getStripeSubscriptionsByStripeCustomerId(stripe_customerId: string): Promise<INotiHubStripeSubscription | null>;
|
|
737
731
|
/**
|
|
738
732
|
* Creates a new stripe subscription.
|
|
739
733
|
* @param stripeSubscription - The stripe subscription object to create.
|
|
@@ -760,7 +754,13 @@ declare class PaymentSession {
|
|
|
760
754
|
static TABLE_NAME: string;
|
|
761
755
|
static createPaymentSession(paymentSession: INotiHubPaymentSession): Promise<INotiHubPaymentSession>;
|
|
762
756
|
static getPaymentSessionById(sessionId: string): Promise<INotiHubPaymentSession>;
|
|
763
|
-
|
|
757
|
+
/**
|
|
758
|
+
* Updates a payment session.
|
|
759
|
+
* @param id - The ID of the payment session to update.
|
|
760
|
+
* @param intent - The intent of the payment session to update.
|
|
761
|
+
* @returns A promise that resolves when the payment session is updated.
|
|
762
|
+
*/
|
|
763
|
+
static updatePaymentSession(sessionId: string, intent: string): Promise<void>;
|
|
764
764
|
}
|
|
765
765
|
|
|
766
766
|
declare const TABLES: {
|
package/dist/index.js
CHANGED
|
@@ -1858,12 +1858,7 @@ var StripeSubscription = class _StripeSubscription {
|
|
|
1858
1858
|
throw new Error("Could not fetch stripe subscription");
|
|
1859
1859
|
}
|
|
1860
1860
|
}
|
|
1861
|
-
|
|
1862
|
-
* Retrieves stripe subscriptions by customer ID.
|
|
1863
|
-
* @param customer - The customer ID to retrieve subscriptions for.
|
|
1864
|
-
* @returns A promise that resolves to an array of stripe subscription objects.
|
|
1865
|
-
*/
|
|
1866
|
-
static async getStripeSubscriptionsByCustomerId(stripe_customerId) {
|
|
1861
|
+
static async getStripeSubscriptionsByStripeCustomerId(stripe_customerId) {
|
|
1867
1862
|
const command = new QueryCommand13({
|
|
1868
1863
|
TableName: _StripeSubscription.TABLE_NAME,
|
|
1869
1864
|
IndexName: "StripeCustomerIdIndex",
|
|
@@ -1872,26 +1867,6 @@ var StripeSubscription = class _StripeSubscription {
|
|
|
1872
1867
|
":stripe_customerId": stripe_customerId
|
|
1873
1868
|
}
|
|
1874
1869
|
});
|
|
1875
|
-
try {
|
|
1876
|
-
const result = await ddbDocClient.send(command);
|
|
1877
|
-
return result.Items || [];
|
|
1878
|
-
} catch (error) {
|
|
1879
|
-
console.error(
|
|
1880
|
-
`Error fetching stripe subscriptions for stripe_customerId: ${stripe_customerId}`,
|
|
1881
|
-
error
|
|
1882
|
-
);
|
|
1883
|
-
throw new Error("Could not fetch stripe subscriptions by customerId");
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
static async getStripeSubscriptionsByStripeCustomerId(stripeCustomerId) {
|
|
1887
|
-
const command = new QueryCommand13({
|
|
1888
|
-
TableName: _StripeSubscription.TABLE_NAME,
|
|
1889
|
-
IndexName: "StripeCustomerIdIndex",
|
|
1890
|
-
KeyConditionExpression: "stripe_customerId = :stripeCustomerId",
|
|
1891
|
-
ExpressionAttributeValues: {
|
|
1892
|
-
":stripeCustomerId": stripeCustomerId
|
|
1893
|
-
}
|
|
1894
|
-
});
|
|
1895
1870
|
try {
|
|
1896
1871
|
const result = await ddbDocClient.send(command);
|
|
1897
1872
|
if (!result.Items || result.Items.length === 0) {
|
|
@@ -2009,13 +1984,20 @@ var PaymentSession = class _PaymentSession {
|
|
|
2009
1984
|
throw new Error("Could not fetch payment session");
|
|
2010
1985
|
}
|
|
2011
1986
|
}
|
|
2012
|
-
|
|
1987
|
+
/**
|
|
1988
|
+
* Updates a payment session.
|
|
1989
|
+
* @param id - The ID of the payment session to update.
|
|
1990
|
+
* @param intent - The intent of the payment session to update.
|
|
1991
|
+
* @returns A promise that resolves when the payment session is updated.
|
|
1992
|
+
*/
|
|
1993
|
+
static async updatePaymentSession(sessionId, intent) {
|
|
2013
1994
|
const command = new UpdateCommand14({
|
|
2014
1995
|
TableName: _PaymentSession.TABLE_NAME,
|
|
2015
|
-
Key: {
|
|
2016
|
-
UpdateExpression: "set #status = :status",
|
|
1996
|
+
Key: { sessionId },
|
|
1997
|
+
UpdateExpression: "set #status = :status, #updatedAt = :updatedAt",
|
|
2017
1998
|
ExpressionAttributeValues: {
|
|
2018
|
-
":status": intent
|
|
1999
|
+
":status": intent,
|
|
2000
|
+
":updatedAt": (/* @__PURE__ */ new Date()).toISOString()
|
|
2019
2001
|
}
|
|
2020
2002
|
});
|
|
2021
2003
|
try {
|