payment-kit 1.13.200 → 1.13.201
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/api/src/routes/subscriptions.ts +16 -10
- package/blocklet.yml +1 -1
- package/package.json +4 -4
|
@@ -681,18 +681,17 @@ router.put('/:id', authPortal, async (req, res) => {
|
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
// handle subscription item changes
|
|
684
|
-
let invoice: Invoice;
|
|
685
684
|
let connectAction = '';
|
|
686
|
-
if (subscription.isActive() === false) {
|
|
687
|
-
throw new Error('Subscription is not active');
|
|
688
|
-
}
|
|
689
|
-
if (subscription.isScheduledToCancel()) {
|
|
690
|
-
throw new Error('Subscription is scheduled to cancel');
|
|
691
|
-
}
|
|
692
|
-
|
|
693
685
|
if (Array.isArray(value.items) && value.items.length > 0) {
|
|
686
|
+
if (subscription.isActive() === false) {
|
|
687
|
+
throw new Error('Updating subscription item not allowed for inactive subscriptions');
|
|
688
|
+
}
|
|
689
|
+
if (subscription.isScheduledToCancel()) {
|
|
690
|
+
throw new Error('Updating subscription item not allowed for scheduled-to-cancel subscriptions');
|
|
691
|
+
}
|
|
692
|
+
|
|
694
693
|
if (paymentMethod.type === 'stripe') {
|
|
695
|
-
throw new Error('
|
|
694
|
+
throw new Error('Updating subscription item not allowed for subscriptions paid with stripe');
|
|
696
695
|
}
|
|
697
696
|
|
|
698
697
|
// validate the request
|
|
@@ -773,7 +772,7 @@ router.put('/:id', authPortal, async (req, res) => {
|
|
|
773
772
|
footer: lastInvoice.footer || '',
|
|
774
773
|
} as Invoice,
|
|
775
774
|
});
|
|
776
|
-
invoice = result
|
|
775
|
+
const { invoice } = result;
|
|
777
776
|
updates.latest_invoice_id = invoice.id;
|
|
778
777
|
logger.info('subscription update invoice created', { subscription: req.params.id, invoice: invoice.id });
|
|
779
778
|
|
|
@@ -869,6 +868,13 @@ router.put('/:id', authPortal, async (req, res) => {
|
|
|
869
868
|
}
|
|
870
869
|
}
|
|
871
870
|
} else if (req.body.billing_cycle_anchor === 'now') {
|
|
871
|
+
if (subscription.isActive() === false) {
|
|
872
|
+
throw new Error('Updating billing_cycle_anchor not allowed for inactive subscriptions');
|
|
873
|
+
}
|
|
874
|
+
if (subscription.isScheduledToCancel()) {
|
|
875
|
+
throw new Error('Updating billing_cycle_anchor not allowed for scheduled-to-cancel subscriptions');
|
|
876
|
+
}
|
|
877
|
+
|
|
872
878
|
// FIXME: handle billing cycle anchor change without any item change
|
|
873
879
|
await subscription.update(updates);
|
|
874
880
|
} else {
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.201",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "cross-env COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev --open",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@arcblock/jwt": "^1.18.113",
|
|
51
51
|
"@arcblock/ux": "^2.9.57",
|
|
52
52
|
"@blocklet/logger": "1.16.24",
|
|
53
|
-
"@blocklet/payment-react": "1.13.
|
|
53
|
+
"@blocklet/payment-react": "1.13.201",
|
|
54
54
|
"@blocklet/sdk": "1.16.24",
|
|
55
55
|
"@blocklet/ui-react": "^2.9.57",
|
|
56
56
|
"@blocklet/uploader": "^0.0.74",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@abtnode/types": "1.16.24",
|
|
112
112
|
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
113
|
-
"@blocklet/payment-types": "1.13.
|
|
113
|
+
"@blocklet/payment-types": "1.13.201",
|
|
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": "
|
|
152
|
+
"gitHead": "0f62c0c55a77845cece0656cc6801847b9dc9e24"
|
|
153
153
|
}
|