payment-kit 1.15.12 → 1.15.14

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.
@@ -5,7 +5,7 @@ import { getFastCheckoutAmount } from '../../libs/session';
5
5
  import { onSubscriptionUpdateConnected } from '../../libs/subscription';
6
6
  import { getTxMetadata } from '../../libs/util';
7
7
  import { invoiceQueue } from '../../queues/invoice';
8
- import { addSubscriptionJob } from '../../queues/subscription';
8
+ import { addSubscriptionJob, subscriptionQueue } from '../../queues/subscription';
9
9
  import type { TLineItemExpanded } from '../../store/models';
10
10
  import {
11
11
  ensureSubscription,
@@ -134,6 +134,7 @@ export default {
134
134
  }
135
135
  if (subscription) {
136
136
  await onSubscriptionUpdateConnected(subscriptionId);
137
+ await subscriptionQueue.delete(subscription.id);
137
138
  await addSubscriptionJob(subscription, 'cycle', false, subscription.trial_end);
138
139
  }
139
140
  };
@@ -107,6 +107,7 @@ export async function ensurePaymentIntent(checkoutSessionId: string, userDid?: s
107
107
  if (!user) {
108
108
  throw new Error('Seems you have not connected to this app before');
109
109
  }
110
+
110
111
  if (customer.did !== user.did) {
111
112
  throw new Error('This is not your payment intent');
112
113
  }
@@ -174,6 +175,10 @@ export async function ensureSetupIntent(checkoutSessionId: string, userDid?: str
174
175
  }
175
176
  if (userDid) {
176
177
  const { user } = await blocklet.getUser(userDid, { enableConnectedAccount: true });
178
+ if (!user) {
179
+ throw new Error('Seems you have not connected to this app before');
180
+ }
181
+
177
182
  if (customer.did !== user.did) {
178
183
  throw new Error('This is not your setupIntent');
179
184
  }
@@ -740,7 +745,14 @@ export async function getStakeTxClaim({
740
745
  const threshold = fromTokenToUnit(Math.max(billingThreshold, minStakeAmount), paymentCurrency.decimal);
741
746
  const staking = getSubscriptionStakeSetup(items, paymentCurrency.id, threshold.toString());
742
747
  const amount = staking.licensed.add(staking.metered).toString();
743
- logger.info('getStakeTxClaim', { subscriptionId: subscription.id, billingThreshold, minStakeAmount, threshold: threshold.toString(), staking, amount: amount.toString() });
748
+ logger.info('getStakeTxClaim', {
749
+ subscriptionId: subscription.id,
750
+ billingThreshold,
751
+ minStakeAmount,
752
+ threshold: threshold.toString(),
753
+ staking,
754
+ amount: amount.toString(),
755
+ });
744
756
 
745
757
  if (paymentMethod.type === 'arcblock') {
746
758
  // create staking data
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.15.12
17
+ version: 1.15.14
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.15.12",
3
+ "version": "1.15.14",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -52,7 +52,7 @@
52
52
  "@arcblock/validator": "^1.18.135",
53
53
  "@blocklet/js-sdk": "^1.16.32",
54
54
  "@blocklet/logger": "^1.16.32",
55
- "@blocklet/payment-react": "1.15.12",
55
+ "@blocklet/payment-react": "1.15.14",
56
56
  "@blocklet/sdk": "^1.16.32",
57
57
  "@blocklet/ui-react": "^2.10.39",
58
58
  "@blocklet/uploader": "^0.1.40",
@@ -118,7 +118,7 @@
118
118
  "devDependencies": {
119
119
  "@abtnode/types": "^1.16.32",
120
120
  "@arcblock/eslint-config-ts": "^0.3.2",
121
- "@blocklet/payment-types": "1.15.12",
121
+ "@blocklet/payment-types": "1.15.14",
122
122
  "@types/cookie-parser": "^1.4.7",
123
123
  "@types/cors": "^2.8.17",
124
124
  "@types/debug": "^4.1.12",
@@ -160,5 +160,5 @@
160
160
  "parser": "typescript"
161
161
  }
162
162
  },
163
- "gitHead": "522f94d0b960bc6e1bfdb3cf6738ecb077183ca1"
163
+ "gitHead": "0e93a9f3a6dfd750b07b4ba05be018ae54919b30"
164
164
  }