@deliverart/sdk-js-subscription 2.13.7 → 2.14.1
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/README.md +17 -4
- package/dist/index.cjs +16 -14
- package/dist/index.d.cts +81 -850
- package/dist/index.d.ts +81 -850
- package/dist/index.js +14 -15
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Subscription management package for the Deliverart JavaScript SDK.
|
|
|
11
11
|
- renewal CRUD for `consumption` and `time_based`
|
|
12
12
|
- subscription overview from point of sale
|
|
13
13
|
- credit adjustments for consumption subscriptions
|
|
14
|
-
- renewal payment initialization for `stripe
|
|
14
|
+
- renewal payment initialization for `stripe` and `bank_transfer`
|
|
15
15
|
- manual renewal payment resolution for offline payment methods
|
|
16
16
|
- purchase lifecycle actions: `cancel`, `retry_payment`, `refund`
|
|
17
17
|
- renewal lifecycle actions: `cancel`, `retry_payment`, `refund`
|
|
@@ -79,10 +79,16 @@ Start payment for the purchase:
|
|
|
79
79
|
import { PaySubscriptionPurchase } from '@deliverart/sdk-js-subscription'
|
|
80
80
|
|
|
81
81
|
const payment = await sdk.call(
|
|
82
|
-
new PaySubscriptionPurchase('purchase-id', '
|
|
82
|
+
new PaySubscriptionPurchase('purchase-id', 'bank_transfer'),
|
|
83
83
|
)
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
+
Subscription billing is platform-level:
|
|
87
|
+
|
|
88
|
+
- order and ecommerce payments still use each POS payment configuration
|
|
89
|
+
- subscription purchases and renewals use the central platform billing account
|
|
90
|
+
- the SDK therefore accepts only `stripe` and `bank_transfer` for subscription payment start and retry
|
|
91
|
+
|
|
86
92
|
Resolve offline payment:
|
|
87
93
|
|
|
88
94
|
```ts
|
|
@@ -96,6 +102,9 @@ await sdk.call(
|
|
|
96
102
|
)
|
|
97
103
|
```
|
|
98
104
|
|
|
105
|
+
For `bank_transfer`, the purchase or renewal moves to `pending_verification` until a
|
|
106
|
+
`ROLE_SUBSCRIPTION_ADMIN` approves or rejects it.
|
|
107
|
+
|
|
99
108
|
Cancel a non-completed purchase:
|
|
100
109
|
|
|
101
110
|
```ts
|
|
@@ -114,10 +123,12 @@ Retry a failed purchase payment:
|
|
|
114
123
|
import { RetrySubscriptionPurchasePayment } from '@deliverart/sdk-js-subscription'
|
|
115
124
|
|
|
116
125
|
const payment = await sdk.call(
|
|
117
|
-
new RetrySubscriptionPurchasePayment('purchase-id', '
|
|
126
|
+
new RetrySubscriptionPurchasePayment('purchase-id', 'bank_transfer'),
|
|
118
127
|
)
|
|
119
128
|
```
|
|
120
129
|
|
|
130
|
+
If the retry method is `bank_transfer`, the returned purchase status becomes `pending_verification`.
|
|
131
|
+
|
|
121
132
|
Refund a completed offline purchase:
|
|
122
133
|
|
|
123
134
|
```ts
|
|
@@ -184,6 +195,8 @@ await sdk.call(
|
|
|
184
195
|
|
|
185
196
|
Allowed statuses are `paid`, `failed` and `canceled`.
|
|
186
197
|
|
|
198
|
+
The renewal must typically be in `pending_verification` before manual approval.
|
|
199
|
+
|
|
187
200
|
## Renewal Lifecycle Actions
|
|
188
201
|
|
|
189
202
|
Consumption renewal:
|
|
@@ -228,7 +241,7 @@ await sdk.call(
|
|
|
228
241
|
)
|
|
229
242
|
|
|
230
243
|
const payment = await sdk.call(
|
|
231
|
-
new RetrySubscriptionTimeBasedRenewalPayment('renewal-id', '
|
|
244
|
+
new RetrySubscriptionTimeBasedRenewalPayment('renewal-id', 'bank_transfer'),
|
|
232
245
|
)
|
|
233
246
|
|
|
234
247
|
await sdk.call(
|
package/dist/index.cjs
CHANGED
|
@@ -205,8 +205,6 @@ __export(index_exports, {
|
|
|
205
205
|
paySubscriptionTimeBasedRenewalInputSchema: () => paySubscriptionTimeBasedRenewalInputSchema,
|
|
206
206
|
paySubscriptionTimeBasedRenewalResponseSchema: () => paySubscriptionTimeBasedRenewalResponseSchema,
|
|
207
207
|
paymentIriSchema: () => paymentIriSchema,
|
|
208
|
-
paymentMethodSchema: () => import_sdk_js_global_types2.paymentMethodSchema,
|
|
209
|
-
paymentMethods: () => import_sdk_js_global_types2.paymentMethods,
|
|
210
208
|
paymentNullableIriSchema: () => paymentNullableIriSchema,
|
|
211
209
|
paymentStatusSchema: () => import_sdk_js_global_types2.paymentStatusSchema,
|
|
212
210
|
paymentStatuses: () => import_sdk_js_global_types2.paymentStatuses,
|
|
@@ -256,6 +254,8 @@ __export(index_exports, {
|
|
|
256
254
|
subscriptionOverviewPlanSchema: () => subscriptionOverviewPlanSchema,
|
|
257
255
|
subscriptionOverviewResponseSchema: () => subscriptionOverviewResponseSchema,
|
|
258
256
|
subscriptionOverviewSubscriptionSchema: () => subscriptionOverviewSubscriptionSchema,
|
|
257
|
+
subscriptionPaymentMethodSchema: () => subscriptionPaymentMethodSchema,
|
|
258
|
+
subscriptionPaymentMethods: () => subscriptionPaymentMethods,
|
|
259
259
|
subscriptionPlanIriSchema: () => subscriptionPlanIriSchema,
|
|
260
260
|
subscriptionPlanNullableIriSchema: () => subscriptionPlanNullableIriSchema,
|
|
261
261
|
subscriptionPlanPriceOptionSchema: () => subscriptionPlanPriceOptionSchema,
|
|
@@ -14092,6 +14092,8 @@ config(en_default());
|
|
|
14092
14092
|
// src/types.ts
|
|
14093
14093
|
var import_sdk_js_global_types = require("@deliverart/sdk-js-global-types");
|
|
14094
14094
|
var import_sdk_js_global_types2 = require("@deliverart/sdk-js-global-types");
|
|
14095
|
+
var subscriptionPaymentMethods = ["stripe", "bank_transfer"];
|
|
14096
|
+
var subscriptionPaymentMethodSchema = external_exports.enum(subscriptionPaymentMethods);
|
|
14095
14097
|
var adjustableCreditTransactionTypes = [
|
|
14096
14098
|
"gift",
|
|
14097
14099
|
"bonus",
|
|
@@ -14107,7 +14109,13 @@ var subscriptionAvailabilityReasons = [
|
|
|
14107
14109
|
"operation_not_allowed"
|
|
14108
14110
|
];
|
|
14109
14111
|
var subscriptionAvailabilityReasonSchema = external_exports.enum(subscriptionAvailabilityReasons);
|
|
14110
|
-
var subscriptionPurchaseStatuses = [
|
|
14112
|
+
var subscriptionPurchaseStatuses = [
|
|
14113
|
+
"pending",
|
|
14114
|
+
"pending_verification",
|
|
14115
|
+
"completed",
|
|
14116
|
+
"cancelled",
|
|
14117
|
+
"failed"
|
|
14118
|
+
];
|
|
14111
14119
|
var subscriptionPurchaseStatusSchema = external_exports.enum(subscriptionPurchaseStatuses);
|
|
14112
14120
|
var resolvableRenewalPaymentStatuses = ["paid", "failed", "canceled"];
|
|
14113
14121
|
var resolvableRenewalPaymentStatusSchema = external_exports.enum(resolvableRenewalPaymentStatuses);
|
|
@@ -14294,7 +14302,7 @@ var subscriptionPurchaseSchema = external_exports.object({
|
|
|
14294
14302
|
startsAt: subscriptionDateSchema,
|
|
14295
14303
|
threshold: external_exports.coerce.number().int().nonnegative(),
|
|
14296
14304
|
amount: external_exports.string(),
|
|
14297
|
-
paymentMethod:
|
|
14305
|
+
paymentMethod: subscriptionPaymentMethodSchema.nullable(),
|
|
14298
14306
|
paymentStatus: import_sdk_js_global_types3.paymentStatusSchema.nullable(),
|
|
14299
14307
|
createdAt: import_sdk_js_global_types3.datetimeSchema,
|
|
14300
14308
|
updatedAt: import_sdk_js_global_types3.datetimeSchema
|
|
@@ -14343,11 +14351,11 @@ var adjustSubscriptionConsumptionCreditsInputSchema = external_exports.object({
|
|
|
14343
14351
|
}
|
|
14344
14352
|
});
|
|
14345
14353
|
var paySubscriptionRenewalInputSchema = external_exports.object({
|
|
14346
|
-
method:
|
|
14354
|
+
method: subscriptionPaymentMethodSchema
|
|
14347
14355
|
});
|
|
14348
14356
|
var paymentInfoBaseSchema = external_exports.object({
|
|
14349
14357
|
id: external_exports.string(),
|
|
14350
|
-
method:
|
|
14358
|
+
method: subscriptionPaymentMethodSchema,
|
|
14351
14359
|
status: import_sdk_js_global_types3.paymentStatusSchema,
|
|
14352
14360
|
amount: external_exports.string()
|
|
14353
14361
|
});
|
|
@@ -14366,12 +14374,6 @@ var subscriptionRenewalPaymentInfoSchema = external_exports.discriminatedUnion("
|
|
|
14366
14374
|
bankAddress: external_exports.string().nullable(),
|
|
14367
14375
|
currency: external_exports.string(),
|
|
14368
14376
|
description: external_exports.string()
|
|
14369
|
-
}),
|
|
14370
|
-
paymentInfoBaseSchema.extend({
|
|
14371
|
-
method: external_exports.literal("cash")
|
|
14372
|
-
}),
|
|
14373
|
-
paymentInfoBaseSchema.extend({
|
|
14374
|
-
method: external_exports.literal("credit_card")
|
|
14375
14377
|
})
|
|
14376
14378
|
]);
|
|
14377
14379
|
var resolveSubscriptionRenewalPaymentInputSchema = external_exports.object({
|
|
@@ -16311,8 +16313,6 @@ var UpdateSubscription = class extends import_sdk_js_core68.AbstractApiRequest {
|
|
|
16311
16313
|
paySubscriptionTimeBasedRenewalInputSchema,
|
|
16312
16314
|
paySubscriptionTimeBasedRenewalResponseSchema,
|
|
16313
16315
|
paymentIriSchema,
|
|
16314
|
-
paymentMethodSchema,
|
|
16315
|
-
paymentMethods,
|
|
16316
16316
|
paymentNullableIriSchema,
|
|
16317
16317
|
paymentStatusSchema,
|
|
16318
16318
|
paymentStatuses,
|
|
@@ -16362,6 +16362,8 @@ var UpdateSubscription = class extends import_sdk_js_core68.AbstractApiRequest {
|
|
|
16362
16362
|
subscriptionOverviewPlanSchema,
|
|
16363
16363
|
subscriptionOverviewResponseSchema,
|
|
16364
16364
|
subscriptionOverviewSubscriptionSchema,
|
|
16365
|
+
subscriptionPaymentMethodSchema,
|
|
16366
|
+
subscriptionPaymentMethods,
|
|
16365
16367
|
subscriptionPlanIriSchema,
|
|
16366
16368
|
subscriptionPlanNullableIriSchema,
|
|
16367
16369
|
subscriptionPlanPriceOptionSchema,
|