@youidian/sdk 3.4.4 → 3.4.5
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/dist/index.cjs +24 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +24 -0
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +37 -2
- package/dist/server.d.ts +37 -2
- package/dist/server.js +24 -0
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3240,6 +3240,30 @@ var PaymentClient = class {
|
|
|
3240
3240
|
const path = params.toString() ? `/products?${params.toString()}` : "/products";
|
|
3241
3241
|
return this.request("GET", path);
|
|
3242
3242
|
}
|
|
3243
|
+
/** Fetch all currently active discount policies for the configured app. */
|
|
3244
|
+
async getDiscountPolicies() {
|
|
3245
|
+
return this.request("GET", "/discount-policies");
|
|
3246
|
+
}
|
|
3247
|
+
/** Fetch currently active discount policies for one product. */
|
|
3248
|
+
async getProductDiscountPolicies(productIdOrCode) {
|
|
3249
|
+
const value = productIdOrCode?.trim();
|
|
3250
|
+
if (!value) throw new Error("productIdOrCode is required");
|
|
3251
|
+
return this.request(
|
|
3252
|
+
"GET",
|
|
3253
|
+
`/products/${encodeURIComponent(value)}/discount-policies`
|
|
3254
|
+
);
|
|
3255
|
+
}
|
|
3256
|
+
/** Query one user's discount eligibility for one product. */
|
|
3257
|
+
async getUserProductDiscountEligibility(userId, productIdOrCode) {
|
|
3258
|
+
const userValue = userId?.trim();
|
|
3259
|
+
const productValue = productIdOrCode?.trim();
|
|
3260
|
+
if (!userValue) throw new Error("userId is required");
|
|
3261
|
+
if (!productValue) throw new Error("productIdOrCode is required");
|
|
3262
|
+
return this.request(
|
|
3263
|
+
"GET",
|
|
3264
|
+
`/users/${encodeURIComponent(userValue)}/products/${encodeURIComponent(productValue)}/discount-eligibility`
|
|
3265
|
+
);
|
|
3266
|
+
}
|
|
3243
3267
|
/**
|
|
3244
3268
|
* Fetch the realtime stock snapshot for a single product.
|
|
3245
3269
|
*/
|