@youidian/sdk 3.4.3 → 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 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
  */
@@ -3512,6 +3536,17 @@ var PaymentClient = class {
3512
3536
  }
3513
3537
  );
3514
3538
  }
3539
+ /**
3540
+ * Query the verified phone binding for a hosted login user.
3541
+ */
3542
+ async getPhoneBinding(params) {
3543
+ const userId = params.userId?.trim();
3544
+ if (!userId) throw new Error("userId is required");
3545
+ return this.request(
3546
+ "GET",
3547
+ `/login/users/${encodeURIComponent(userId)}/phone`
3548
+ );
3549
+ }
3515
3550
  /**
3516
3551
  * Bind a verified phone number to a hosted login user, merging existing accounts when needed.
3517
3552
  */
@@ -3532,6 +3567,26 @@ var PaymentClient = class {
3532
3567
  }
3533
3568
  );
3534
3569
  }
3570
+ /**
3571
+ * Update a hosted login user's phone number after verifying the new number by SMS code.
3572
+ */
3573
+ async updatePhoneNumber(params) {
3574
+ const userId = params.userId?.trim();
3575
+ const phoneNumber = params.phoneNumber?.trim();
3576
+ const code = params.code?.trim();
3577
+ if (!userId) throw new Error("userId is required");
3578
+ if (!phoneNumber) throw new Error("phoneNumber is required");
3579
+ if (!code) throw new Error("code is required");
3580
+ return this.request(
3581
+ "PUT",
3582
+ `/login/users/${encodeURIComponent(userId)}/phone`,
3583
+ {
3584
+ code,
3585
+ phoneCountryCode: params.phoneCountryCode || params.countryCode,
3586
+ phoneNumber
3587
+ }
3588
+ );
3589
+ }
3535
3590
  /**
3536
3591
  * Create a hosted WeChat official account binding URL for a user.
3537
3592
  */