From 51cd366cb50722cae7eb1b513ca3dea78fd96e9c Mon Sep 17 00:00:00 2001 From: Ankit Das <89454448+ankitdas13@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:50:20 +0530 Subject: [PATCH] remove type check validation (#422) --- lib/resources/subscriptions.js | 6 ------ lib/types/subscriptions.d.ts | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/resources/subscriptions.js b/lib/resources/subscriptions.js index e99044e7..78fbcf35 100644 --- a/lib/resources/subscriptions.js +++ b/lib/resources/subscriptions.js @@ -246,12 +246,6 @@ module.exports = function subscriptionsApi (api) { return Promise.reject(MISSING_ID_ERROR); } - if (typeof cancelAtCycleEnd !== "boolean") { - - return Promise.reject("The second parameter, Cancel at the end of cycle" + - " should be a Boolean"); - } - return api.post({ url, ...(cancelAtCycleEnd && {data: {cancel_at_cycle_end: 1}}) diff --git a/lib/types/subscriptions.d.ts b/lib/types/subscriptions.d.ts index 1f171f58..86236d6c 100644 --- a/lib/types/subscriptions.d.ts +++ b/lib/types/subscriptions.d.ts @@ -356,11 +356,11 @@ declare function subscriptions(api: any): { * Cancel a subscription given id and optional cancelAtCycleEnd * * @param subscriptionId - The unique identifier of the Subscription. - * @param cancelAtCycleEnd - `false` (default): Cancel the subscription immediately. + * @param cancelAtCycleEnd - `false` or `0` (default): Cancel the subscription immediately. * */ - cancel(subscriptionId: string, cancelAtCycleEnd?: boolean): Promise - cancel(subscriptionId: string, cancelAtCycleEnd: boolean, callback: (err: INormalizeError | null, data: Subscriptions.RazorpaySubscription) => void): void; + cancel(subscriptionId: string, cancelAtCycleEnd?: boolean | number): Promise + cancel(subscriptionId: string, cancelAtCycleEnd: boolean| number, callback: (err: INormalizeError | null, data: Subscriptions.RazorpaySubscription) => void): void; /** * Delete offer linked to a subscription *