payment-kit 1.20.2 → 1.20.3

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.
@@ -91,7 +91,7 @@ export class SubscriptionTrialWillEndEmailTemplate extends BaseSubscriptionEmail
91
91
  // @ts-ignore
92
92
  const paymentAddress = subscription.payment_details?.[paymentMethod.type]?.payer ?? undefined;
93
93
  const balance = await getTokenByAddress(paymentAddress, paymentMethod, paymentCurrency);
94
- // @ts-expect-error 这里有问题
94
+
95
95
  paymentDetail.balance = +fromUnitToToken(balance, paymentCurrency.decimal);
96
96
  }
97
97
 
@@ -98,7 +98,7 @@ export class SubscriptionWillRenewEmailTemplate extends BaseSubscriptionEmailTem
98
98
  if (!isStripe && !isCreditSubscription) {
99
99
  const paymentAddress = getSubscriptionPaymentAddress(subscription, paymentInfoResult.paymentMethod!.type);
100
100
  const balance = await getTokenByAddress(paymentAddress, paymentInfoResult.paymentMethod!, paymentCurrency);
101
- // @ts-expect-error 这里有问题
101
+
102
102
  paymentDetail.balanceFormatted = fromUnitToToken(balance, paymentCurrency.decimal);
103
103
  paymentDetail.balance = +paymentDetail.balanceFormatted;
104
104
  }
@@ -1061,7 +1061,6 @@ export async function getSubscriptionStakeAmountSetup(
1061
1061
  });
1062
1062
  });
1063
1063
  Object.keys(amountRes).forEach((address) => {
1064
- // @ts-expect-error 这里有问题
1065
1064
  amountRes[address] = amountRes[address].toString();
1066
1065
  });
1067
1066
  logger.info('get subscription stake amount setup success', { txHash, amountRes });
@@ -107,7 +107,7 @@ export const doHandleUsageRecord = async (job: UsageRecordJob) => {
107
107
  usageEnd: dayjs.unix(usageEnd).toISOString(),
108
108
  rawQuantity,
109
109
  quantity,
110
- // @ts-expect-error 这里有问题
110
+
111
111
  unitAmount: fromUnitToToken(unitAmount, currency.decimal),
112
112
  totalAmount: fromUnitToToken(totalAmount.toString(), currency.decimal),
113
113
  threshold: fromUnitToToken(threshold.toString(), currency.decimal),
@@ -215,7 +215,6 @@ export async function calculateAndUpdateAmount(
215
215
  },
216
216
  });
217
217
 
218
- // @ts-expect-error 这里有问题
219
218
  if (checkoutSession.mode === 'payment' && amount.total <= 0) {
220
219
  throw new Error('Payment amount should be greater than 0');
221
220
  }
@@ -364,7 +364,7 @@ router.get('/:id/refundable-amount', authPortal, async (req, res) => {
364
364
  payouts.forEach((payout) => {
365
365
  totalPayoutAmount = totalPayoutAmount.add(new BN(payout.amount));
366
366
  });
367
- // @ts-expect-error 这里有问题
367
+
368
368
  result.amount = result.amount.sub(totalPayoutAmount);
369
369
  }
370
370
  res.json(result);
@@ -121,7 +121,6 @@ export async function createProductAndPrices(payload: any) {
121
121
  // @ts-ignore
122
122
  ['preset', 'maximum', 'minimum'].forEach((key: keyof CustomUnitAmount) => {
123
123
  if (newPrice.custom_unit_amount?.[key]) {
124
- // @ts-expect-error 这里有问题
125
124
  newPrice.custom_unit_amount[key] = fromTokenToUnit(
126
125
  newPrice.custom_unit_amount[key] as string,
127
126
  currency.decimal
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.2
17
+ version: 1.20.3
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.20.2",
3
+ "version": "1.20.3",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
@@ -55,7 +55,7 @@
55
55
  "@blocklet/error": "^0.2.5",
56
56
  "@blocklet/js-sdk": "^1.16.50",
57
57
  "@blocklet/logger": "^1.16.50",
58
- "@blocklet/payment-react": "1.20.2",
58
+ "@blocklet/payment-react": "1.20.3",
59
59
  "@blocklet/sdk": "^1.16.50",
60
60
  "@blocklet/ui-react": "^3.1.33",
61
61
  "@blocklet/uploader": "^0.2.7",
@@ -124,7 +124,7 @@
124
124
  "devDependencies": {
125
125
  "@abtnode/types": "^1.16.50",
126
126
  "@arcblock/eslint-config-ts": "^0.3.3",
127
- "@blocklet/payment-types": "1.20.2",
127
+ "@blocklet/payment-types": "1.20.3",
128
128
  "@types/cookie-parser": "^1.4.9",
129
129
  "@types/cors": "^2.8.19",
130
130
  "@types/debug": "^4.1.12",
@@ -171,5 +171,5 @@
171
171
  "parser": "typescript"
172
172
  }
173
173
  },
174
- "gitHead": "36e05d39564b602937f83a3b5ab74b3befc1d8cc"
174
+ "gitHead": "984217214ef0b3c3dcfbfcbeb68d7cbab69b750b"
175
175
  }
@@ -54,9 +54,8 @@ export function getAppliedBalance(invoice: TInvoiceExpanded) {
54
54
  invoice.ending_token_balance &&
55
55
  invoice.ending_token_balance[invoice.paymentCurrency.id]
56
56
  ) {
57
- // @ts-expect-error 这里有问题
58
57
  const starting = toBN(invoice.starting_token_balance[invoice.paymentCurrency.id]);
59
- // @ts-expect-error 这里有问题
58
+
60
59
  const ending = toBN(invoice.ending_token_balance[invoice.paymentCurrency.id]);
61
60
  return ending.sub(starting).toString();
62
61
  }
package/src/libs/util.ts CHANGED
@@ -252,7 +252,7 @@ export function stringToColor(str: string) {
252
252
 
253
253
  // @ts-ignore
254
254
  const hash = Hasher.SHA3.hash256(str).slice(-12);
255
- // @ts-expect-error 这里有问题
255
+
256
256
  const index = Math.abs(hexToNumber(hash)) % colors.length;
257
257
  return colors[index];
258
258
  }
@@ -141,7 +141,7 @@ export default function CustomerSubscriptionDetail() {
141
141
  new BN(overdraftProtection.upcoming?.amount).add(new BN(overdraftProtection.gas))
142
142
  );
143
143
  const estimateAmount = +fromUnitToToken(cycleAmount.amount, data.paymentCurrency?.decimal);
144
- // @ts-expect-error 这里有问题
144
+
145
145
  const remainingStake = +fromUnitToToken(overdraftProtection?.unused, data.paymentCurrency?.decimal);
146
146
  const formatEstimatedDuration = (cycles: number) => {
147
147
  if (!data?.pending_invoice_item_interval) return '';