@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.
- package/dist/index.d.mts +1515 -24
- package/dist/index.iife.js +133 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +123 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -450,9 +450,8 @@ let Environment = /* @__PURE__ */ function(Environment) {
|
|
|
450
450
|
*/
|
|
451
451
|
function buildStorefrontURL(config) {
|
|
452
452
|
if (config.baseUrl) return config.baseUrl;
|
|
453
|
-
switch (config.environment ||
|
|
454
|
-
case
|
|
455
|
-
case Environment.Production:
|
|
453
|
+
switch (config.environment || "production") {
|
|
454
|
+
case "staging": return `https://staging.api.commercengine.io/api/v1/${config.storeId}/storefront`;
|
|
456
455
|
default: return `https://prod.api.commercengine.io/api/v1/${config.storeId}/storefront`;
|
|
457
456
|
}
|
|
458
457
|
}
|
|
@@ -3135,6 +3134,33 @@ var PaymentsClient = class extends SessionStorefrontAPIClient {
|
|
|
3135
3134
|
async resendDirectOtp(body) {
|
|
3136
3135
|
return this.executeRequest(() => this.client.POST("/payments/resend-direct-otp", { body }));
|
|
3137
3136
|
}
|
|
3137
|
+
/**
|
|
3138
|
+
* Verify an IFSC code and resolve its bank branch details
|
|
3139
|
+
*
|
|
3140
|
+
* @description Resolves an 11-character Indian Financial System Code (IFSC) to bank,
|
|
3141
|
+
* branch, and supported payment rail details. Useful for validating user-entered IFSC
|
|
3142
|
+
* codes before creating bank accounts or mandates.
|
|
3143
|
+
*
|
|
3144
|
+
* @param pathParams - Path parameters containing the IFSC code
|
|
3145
|
+
* @returns Promise with IFSC details
|
|
3146
|
+
* @example
|
|
3147
|
+
* ```typescript
|
|
3148
|
+
* const { data, error } = await sdk.payments.verifyIfscCode({
|
|
3149
|
+
* ifsc_code: "HDFC0001234"
|
|
3150
|
+
* });
|
|
3151
|
+
*
|
|
3152
|
+
* if (error) {
|
|
3153
|
+
* console.error("Failed to verify IFSC:", error.message);
|
|
3154
|
+
* } else {
|
|
3155
|
+
* console.log("Bank:", data.ifsc.bank);
|
|
3156
|
+
* console.log("Branch:", data.ifsc.branch);
|
|
3157
|
+
* console.log("Supports UPI:", data.ifsc.upi);
|
|
3158
|
+
* }
|
|
3159
|
+
* ```
|
|
3160
|
+
*/
|
|
3161
|
+
async verifyIfscCode(pathParams) {
|
|
3162
|
+
return this.executeRequest(() => this.client.GET("/payments/ifsc-lookup/{ifsc_code}", { params: { path: pathParams } }));
|
|
3163
|
+
}
|
|
3138
3164
|
};
|
|
3139
3165
|
//#endregion
|
|
3140
3166
|
//#region src/lib/shared/helper.ts
|
|
@@ -3340,6 +3366,100 @@ var CustomerClient = class extends SessionStorefrontAPIClient {
|
|
|
3340
3366
|
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3341
3367
|
return this.executeRequest(() => this.client.GET("/customers/{customer_id}/cards", { params: { path: resolvedPathParams } }));
|
|
3342
3368
|
}
|
|
3369
|
+
async listBankAccounts(pathParamsOrQuery, queryParams) {
|
|
3370
|
+
const hasPathParams = queryParams !== void 0 || !!pathParamsOrQuery && typeof pathParamsOrQuery === "object" && "customer_id" in pathParamsOrQuery;
|
|
3371
|
+
const pathParams = hasPathParams ? pathParamsOrQuery : {};
|
|
3372
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3373
|
+
const resolvedQueryParams = hasPathParams ? queryParams : pathParamsOrQuery;
|
|
3374
|
+
return this.executeRequest(() => this.client.GET("/customers/{customer_id}/bank-accounts", { params: {
|
|
3375
|
+
path: resolvedPathParams,
|
|
3376
|
+
query: resolvedQueryParams
|
|
3377
|
+
} }));
|
|
3378
|
+
}
|
|
3379
|
+
async createBankAccount(pathParamsOrBody, maybeBody) {
|
|
3380
|
+
const pathParams = maybeBody ? pathParamsOrBody : {};
|
|
3381
|
+
const body = maybeBody ?? pathParamsOrBody;
|
|
3382
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3383
|
+
return this.executeRequest(() => this.client.POST("/customers/{customer_id}/bank-accounts", {
|
|
3384
|
+
params: { path: resolvedPathParams },
|
|
3385
|
+
body
|
|
3386
|
+
}));
|
|
3387
|
+
}
|
|
3388
|
+
async getBankAccount(pathParams) {
|
|
3389
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3390
|
+
return this.executeRequest(() => this.client.GET("/customers/{customer_id}/bank-accounts/{account_id}", { params: { path: resolvedPathParams } }));
|
|
3391
|
+
}
|
|
3392
|
+
async updateBankAccount(pathParams, body) {
|
|
3393
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3394
|
+
return this.executeRequest(() => this.client.PUT("/customers/{customer_id}/bank-accounts/{account_id}", {
|
|
3395
|
+
params: { path: resolvedPathParams },
|
|
3396
|
+
body
|
|
3397
|
+
}));
|
|
3398
|
+
}
|
|
3399
|
+
async deleteBankAccount(pathParams) {
|
|
3400
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3401
|
+
return this.executeRequest(() => this.client.DELETE("/customers/{customer_id}/bank-accounts/{account_id}", { params: { path: resolvedPathParams } }));
|
|
3402
|
+
}
|
|
3403
|
+
async verifyBankAccount(pathParams, body) {
|
|
3404
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3405
|
+
return this.executeRequest(() => this.client.POST("/customers/{customer_id}/bank-accounts/{account_id}/verify", {
|
|
3406
|
+
params: { path: resolvedPathParams },
|
|
3407
|
+
body
|
|
3408
|
+
}));
|
|
3409
|
+
}
|
|
3410
|
+
async getCreditLineBalance(pathParams = {}) {
|
|
3411
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3412
|
+
return this.executeRequest(() => this.client.GET("/customers/{customer_id}/credit-line-balance", { params: { path: resolvedPathParams } }));
|
|
3413
|
+
}
|
|
3414
|
+
async listMandates(pathParams = {}) {
|
|
3415
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3416
|
+
return this.executeRequest(() => this.client.GET("/customers/{customer_id}/mandates", { params: { path: resolvedPathParams } }));
|
|
3417
|
+
}
|
|
3418
|
+
async createMandate(pathParamsOrBody, maybeBody) {
|
|
3419
|
+
const pathParams = maybeBody ? pathParamsOrBody : {};
|
|
3420
|
+
const body = maybeBody ?? pathParamsOrBody;
|
|
3421
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3422
|
+
return this.executeRequest(() => this.client.POST("/customers/{customer_id}/mandates", {
|
|
3423
|
+
params: { path: resolvedPathParams },
|
|
3424
|
+
body
|
|
3425
|
+
}));
|
|
3426
|
+
}
|
|
3427
|
+
async getMandate(pathParams, queryParams) {
|
|
3428
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3429
|
+
return this.executeRequest(() => this.client.GET("/customers/{customer_id}/mandates/{mandate_id}", { params: {
|
|
3430
|
+
path: resolvedPathParams,
|
|
3431
|
+
query: queryParams
|
|
3432
|
+
} }));
|
|
3433
|
+
}
|
|
3434
|
+
async updateMandate(pathParams, body) {
|
|
3435
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3436
|
+
return this.executeRequest(() => this.client.PUT("/customers/{customer_id}/mandates/{mandate_id}", {
|
|
3437
|
+
params: { path: resolvedPathParams },
|
|
3438
|
+
body
|
|
3439
|
+
}));
|
|
3440
|
+
}
|
|
3441
|
+
async pauseMandate(pathParams) {
|
|
3442
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3443
|
+
return this.executeRequest(() => this.client.POST("/customers/{customer_id}/mandates/{mandate_id}/pause", { params: { path: resolvedPathParams } }));
|
|
3444
|
+
}
|
|
3445
|
+
async resumeMandate(pathParams) {
|
|
3446
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3447
|
+
return this.executeRequest(() => this.client.POST("/customers/{customer_id}/mandates/{mandate_id}/resume", { params: { path: resolvedPathParams } }));
|
|
3448
|
+
}
|
|
3449
|
+
async revokeMandate(pathParams) {
|
|
3450
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3451
|
+
return this.executeRequest(() => this.client.POST("/customers/{customer_id}/mandates/{mandate_id}/revoke", { params: { path: resolvedPathParams } }));
|
|
3452
|
+
}
|
|
3453
|
+
async listMandateDebitSchedules(pathParamsOrQuery, queryParams) {
|
|
3454
|
+
const hasPathParams = queryParams !== void 0 || !!pathParamsOrQuery && typeof pathParamsOrQuery === "object" && "customer_id" in pathParamsOrQuery;
|
|
3455
|
+
const pathParams = hasPathParams ? pathParamsOrQuery : {};
|
|
3456
|
+
const resolvedPathParams = await this.resolveCustomerPathParams(pathParams);
|
|
3457
|
+
const resolvedQueryParams = hasPathParams ? queryParams : pathParamsOrQuery;
|
|
3458
|
+
return this.executeRequest(() => this.client.GET("/customers/{customer_id}/mandate-debit-schedules", { params: {
|
|
3459
|
+
path: resolvedPathParams,
|
|
3460
|
+
query: resolvedQueryParams
|
|
3461
|
+
} }));
|
|
3462
|
+
}
|
|
3343
3463
|
};
|
|
3344
3464
|
//#endregion
|
|
3345
3465
|
//#region src/lib/shared/store-config.ts
|