@commercengine/storefront-sdk 0.14.4 → 0.14.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.
@@ -156,54 +156,63 @@ var CE_SDK = (function(exports) {
156
156
  method: method.toUpperCase()
157
157
  });
158
158
  },
159
+ /** Call a GET endpoint */
159
160
  GET(url, init) {
160
161
  return coreFetch(url, {
161
162
  ...init,
162
163
  method: "GET"
163
164
  });
164
165
  },
166
+ /** Call a PUT endpoint */
165
167
  PUT(url, init) {
166
168
  return coreFetch(url, {
167
169
  ...init,
168
170
  method: "PUT"
169
171
  });
170
172
  },
173
+ /** Call a POST endpoint */
171
174
  POST(url, init) {
172
175
  return coreFetch(url, {
173
176
  ...init,
174
177
  method: "POST"
175
178
  });
176
179
  },
180
+ /** Call a DELETE endpoint */
177
181
  DELETE(url, init) {
178
182
  return coreFetch(url, {
179
183
  ...init,
180
184
  method: "DELETE"
181
185
  });
182
186
  },
187
+ /** Call a OPTIONS endpoint */
183
188
  OPTIONS(url, init) {
184
189
  return coreFetch(url, {
185
190
  ...init,
186
191
  method: "OPTIONS"
187
192
  });
188
193
  },
194
+ /** Call a HEAD endpoint */
189
195
  HEAD(url, init) {
190
196
  return coreFetch(url, {
191
197
  ...init,
192
198
  method: "HEAD"
193
199
  });
194
200
  },
201
+ /** Call a PATCH endpoint */
195
202
  PATCH(url, init) {
196
203
  return coreFetch(url, {
197
204
  ...init,
198
205
  method: "PATCH"
199
206
  });
200
207
  },
208
+ /** Call a TRACE endpoint */
201
209
  TRACE(url, init) {
202
210
  return coreFetch(url, {
203
211
  ...init,
204
212
  method: "TRACE"
205
213
  });
206
214
  },
215
+ /** Register middleware */
207
216
  use(...middleware) {
208
217
  for (const m of middleware) {
209
218
  if (!m) continue;
@@ -211,6 +220,7 @@ var CE_SDK = (function(exports) {
211
220
  globalMiddlewares.push(m);
212
221
  }
213
222
  },
223
+ /** Unregister middleware */
214
224
  eject(...middleware) {
215
225
  for (const m of middleware) {
216
226
  const i = globalMiddlewares.indexOf(m);
@@ -828,9 +838,8 @@ var CE_SDK = (function(exports) {
828
838
  */
829
839
  function buildStorefrontURL(config) {
830
840
  if (config.baseUrl) return config.baseUrl;
831
- switch (config.environment || Environment.Production) {
832
- case Environment.Staging: return `https://staging.api.commercengine.io/api/v1/${config.storeId}/storefront`;
833
- case Environment.Production:
841
+ switch (config.environment || "production") {
842
+ case "staging": return `https://staging.api.commercengine.io/api/v1/${config.storeId}/storefront`;
834
843
  default: return `https://prod.api.commercengine.io/api/v1/${config.storeId}/storefront`;
835
844
  }
836
845
  }
@@ -3513,6 +3522,33 @@ var CE_SDK = (function(exports) {
3513
3522
  async resendDirectOtp(body) {
3514
3523
  return this.executeRequest(() => this.client.POST("/payments/resend-direct-otp", { body }));
3515
3524
  }
3525
+ /**
3526
+ * Verify an IFSC code and resolve its bank branch details
3527
+ *
3528
+ * @description Resolves an 11-character Indian Financial System Code (IFSC) to bank,
3529
+ * branch, and supported payment rail details. Useful for validating user-entered IFSC
3530
+ * codes before creating bank accounts or mandates.
3531
+ *
3532
+ * @param pathParams - Path parameters containing the IFSC code
3533
+ * @returns Promise with IFSC details
3534
+ * @example
3535
+ * ```typescript
3536
+ * const { data, error } = await sdk.payments.verifyIfscCode({
3537
+ * ifsc_code: "HDFC0001234"
3538
+ * });
3539
+ *
3540
+ * if (error) {
3541
+ * console.error("Failed to verify IFSC:", error.message);
3542
+ * } else {
3543
+ * console.log("Bank:", data.ifsc.bank);
3544
+ * console.log("Branch:", data.ifsc.branch);
3545
+ * console.log("Supports UPI:", data.ifsc.upi);
3546
+ * }
3547
+ * ```
3548
+ */
3549
+ async verifyIfscCode(pathParams) {
3550
+ return this.executeRequest(() => this.client.GET("/payments/ifsc-lookup/{ifsc_code}", { params: { path: pathParams } }));
3551
+ }
3516
3552
  };
3517
3553
  //#endregion
3518
3554
  //#region src/lib/shared/helper.ts
@@ -3718,6 +3754,100 @@ var CE_SDK = (function(exports) {
3718
3754
  const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3719
3755
  return this.executeRequest(() => this.client.GET("/customers/{customer_id}/cards", { params: { path: resolvedPathParams } }));
3720
3756
  }
3757
+ async listBankAccounts(pathParamsOrQuery, queryParams) {
3758
+ const hasPathParams = queryParams !== void 0 || !!pathParamsOrQuery && typeof pathParamsOrQuery === "object" && "customer_id" in pathParamsOrQuery;
3759
+ const pathParams = hasPathParams ? pathParamsOrQuery : {};
3760
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3761
+ const resolvedQueryParams = hasPathParams ? queryParams : pathParamsOrQuery;
3762
+ return this.executeRequest(() => this.client.GET("/customers/{customer_id}/bank-accounts", { params: {
3763
+ path: resolvedPathParams,
3764
+ query: resolvedQueryParams
3765
+ } }));
3766
+ }
3767
+ async createBankAccount(pathParamsOrBody, maybeBody) {
3768
+ const pathParams = maybeBody ? pathParamsOrBody : {};
3769
+ const body = maybeBody ?? pathParamsOrBody;
3770
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3771
+ return this.executeRequest(() => this.client.POST("/customers/{customer_id}/bank-accounts", {
3772
+ params: { path: resolvedPathParams },
3773
+ body
3774
+ }));
3775
+ }
3776
+ async getBankAccount(pathParams) {
3777
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3778
+ return this.executeRequest(() => this.client.GET("/customers/{customer_id}/bank-accounts/{account_id}", { params: { path: resolvedPathParams } }));
3779
+ }
3780
+ async updateBankAccount(pathParams, body) {
3781
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3782
+ return this.executeRequest(() => this.client.PUT("/customers/{customer_id}/bank-accounts/{account_id}", {
3783
+ params: { path: resolvedPathParams },
3784
+ body
3785
+ }));
3786
+ }
3787
+ async deleteBankAccount(pathParams) {
3788
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3789
+ return this.executeRequest(() => this.client.DELETE("/customers/{customer_id}/bank-accounts/{account_id}", { params: { path: resolvedPathParams } }));
3790
+ }
3791
+ async verifyBankAccount(pathParams, body) {
3792
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3793
+ return this.executeRequest(() => this.client.POST("/customers/{customer_id}/bank-accounts/{account_id}/verify", {
3794
+ params: { path: resolvedPathParams },
3795
+ body
3796
+ }));
3797
+ }
3798
+ async getCreditLineBalance(pathParams = {}) {
3799
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3800
+ return this.executeRequest(() => this.client.GET("/customers/{customer_id}/credit-line-balance", { params: { path: resolvedPathParams } }));
3801
+ }
3802
+ async listMandates(pathParams = {}) {
3803
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3804
+ return this.executeRequest(() => this.client.GET("/customers/{customer_id}/mandates", { params: { path: resolvedPathParams } }));
3805
+ }
3806
+ async createMandate(pathParamsOrBody, maybeBody) {
3807
+ const pathParams = maybeBody ? pathParamsOrBody : {};
3808
+ const body = maybeBody ?? pathParamsOrBody;
3809
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3810
+ return this.executeRequest(() => this.client.POST("/customers/{customer_id}/mandates", {
3811
+ params: { path: resolvedPathParams },
3812
+ body
3813
+ }));
3814
+ }
3815
+ async getMandate(pathParams, queryParams) {
3816
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3817
+ return this.executeRequest(() => this.client.GET("/customers/{customer_id}/mandates/{mandate_id}", { params: {
3818
+ path: resolvedPathParams,
3819
+ query: queryParams
3820
+ } }));
3821
+ }
3822
+ async updateMandate(pathParams, body) {
3823
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3824
+ return this.executeRequest(() => this.client.PUT("/customers/{customer_id}/mandates/{mandate_id}", {
3825
+ params: { path: resolvedPathParams },
3826
+ body
3827
+ }));
3828
+ }
3829
+ async pauseMandate(pathParams) {
3830
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3831
+ return this.executeRequest(() => this.client.POST("/customers/{customer_id}/mandates/{mandate_id}/pause", { params: { path: resolvedPathParams } }));
3832
+ }
3833
+ async resumeMandate(pathParams) {
3834
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3835
+ return this.executeRequest(() => this.client.POST("/customers/{customer_id}/mandates/{mandate_id}/resume", { params: { path: resolvedPathParams } }));
3836
+ }
3837
+ async revokeMandate(pathParams) {
3838
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3839
+ return this.executeRequest(() => this.client.POST("/customers/{customer_id}/mandates/{mandate_id}/revoke", { params: { path: resolvedPathParams } }));
3840
+ }
3841
+ async listMandateDebitSchedules(pathParamsOrQuery, queryParams) {
3842
+ const hasPathParams = queryParams !== void 0 || !!pathParamsOrQuery && typeof pathParamsOrQuery === "object" && "customer_id" in pathParamsOrQuery;
3843
+ const pathParams = hasPathParams ? pathParamsOrQuery : {};
3844
+ const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
3845
+ const resolvedQueryParams = hasPathParams ? queryParams : pathParamsOrQuery;
3846
+ return this.executeRequest(() => this.client.GET("/customers/{customer_id}/mandate-debit-schedules", { params: {
3847
+ path: resolvedPathParams,
3848
+ query: resolvedQueryParams
3849
+ } }));
3850
+ }
3721
3851
  };
3722
3852
  //#endregion
3723
3853
  //#region src/lib/shared/store-config.ts