payment-kit 1.13.93 → 1.13.95

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.
@@ -101,16 +101,12 @@ export function getRecurringPeriod(recurring: PriceRecurring) {
101
101
 
102
102
  export function getSubscriptionCreateSetup(items: TLineItemExpanded[], currencyId: string, trialInDays = 0) {
103
103
  let setup = new BN(0);
104
- let subscription = new BN(0);
105
104
 
106
105
  items.forEach((x) => {
107
106
  const price = x.upsell_price || x.price;
108
107
  const unit = getPriceUintAmountByCurrency(price, currencyId);
109
- setup = setup.add(new BN(unit).mul(new BN(x.quantity)));
110
- if (price.type === 'recurring') {
111
- if (trialInDays === 0) {
112
- subscription = subscription.add(new BN(unit).mul(new BN(x.quantity)));
113
- }
108
+ if (price.type === 'one_time' || (price.type === 'recurring' && price.recurring?.usage_type === 'licensed')) {
109
+ setup = setup.add(new BN(unit).mul(new BN(x.quantity)));
114
110
  }
115
111
  });
116
112
 
@@ -137,7 +133,6 @@ export function getSubscriptionCreateSetup(items: TLineItemExpanded[], currencyI
137
133
  },
138
134
  amount: {
139
135
  setup: setup.toString(),
140
- subscription: subscription.toString(),
141
136
  },
142
137
  };
143
138
  }
@@ -610,7 +610,7 @@ const updateSchema = Joi.object<{
610
610
  .default([]),
611
611
  });
612
612
  // eslint-disable-next-line consistent-return
613
- router.put('/:id', auth, async (req, res) => {
613
+ router.put('/:id', authPortal, async (req, res) => {
614
614
  logger.debug('subscription update request', { subscription: req.params.id, body: req.body });
615
615
  try {
616
616
  const { error } = updateSchema.validate(req.body);
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.13.93
17
+ version: 1.13.95
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.13.93",
3
+ "version": "1.13.95",
4
4
  "scripts": {
5
5
  "dev": "COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev",
6
6
  "eject": "vite eject",
@@ -110,7 +110,7 @@
110
110
  "@abtnode/types": "1.16.21",
111
111
  "@arcblock/eslint-config": "^0.2.4",
112
112
  "@arcblock/eslint-config-ts": "^0.2.4",
113
- "@did-pay/types": "1.13.93",
113
+ "@did-pay/types": "1.13.95",
114
114
  "@types/cookie-parser": "^1.4.6",
115
115
  "@types/cors": "^2.8.17",
116
116
  "@types/dotenv-flow": "^3.3.3",
@@ -149,5 +149,5 @@
149
149
  "parser": "typescript"
150
150
  }
151
151
  },
152
- "gitHead": "4dde3429a2afb759e61e9c28f7342b3681b843cb"
152
+ "gitHead": "7cdc672350689926b95a75edc7db8e08007ab6dd"
153
153
  }