Skip to content

Commit 180f61c

Browse files
committed
update from master
2 parents 626f848 + 67cfbc2 commit 180f61c

14 files changed

Lines changed: 46 additions & 24 deletions

File tree

.env.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
PORT=4000
33

44
# Hawk API database URL
5-
MONGO_HAWK_DB_URL=mongodb://localhost:55011/hawk
5+
MONGO_HAWK_DB_URL=mongodb://127.0.0.1:55011/hawk
66

77
# Events database URL
8-
MONGO_EVENTS_DB_URL=mongodb://localhost:55011/hawk_events
8+
MONGO_EVENTS_DB_URL=mongodb://127.0.0.1:55011/hawk_events
99

1010
# MongoDB settings
1111
MONGO_RECONNECT_TRIES=60

.github/workflows/bump-version.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [pull_request]
55
jobs:
66
# If pull request was merged then we should check for a package version update
77
check-version-update:
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-20.04
99
steps:
1010
# Checkout to target branch
1111
- uses: actions/checkout@v2
@@ -33,7 +33,7 @@ jobs:
3333

3434
bump-version:
3535
needs: check-version-update
36-
runs-on: ubuntu-latest
36+
runs-on: ubuntu-20.04
3737
steps:
3838
# Checkout to target branch
3939
- uses: actions/checkout@v2

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [pull_request]
55
jobs:
66
lint:
77
name: ESlint
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-20.04
99
steps:
1010
- uses: actions/checkout@v2
1111
- name: Use Node.js

.github/workflows/pr-to-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
update-from-master:
1212
if: github.event.pull_request.merged == true
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-20.04
1414
steps:
1515
- uses: actions/checkout@v2
1616

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
build:
88
name: Run Jest tests
9-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-20.04
1010
steps:
1111
- uses: actions/checkout@v2
1212
- name: Install modules

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
module.exports = {
7+
testTimeout: 30000,
78
/**
89
* The test environment that will be used for testing
910
*/

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hawk.api",
3-
"version": "1.1.2",
3+
"version": "1.1.6",
44
"main": "index.ts",
55
"license": "UNLICENSED",
66
"scripts": {

src/billing/cloudpayments.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,10 @@ export default class CloudPaymentsWebhooks {
584584
}
585585

586586
if (!workspace) {
587+
this.sendError(res, RecurrentCodes.SUCCESS, `[Billing / Recurrent] Workspace with subscription id ${body.Id} not found`, {
588+
body,
589+
});
590+
587591
return;
588592
}
589593

@@ -793,13 +797,13 @@ export default class CloudPaymentsWebhooks {
793797
* involving the production and distribution of goods and the provision of services
794798
* Also known as "НДС" in Russia
795799
*/
796-
const VALUE_ADDED_TAX = 20;
800+
const VALUE_ADDED_TAX = 0;
797801

798802
const item: CustomerReceiptItem = {
799803
amount: tariff.monthlyCharge,
800804
label: `${tariff.name} tariff plan`,
801805
price: tariff.monthlyCharge,
802-
// vat: VALUE_ADDED_TAX,
806+
vat: VALUE_ADDED_TAX,
803807
quantity: 1,
804808
};
805809

src/models/workspace.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export default class WorkspaceModel extends AbstractModel<WorkspaceDBScheme> imp
7171
*/
7272
public subscriptionId!: string | undefined;
7373

74+
/**
75+
* True if workspace is used for debugging
76+
*/
77+
public isDebug?: boolean;
78+
7479
/**
7580
* Model's collection
7681
*/
@@ -411,6 +416,10 @@ export default class WorkspaceModel extends AbstractModel<WorkspaceDBScheme> imp
411416
public getTariffPlanDueDate(): Date {
412417
const lastChargeDate = new Date(this.lastChargeDate);
413418

419+
if (this.isDebug) {
420+
return new Date(lastChargeDate.setDate(lastChargeDate.getDate() + 1));
421+
}
422+
414423
return new Date(lastChargeDate.setMonth(lastChargeDate.getMonth() + 1));
415424
}
416425

src/resolvers/billingNew.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,11 @@ export default {
163163
const dueDate = workspace.getTariffPlanDueDate();
164164

165165
if (args.input.isRecurrent) {
166+
const interval = workspace.isDebug ? 'Day' : 'Month';
167+
166168
jsonData.cloudPayments = {
167169
recurrent: {
168-
interval: 'Month',
170+
interval,
169171
period: 1,
170172
},
171173
};

0 commit comments

Comments
 (0)