@orkow/common 0.0.11 → 0.0.13
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.
|
@@ -22,7 +22,6 @@ const getStatusDescription = (status) => {
|
|
|
22
22
|
return "When a credit card transaction fails, either to charge or to credit money to a credit card, the bill will show a status of 'Failed Gateway'. Credit card transactions can fail for many reasons, and can be retried most of the time.";
|
|
23
23
|
case 'Abandoned':
|
|
24
24
|
return 'If a Pending payment is never completed it becomes Abandoned after a week.';
|
|
25
|
-
// FOR SHOP
|
|
26
25
|
case 'Request':
|
|
27
26
|
return "A shop is marked as 'Request' when it is first added. A 'Request' bill can move to these statuses: 'Waiting for verification'";
|
|
28
27
|
case 'Waiting for verification':
|
|
@@ -35,14 +34,12 @@ const getStatusDescription = (status) => {
|
|
|
35
34
|
return "If an administrator suspends; A 'Suspend' can move to these statuses: 'Actively selling', 'Reject'";
|
|
36
35
|
case 'Reject':
|
|
37
36
|
return 'If an administrator refuses; Reject remain reject; they cannot move to another status.';
|
|
38
|
-
// FOR ENROLL
|
|
39
37
|
case 'Waiting':
|
|
40
38
|
return "An enroll is marked as 'Waiting' when it is first added. A 'Waiting' bill can move to these statuses: 'Active', 'Inactive'";
|
|
41
39
|
case 'Active':
|
|
42
40
|
return "An enroll or shop is marked as 'Active' once payment is received, either automatically at the successful completion of a credit card transaction or manually by a billing administrator.";
|
|
43
41
|
case 'Inactive':
|
|
44
42
|
return "Marked as 'Inactive' if the due date has passed and the payment has not been recorded. Email notices can be scheduled to go out based on a due date using the Schedule Overdue Notices.";
|
|
45
|
-
// FOR SELL
|
|
46
43
|
case 'In process...':
|
|
47
44
|
return "An sell is marked as 'In process...' when it is first added. A 'In process...' sell can move to these statuses: 'Completed', 'Cancelled'";
|
|
48
45
|
case 'Completed':
|
|
@@ -56,32 +53,3 @@ const getStatusDescription = (status) => {
|
|
|
56
53
|
}
|
|
57
54
|
};
|
|
58
55
|
exports.default = getStatusDescription;
|
|
59
|
-
// STATUS_TEXT DESCRIPTION
|
|
60
|
-
// // FOR BILLING AND BILLING PAYMENT
|
|
61
|
-
// New: A bill is marked as 'New' when it is first added. A new bill can also be 'Awaiting Gateway', 'Failed Gateway', 'Overdue', and 'In Dispute'. A 'New' bill can move to these statuses: 'Pending', 'Paid', 'Canceled'
|
|
62
|
-
// Pending: A bill is marked as 'Pending' when a user selects a manual payment method. The bill will continue to have a 'Pending' status until the payment is recorded by an administrator or an automatic payment method is selected. A 'Pending' bill can move to these statuses: 'Paid', 'Canceled'
|
|
63
|
-
// Paid: A bill is marked as 'Paid' once payment is received, either automatically at the successful completion of a credit card transaction or manually by a billing administrator. A 'Paid' bill can move to these statuses: 'Refunded', 'Canceled'
|
|
64
|
-
// Refunded: A bill is marked as 'Refunded' if a partial or full amount of the bill has been refunded to the account. A 'Refunded' bill can move to these statuses: 'Canceled'
|
|
65
|
-
// Canceled: Any bill can be canceled. If a bill is new or pending, this will stop any further action on the bill. Canceled bills can't be paid and won't become overdue. If a bill has already been paid, canceling the bill will default to issuing a full refund. If you need to retain a handling fee, you can manually edit the refund amount to reflect this. Refunds issued when cancelling a bill will automatically issue credits for any bills paid by credit card. Canceled bills remain canceled; they cannot move to another status or be uncanceled.
|
|
66
|
-
// Overdue: A bill is marked as 'Overdue' if the bill due date has passed and the payment has not been recorded. Email notices can be scheduled to go out based on a bill's due date using the Schedule Overdue Notices.
|
|
67
|
-
// In Dispute: If there is a dispute about the bill, it can be marked as In Dispute by a billing administrator. Only unpaid bills can be marked as in dispute. This will prevent the account from receiving overdue notices by email until the dispute has been resolved.
|
|
68
|
-
// Awaiting Gateway: This status is assigned when an attempt to charge or credit a credit card is not immediately processed. Once the credit card transaction is complete, this status will be removed.
|
|
69
|
-
// Failed Gateway: When a credit card transaction fails, either to charge or to credit money to a credit card, the bill will show a status of 'Failed Gateway'. Credit card transactions can fail for many reasons, and can be retried most of the time.
|
|
70
|
-
// Abandoned: If a Pending payment is never completed it becomes Abandoned after a week.
|
|
71
|
-
// Important link: https://www.oasis-open.org/khelp/billing/user_help/html/billing_lifecycle.html
|
|
72
|
-
// // FOR SHOP
|
|
73
|
-
// Request: A shop is marked as 'Request' when it is first added. A 'Request' bill can move to these statuses: 'Waiting for verification'
|
|
74
|
-
// Waiting for verification: A shop is marked as 'Waiting for verification' if an administrator accepts the request. A 'Waiting for verification' can move to these statuses: 'Verifying in process'
|
|
75
|
-
// Verifying in process: A shop is marked as 'Verifying in process' if an administrator accepts the request. A 'Verifying in process' can move to these statuses: 'Actively selling', 'Suspend'
|
|
76
|
-
// Actively selling: A shop is marked as 'Actively selling' once payment is received, either automatically at the successful completion of a credit card transaction or manually by a billing administrator. A 'Actively selling' can move to these statuses: 'Suspend', 'Reject'
|
|
77
|
-
// Suspend: If an administrator suspends; A 'Suspend' can move to these statuses: 'Actively selling', 'Reject'
|
|
78
|
-
// Reject: If an administrator refuses; Reject remain reject; they cannot move to another status.
|
|
79
|
-
// // FOR ENROLL
|
|
80
|
-
// Waiting: An enroll is marked as 'Waiting' when it is first added. A 'Waiting' bill can move to these statuses: 'Active', 'Inactive'
|
|
81
|
-
// Active: An enroll or shop is marked as 'Active' once payment is received, either automatically at the successful completion of a credit card transaction or manually by a billing administrator.
|
|
82
|
-
// Inactive: Marked as 'Inactive' if the due date has passed and the payment has not been recorded. Email notices can be scheduled to go out based on a due date using the Schedule Overdue Notices.
|
|
83
|
-
// FOR SELL
|
|
84
|
-
// 'In process...': An sell is marked as 'In process...' when it is first added. A 'In process...' sell can move to these statuses: 'Completed', 'Cancelled'
|
|
85
|
-
// Completed: A sell is marked as 'Completed' once payment is received, either automatically at the successful completion of a credit card transaction or manually by a billing administrator. A 'Completed' can move to these statuses: 'Cancelled'
|
|
86
|
-
// Cancelled: Any sell can be Cancelled. If a sell is 'In process...', this will stop any further action on the bill. Cancelled sell can't be Completed and won't become rejected. Cancelled sell remain cancelled; they cannot move to another status or be uncancelled.
|
|
87
|
-
// Rejected: A sell is marked 'Rejected' once when the sell is 'Completed'. If a sell has already been paid, rejecting the sell will default to issuing a full refund. Rejected sell can't be 'Completed' and won't become 'Cancelled'. Rejected sell remain rejected; they cannot move to another status.
|
|
@@ -12,7 +12,6 @@ const getRequestId = (request, requireAuth = true) => {
|
|
|
12
12
|
try {
|
|
13
13
|
const token = header.replace('Bearer ', '');
|
|
14
14
|
const decoded = jsonwebtoken_1.default.verify(token, process.env.SUBGRAPH_ACCESS_TOKEN_SECRET || '');
|
|
15
|
-
// @ts-expect-error -> The user ID will exist in the header
|
|
16
15
|
return decoded.requestId;
|
|
17
16
|
}
|
|
18
17
|
catch (error) {
|
package/dist/utils/getUserId.js
CHANGED
|
@@ -6,13 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getUserId = void 0;
|
|
7
7
|
const graphql_1 = require("graphql");
|
|
8
8
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
9
|
-
// const header = request.request ? request.request.headers.authorization : request.connection.context.headers?.Authorization ? request.connection.context.headers.Authorization : request.connection.context.Authorization
|
|
10
9
|
const getUserId = (request, requireAuth = true) => {
|
|
11
10
|
const header = request?.headers.get('authorization');
|
|
12
11
|
if (header) {
|
|
13
12
|
const token = header.replace('Bearer ', '');
|
|
14
13
|
const decoded = jsonwebtoken_1.default.verify(token, process.env.JWT_SECRET || '');
|
|
15
|
-
// @ts-expect-error -> The user ID will exist in the header
|
|
16
14
|
return decoded.userId;
|
|
17
15
|
}
|
|
18
16
|
if (requireAuth)
|
|
@@ -6,13 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getUserType = void 0;
|
|
7
7
|
const graphql_1 = require("graphql");
|
|
8
8
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
9
|
-
// const header = request.request ? request.request.headers.authorization : request.connection.context.headers?.Authorization ? request.connection.context.headers.Authorization : request.connection.context.Authorization
|
|
10
9
|
const getUserType = (request, requireAuth = true) => {
|
|
11
10
|
const header = request?.headers.get('authorization');
|
|
12
11
|
if (header) {
|
|
13
12
|
const token = header.replace('Bearer ', '');
|
|
14
13
|
const decoded = jsonwebtoken_1.default.verify(token, process.env.JWT_SECRET || '');
|
|
15
|
-
// @ts-expect-error -> The user ID will exist in the header
|
|
16
14
|
return decoded.userType;
|
|
17
15
|
}
|
|
18
16
|
if (requireAuth)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orkow/common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Common utils.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -8,12 +8,18 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist/**/*"
|
|
10
10
|
],
|
|
11
|
+
"exports": {
|
|
12
|
+
"./date-extensions": "./src/date.extensions.d.ts",
|
|
13
|
+
"./string-extensions": "./src/string.extensions.d.ts",
|
|
14
|
+
"./get-status-description": "./src/getStatusDescription.ts",
|
|
15
|
+
"./notification-template": "./src/notificationTemplate.ts"
|
|
16
|
+
},
|
|
11
17
|
"keywords": [],
|
|
12
18
|
"author": "ConCat7 Sky Limited, <ikramhasib007@gmail.com> (https://github.com/ikramhasib007)",
|
|
13
19
|
"scripts": {
|
|
14
20
|
"dev": "tsc -w",
|
|
15
21
|
"clean": "del-cli ./dist/*",
|
|
16
|
-
"build": "pnpm run clean && tsc",
|
|
22
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json",
|
|
17
23
|
"lint": "eslint --max-warnings 0",
|
|
18
24
|
"pub": "git add . && git commit -m \"Updates\" && git push origin main && npm version patch && npm run build && npm publish"
|
|
19
25
|
},
|