payment-kit 1.20.14 → 1.20.16

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.
@@ -623,6 +623,29 @@ export class CheckoutSession extends Model<InferAttributes<CheckoutSession>, Inf
623
623
  return null;
624
624
  }
625
625
  }
626
+
627
+ public static async findByInvoiceId(invoiceId: string): Promise<CheckoutSession | null> {
628
+ try {
629
+ const invoice = await Invoice.findByPk(invoiceId);
630
+ if (!invoice) {
631
+ return null;
632
+ }
633
+
634
+ if (invoice.checkout_session_id) {
635
+ return await CheckoutSession.findByPk(invoice.checkout_session_id);
636
+ }
637
+
638
+ if (!invoice.subscription_id) {
639
+ return null;
640
+ }
641
+
642
+ // Find original CheckoutSession through subscription
643
+ const checkoutSession = await CheckoutSession.findBySubscriptionId(invoice.subscription_id);
644
+ return checkoutSession;
645
+ } catch (error: any) {
646
+ return null;
647
+ }
648
+ }
626
649
  }
627
650
 
628
651
  export type TCheckoutSession = InferAttributes<CheckoutSession>;
@@ -18,6 +18,7 @@ export class Discount extends Model<InferAttributes<Discount>, InferCreationAttr
18
18
  declare checkout_session_id?: string;
19
19
  declare invoice_id?: string;
20
20
  declare invoice_item_id?: string;
21
+ declare confirmed?: boolean;
21
22
 
22
23
  declare start: number;
23
24
  declare end: number | null;
@@ -101,13 +102,23 @@ export class Discount extends Model<InferAttributes<Discount>, InferCreationAttr
101
102
  };
102
103
 
103
104
  public static initialize(sequelize: any) {
104
- this.init(Discount.GENESIS_ATTRIBUTES, {
105
- sequelize,
106
- modelName: 'Discount',
107
- tableName: 'discounts',
108
- createdAt: 'created_at',
109
- updatedAt: 'updated_at',
110
- });
105
+ this.init(
106
+ {
107
+ ...Discount.GENESIS_ATTRIBUTES,
108
+ confirmed: {
109
+ type: DataTypes.BOOLEAN,
110
+ defaultValue: true,
111
+ allowNull: false,
112
+ },
113
+ },
114
+ {
115
+ sequelize,
116
+ modelName: 'Discount',
117
+ tableName: 'discounts',
118
+ createdAt: 'created_at',
119
+ updatedAt: 'updated_at',
120
+ }
121
+ );
111
122
  }
112
123
 
113
124
  public static associate(models: any) {
@@ -1,7 +1,7 @@
1
1
  import { CheckoutSession, TCheckoutSession } from './checkout-session';
2
2
  import { Coupon, TCoupon } from './coupon';
3
3
  import { Customer, TCustomer } from './customer';
4
- import { Discount } from './discount';
4
+ import { Discount, TDiscount } from './discount';
5
5
  import { Event, TEvent } from './event';
6
6
  import { Invoice, TInvoice } from './invoice';
7
7
  import { InvoiceItem, TInvoiceItem } from './invoice-item';
@@ -326,9 +326,16 @@ export type TCouponExpanded = TCoupon & {
326
326
  object: 'coupon';
327
327
  applied_products?: TProduct[];
328
328
  promotion_codes?: TPromotionCode[];
329
+ currency?: TPaymentCurrency;
329
330
  };
330
331
 
331
332
  export type TPromotionCodeExpanded = TPromotionCode & {
332
333
  object: 'promotion_code';
333
334
  coupon?: TCoupon;
334
335
  };
336
+
337
+ export type TDiscountExpanded = TDiscount & {
338
+ object: 'discount';
339
+ coupon?: TCouponExpanded;
340
+ promotionCode?: TPromotionCodeExpanded;
341
+ };
package/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.20.14
17
+ version: 1.20.16
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
@@ -73,6 +73,12 @@ environments:
73
73
  default: ''
74
74
  secure: true
75
75
  shared: false
76
+ - name: SHORT_URL_DOMAIN
77
+ description: Short URL service domain
78
+ required: false
79
+ default: s.abtnet.io
80
+ secure: false
81
+ shared: false
76
82
  capabilities:
77
83
  navigation: true
78
84
  clusterMode: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.20.14",
3
+ "version": "1.20.16",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
@@ -45,32 +45,32 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@abtnode/cron": "^1.16.52-beta-20250912-112002-e3499e9c",
48
- "@arcblock/did": "^1.25.1",
48
+ "@arcblock/did": "^1.25.3",
49
49
  "@arcblock/did-connect-react": "^3.1.41",
50
50
  "@arcblock/did-connect-storage-nedb": "^1.8.0",
51
- "@arcblock/did-util": "^1.25.1",
52
- "@arcblock/jwt": "^1.25.1",
51
+ "@arcblock/did-util": "^1.25.3",
52
+ "@arcblock/jwt": "^1.25.3",
53
53
  "@arcblock/ux": "^3.1.41",
54
- "@arcblock/validator": "^1.25.1",
55
- "@blocklet/did-space-js": "^1.1.24",
54
+ "@arcblock/validator": "^1.25.3",
55
+ "@blocklet/did-space-js": "^1.1.26",
56
56
  "@blocklet/error": "^0.2.5",
57
57
  "@blocklet/js-sdk": "^1.16.52-beta-20250912-112002-e3499e9c",
58
58
  "@blocklet/logger": "^1.16.52-beta-20250912-112002-e3499e9c",
59
- "@blocklet/payment-react": "1.20.14",
60
- "@blocklet/payment-vendor": "1.20.14",
59
+ "@blocklet/payment-react": "1.20.16",
60
+ "@blocklet/payment-vendor": "1.20.16",
61
61
  "@blocklet/sdk": "^1.16.52-beta-20250912-112002-e3499e9c",
62
62
  "@blocklet/ui-react": "^3.1.41",
63
- "@blocklet/uploader": "^0.2.11",
63
+ "@blocklet/uploader": "^0.2.12",
64
64
  "@blocklet/xss": "^0.2.7",
65
65
  "@mui/icons-material": "^7.1.2",
66
66
  "@mui/lab": "7.0.0-beta.14",
67
67
  "@mui/material": "^7.1.2",
68
68
  "@mui/system": "^7.1.1",
69
- "@ocap/asset": "^1.25.1",
70
- "@ocap/client": "^1.25.1",
71
- "@ocap/mcrypto": "^1.25.1",
72
- "@ocap/util": "^1.25.1",
73
- "@ocap/wallet": "^1.25.1",
69
+ "@ocap/asset": "^1.25.3",
70
+ "@ocap/client": "^1.25.3",
71
+ "@ocap/mcrypto": "^1.25.3",
72
+ "@ocap/util": "^1.25.3",
73
+ "@ocap/wallet": "^1.25.3",
74
74
  "@stripe/react-stripe-js": "^2.9.0",
75
75
  "@stripe/stripe-js": "^2.4.0",
76
76
  "ahooks": "^3.8.5",
@@ -126,7 +126,7 @@
126
126
  "devDependencies": {
127
127
  "@abtnode/types": "^1.16.52-beta-20250912-112002-e3499e9c",
128
128
  "@arcblock/eslint-config-ts": "^0.3.3",
129
- "@blocklet/payment-types": "1.20.14",
129
+ "@blocklet/payment-types": "1.20.16",
130
130
  "@types/cookie-parser": "^1.4.9",
131
131
  "@types/cors": "^2.8.19",
132
132
  "@types/debug": "^4.1.12",
@@ -157,7 +157,7 @@
157
157
  "vite": "^7.0.0",
158
158
  "vite-node": "^3.2.4",
159
159
  "vite-plugin-babel-import": "^2.0.5",
160
- "vite-plugin-blocklet": "^0.11.0",
160
+ "vite-plugin-blocklet": "^0.11.1",
161
161
  "vite-plugin-node-polyfills": "^0.23.0",
162
162
  "vite-plugin-svgr": "^4.3.0",
163
163
  "vite-tsconfig-paths": "^5.1.4",
@@ -173,5 +173,5 @@
173
173
  "parser": "typescript"
174
174
  }
175
175
  },
176
- "gitHead": "365b60721b7f3a372c472f774cda290d56dad365"
176
+ "gitHead": "ebf0677dd4414d4abc4129d6663a7e9ddb415281"
177
177
  }