Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sending error #452

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawk.api",
"version": "1.1.3",
"version": "1.1.4",
"main": "index.ts",
"license": "UNLICENSED",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/billing/cloudpayments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
});
}

/**

Check warning on line 166 in src/billing/cloudpayments.ts

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @returns for function
* Generates invoice id for payment
*
* @param tariffPlan - tariff plan to generate invoice id
Expand Down Expand Up @@ -266,7 +266,7 @@

telegram.sendMessage(`✅ [Billing / Check] All checks passed successfully «${workspace.name}»`, TelegramBotURLs.Money)
.catch(e => console.error('Error while sending message to Telegram: ' + e));
HawkCatcher.send(new Error('[Billing / Check] All checks passed successfully'), body as any);

Check warning on line 269 in src/billing/cloudpayments.ts

View workflow job for this annotation

GitHub Actions / ESlint

Unexpected any. Specify a different type

res.json({
code: CheckCodes.SUCCESS,
Expand Down Expand Up @@ -544,7 +544,7 @@

this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Fail] Transaction failed for «${workspace.name}»`, TelegramBotURLs.Money));

HawkCatcher.send(new Error('[Billing / Fail] Transaction failed'), body as any);

Check warning on line 547 in src/billing/cloudpayments.ts

View workflow job for this annotation

GitHub Actions / ESlint

Unexpected any. Specify a different type

res.json({
code: FailCodes.SUCCESS,
Expand Down Expand Up @@ -584,6 +584,10 @@
}

if (!workspace) {
this.sendError(res, RecurrentCodes.SUCCESS, `[Billing / Recurrent] Workspace with subscription id ${body.Id} not found`, {
body,
});

return;
}

Expand Down Expand Up @@ -701,7 +705,7 @@
* @param errorText - error description
* @param backtrace - request data and error data
*/
private sendError(res: express.Response, errorCode: CheckCodes | PayCodes | FailCodes | RecurrentCodes, errorText: string, backtrace: { [key: string]: any }): void {

Check warning on line 708 in src/billing/cloudpayments.ts

View workflow job for this annotation

GitHub Actions / ESlint

Unexpected any. Specify a different type
res.json({
code: errorCode,
});
Expand Down Expand Up @@ -762,7 +766,7 @@
promise.catch(e => console.error('Error while sending message to Telegram: ' + e));
}

/**

Check warning on line 769 in src/billing/cloudpayments.ts

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @returns for function
* Parses body and returns card data
* @param request - request body to parse
*/
Expand Down
2 changes: 1 addition & 1 deletion src/utils/cloudPaymentsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class CloudPaymentsApi {
});

if (!result.data.Success) {
throw new Error(`Error during cancelling transaction: ${result.data.Message}`);
throw new Error(`Error during cancelling transaction with id ${transactionId}: ${result.data.Message}`);
}
}
}
Expand Down
Loading