Update logging and return statements in billing services
The commit modifies the logging level in the billing services from 'error' to 'info'. Moreover, the error statement has been modified to clarify that the subscription cancellation has possibly been done by the user. Also, it reduces redundant imports and beefs up the return structure in stripe-billing-strategy.service.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
"./marketing": "./src/components/marketing.tsx"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hookform/resolvers": "^3.3.4",
|
||||
"@hookform/resolvers": "^3.4.0",
|
||||
"@kit/billing": "workspace:^",
|
||||
"@kit/eslint-config": "workspace:*",
|
||||
"@kit/lemon-squeezy": "workspace:^",
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import 'server-only';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
import { BillingProviderSchema } from '@kit/billing';
|
||||
|
||||
@@ -143,12 +143,12 @@ export class LemonSqueezyBillingStrategyService
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
logger.info(
|
||||
{
|
||||
...ctx,
|
||||
error: (error as Error)?.message,
|
||||
},
|
||||
'Failed to cancel subscription. It may have already been cancelled.',
|
||||
`Failed to cancel subscription. It may have already been cancelled on the user's end.`,
|
||||
);
|
||||
|
||||
return { success: false };
|
||||
|
||||
@@ -116,17 +116,21 @@ export class StripeBillingStrategyService
|
||||
|
||||
logger.info(ctx, 'Subscription cancelled successfully');
|
||||
|
||||
return { success: true };
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
logger.info(
|
||||
{
|
||||
...ctx,
|
||||
error,
|
||||
},
|
||||
'Failed to cancel subscription. It may have already been cancelled.',
|
||||
`Failed to cancel subscription. It may have already been cancelled on the user's end.`,
|
||||
);
|
||||
|
||||
return { success: false };
|
||||
return {
|
||||
success: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user