@stacksjs/payments 0.68.2 → 0.69.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/dist/charge.d.ts +0 -1
- package/dist/checkout.d.ts +0 -1
- package/dist/{Customer.d.ts → customer.d.ts} +3 -4
- package/dist/index.js +4260 -352
- package/dist/intent.d.ts +6 -0
- package/dist/invoice.d.ts +6 -0
- package/dist/payment-method.d.ts +9 -4
- package/dist/price.d.ts +0 -2
- package/dist/setup-products.d.ts +12 -1
- package/dist/stripe.d.ts +43 -2
- package/dist/subscription.d.ts +4 -2
- package/dist/transaction.d.ts +8 -0
- package/package.json +7 -10
package/dist/intent.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UserModel } from '../../../../orm/src/models/User';
|
|
2
|
+
|
|
3
|
+
export declare interface SetupIntent {
|
|
4
|
+
create: (user: UserModel, params: Stripe.SetupIntentCreateParams) => Promise<Stripe.Response<Stripe.SetupIntent>>
|
|
5
|
+
}
|
|
6
|
+
export declare const manageSetupIntent: SetupIntent;
|
package/dist/payment-method.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PaymentMethodModel } from '../../../../orm/src/models/PaymentMethod';
|
|
2
2
|
import type { UserModel } from '../../../../orm/src/models/User';
|
|
3
3
|
|
|
4
4
|
export declare interface ManagePaymentMethod {
|
|
5
5
|
addPaymentMethod: (user: UserModel, paymentMethod: string | Stripe.PaymentMethod) => Promise<Stripe.Response<Stripe.PaymentMethod>>
|
|
6
|
-
updatePaymentMethod: (user: UserModel, paymentMethodId: string, updateParams
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
updatePaymentMethod: (user: UserModel, paymentMethodId: string, updateParams?: Stripe.PaymentMethodUpdateParams) => Promise<Stripe.Response<Stripe.PaymentMethod>>
|
|
7
|
+
setUserDefaultPayment: (user: UserModel, paymentMethodId: string) => Promise<Stripe.Response<Stripe.Customer>>
|
|
8
|
+
setDefaultPaymentMethod: (user: UserModel, paymentMethodId: number) => Promise<Stripe.Response<Stripe.Customer>>
|
|
9
|
+
storePaymentMethod: (user: UserModel, paymentMethodId: Stripe.PaymentMethod) => Promise<PaymentMethodModel>
|
|
10
|
+
deletePaymentMethod: (user: UserModel, paymentMethodId: number) => Promise<Stripe.Response<Stripe.PaymentMethod>>
|
|
11
|
+
retrievePaymentMethod: (user: UserModel, paymentMethodId: number) => Promise<PaymentMethodModel | undefined>
|
|
12
|
+
retrieveDefaultPaymentMethod: (user: UserModel) => Promise<PaymentMethodModel | undefined>
|
|
13
|
+
listPaymentMethods: (user: UserModel, cardType?: string) => Promise<PaymentMethodModel[]>
|
|
9
14
|
}
|
|
10
15
|
export declare let managePaymentMethod: ManagePaymentMethod;
|
package/dist/price.d.ts
CHANGED
package/dist/setup-products.d.ts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Err } from '@stacksjs/error-handling';
|
|
2
|
+
|
|
3
|
+
declare interface PriceParams {
|
|
4
|
+
unit_amount: number
|
|
5
|
+
currency: string
|
|
6
|
+
product: string
|
|
7
|
+
lookup_key: string
|
|
8
|
+
recurring?: {
|
|
9
|
+
interval: 'day' | 'month' | 'week' | 'year'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare function createStripeProduct(): Promise<Ok<string, never> | Err<string, any>>;
|
package/dist/stripe.d.ts
CHANGED
|
@@ -26,8 +26,19 @@ export declare interface Charge {
|
|
|
26
26
|
export declare const charge: Charge;
|
|
27
27
|
export declare interface Subscription {
|
|
28
28
|
create: (params: Stripe.SubscriptionCreateParams) => Promise<Stripe.Response<Stripe.Subscription>>
|
|
29
|
+
update: (id: string, params: Stripe.SubscriptionUpdateParams) => Promise<Stripe.Response<Stripe.Subscription>>
|
|
30
|
+
list: (params: Stripe.SubscriptionListParams) => Promise<Stripe.ApiListPromise<Stripe.Subscription>>
|
|
31
|
+
retrieve: (id: string, params?: Stripe.SubscriptionRetrieveParams) => Promise<Stripe.Response<Stripe.Subscription>>
|
|
32
|
+
cancel: (id: string, params?: Stripe.SubscriptionCancelParams) => Promise<Stripe.Response<Stripe.Subscription>>
|
|
29
33
|
}
|
|
30
34
|
export declare const subscription: Subscription;
|
|
35
|
+
export declare interface SubscriptionItems {
|
|
36
|
+
create: (params: Stripe.SubscriptionItemCreateParams) => Promise<Stripe.Response<Stripe.SubscriptionItem>>
|
|
37
|
+
update: (id: string, params: Stripe.SubscriptionItemUpdateParams) => Promise<Stripe.Response<Stripe.SubscriptionItem>>
|
|
38
|
+
retrieve: (id: string) => Promise<Stripe.Response<Stripe.SubscriptionItem>>
|
|
39
|
+
delete: (id: string) => Promise<Stripe.Response<Stripe.DeletedSubscriptionItem>>
|
|
40
|
+
}
|
|
41
|
+
export declare const subscriptionItems: SubscriptionItems;
|
|
31
42
|
export declare interface Price {
|
|
32
43
|
retrieve: (priceId: string, params: Stripe.PriceRetrieveParams) => Promise<Stripe.Response<Stripe.Price>>
|
|
33
44
|
list: (params: Stripe.PriceListParams) => Promise<Stripe.ApiListPromise<Stripe.Price>>
|
|
@@ -41,6 +52,7 @@ export declare interface Product {
|
|
|
41
52
|
update: (productId: string, params: Stripe.ProductUpdateParams) => Promise<Stripe.Response<Stripe.Product>>
|
|
42
53
|
delete: (productId: string) => Promise<Stripe.Response<Stripe.DeletedProduct>>
|
|
43
54
|
list: (params?: Stripe.ProductListParams) => Promise<Stripe.ApiListPromise<Stripe.Product>>
|
|
55
|
+
getOrCreate: (productName: string, createParams: Stripe.ProductCreateParams) => Promise<Stripe.Product>
|
|
44
56
|
}
|
|
45
57
|
export declare const product: Product;
|
|
46
58
|
export declare interface Refund {
|
|
@@ -53,7 +65,7 @@ export declare const refund: Refund;
|
|
|
53
65
|
export declare interface PaymentMethod {
|
|
54
66
|
create: (params: Stripe.PaymentMethodCreateParams) => Promise<Stripe.Response<Stripe.PaymentMethod>>
|
|
55
67
|
retrieve: (paymentMethodId: string) => Promise<Stripe.Response<Stripe.PaymentMethod>>
|
|
56
|
-
update: (paymentMethodId: string, params
|
|
68
|
+
update: (paymentMethodId: string, params?: Stripe.PaymentMethodUpdateParams) => Promise<Stripe.Response<Stripe.PaymentMethod>>
|
|
57
69
|
list: (params: Stripe.PaymentMethodListParams) => Promise<Stripe.Response<Stripe.ApiList<Stripe.PaymentMethod>>>
|
|
58
70
|
attach: (paymentMethodId: string, params: Stripe.PaymentMethodAttachParams) => Promise<Stripe.Response<Stripe.PaymentMethod>>
|
|
59
71
|
detach: (paymentMethodId: string) => Promise<Stripe.Response<Stripe.PaymentMethod>>
|
|
@@ -102,4 +114,33 @@ export declare interface PaymentEvents {
|
|
|
102
114
|
retrieve: (stripeId: string) => Promise<Stripe.Response<Stripe.Event>>
|
|
103
115
|
list: (limit: number) => Promise<Stripe.Response<Stripe.ApiList<Stripe.Event>>>
|
|
104
116
|
}
|
|
105
|
-
export declare const events: PaymentEvents;
|
|
117
|
+
export declare const events: PaymentEvents;
|
|
118
|
+
export declare interface PaymentCoupons {
|
|
119
|
+
retrieve: (couponId: string) => Promise<Stripe.Response<Stripe.Coupon>>
|
|
120
|
+
list: (limit: number) => Promise<Stripe.Response<Stripe.ApiList<Stripe.Coupon>>>
|
|
121
|
+
create: (params: Stripe.CouponCreateParams) => Promise<Stripe.Response<Stripe.Coupon>>
|
|
122
|
+
delete: (couponId: string) => Promise<Stripe.Response<Stripe.DeletedCoupon>>
|
|
123
|
+
}
|
|
124
|
+
export declare const coupons: PaymentCoupons;
|
|
125
|
+
export declare interface PaymentPromotionCodes {
|
|
126
|
+
retrieve: (promotionCodeId: string) => Promise<Stripe.Response<Stripe.PromotionCode>>
|
|
127
|
+
list: (params: Stripe.PromotionCodeListParams) => Promise<Stripe.Response<Stripe.ApiList<Stripe.PromotionCode>>>
|
|
128
|
+
create: (params: Stripe.PromotionCodeCreateParams) => Promise<Stripe.Response<Stripe.PromotionCode>>
|
|
129
|
+
}
|
|
130
|
+
export declare const promotionCodes: PaymentPromotionCodes;
|
|
131
|
+
export declare interface SetupIntents {
|
|
132
|
+
retrieve: (setupIntentId: string) => Promise<Stripe.Response<Stripe.SetupIntent>>
|
|
133
|
+
list: (params: Stripe.SetupIntentListParams) => Promise<Stripe.Response<Stripe.ApiList<Stripe.SetupIntent>>>
|
|
134
|
+
create: (params: Stripe.SetupIntentCreateParams) => Promise<Stripe.Response<Stripe.SetupIntent>>
|
|
135
|
+
update: (setupIntentId: string, params: Stripe.SetupIntentUpdateParams) => Promise<Stripe.Response<Stripe.SetupIntent>>
|
|
136
|
+
delete: (setupIntentId: string) => Promise<Stripe.Response<Stripe.SetupIntent>>
|
|
137
|
+
}
|
|
138
|
+
export declare const setupIntents: SetupIntents;
|
|
139
|
+
export declare interface PaymentInvoices {
|
|
140
|
+
retrieve: (invoiceId: string) => Promise<Stripe.Response<Stripe.Invoice>>
|
|
141
|
+
list: (params: Stripe.InvoiceListParams) => Promise<Stripe.Response<Stripe.ApiList<Stripe.Invoice>>>
|
|
142
|
+
create: (params: Stripe.InvoiceCreateParams) => Promise<Stripe.Response<Stripe.Invoice>>
|
|
143
|
+
delete: (invoiceId: string) => Promise<Stripe.Response<Stripe.DeletedInvoice>>
|
|
144
|
+
pay: (invoiceId: string, params?: Stripe.InvoicePayParams) => Promise<Stripe.Response<Stripe.Invoice>>
|
|
145
|
+
}
|
|
146
|
+
export declare const invoices: PaymentInvoices;
|
package/dist/subscription.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { Stripe } from 'stripe';
|
|
2
1
|
import type { UserModel } from '../../../../orm/src/models/User';
|
|
3
2
|
|
|
4
3
|
export declare interface SubscriptionManager {
|
|
5
|
-
create: (user: UserModel, type: string,
|
|
4
|
+
create: (user: UserModel, type: string, lookupKey: string, params: Partial<Stripe.SubscriptionCreateParams>) => Promise<Stripe.Response<Stripe.Subscription>>
|
|
5
|
+
update: (user: UserModel, type: string, lookupKey: string, params: Partial<Stripe.SubscriptionUpdateParams>) => Promise<Stripe.Response<Stripe.Subscription>>
|
|
6
|
+
cancel: (subscriptionId: string, params?: Partial<Stripe.SubscriptionCreateParams>) => Promise<Stripe.Response<Stripe.Subscription>>
|
|
7
|
+
retrieve: (user: UserModel, subscriptionId: string) => Promise<Stripe.Response<Stripe.Subscription>>
|
|
6
8
|
isValid: (user: UserModel, type: string) => Promise<boolean>
|
|
7
9
|
isIncomplete: (user: UserModel, type: string) => Promise<boolean>
|
|
8
10
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TransactionModel } from '../../../../orm/src/models/Transaction';
|
|
2
|
+
import type { UserModel } from '../../../../orm/src/models/User';
|
|
3
|
+
|
|
4
|
+
export declare interface ManageTransaction {
|
|
5
|
+
store: (user: UserModel, productId: number) => Promise<TransactionModel>
|
|
6
|
+
list: (user: UserModel) => Promise<TransactionModel[]>
|
|
7
|
+
}
|
|
8
|
+
export declare const manageTransaction: ManageTransaction;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/payments",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.69.1",
|
|
5
5
|
"description": "The Stacks payments package. Currently supporting Stripe.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": ["Chris Breuer <chris@stacksjs.org>"],
|
|
@@ -41,15 +41,12 @@
|
|
|
41
41
|
"typecheck": "bun tsc --noEmit",
|
|
42
42
|
"prepublishOnly": "bun run build"
|
|
43
43
|
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"@stacksjs/utils": "0.68.1",
|
|
46
|
-
"@stripe/stripe-js": "^4.9.0",
|
|
47
|
-
"@types/stripe": "^8.0.417",
|
|
48
|
-
"@vue-stripe/vue-stripe": "^4.5.0",
|
|
49
|
-
"stripe": "^17.2.1"
|
|
50
|
-
},
|
|
51
44
|
"devDependencies": {
|
|
52
|
-
"@stacksjs/config": "0.68.
|
|
53
|
-
"@stacksjs/development": "0.68.
|
|
45
|
+
"@stacksjs/config": "0.68.2",
|
|
46
|
+
"@stacksjs/development": "0.68.2",
|
|
47
|
+
"@stacksjs/utils": "0.68.2",
|
|
48
|
+
"@stripe/stripe-js": "^5.6.0",
|
|
49
|
+
"@vue-stripe/vue-stripe": "^4.5.0",
|
|
50
|
+
"stripe": "^17.6.0"
|
|
54
51
|
}
|
|
55
52
|
}
|