{"action":"created","comment":{"url":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/comments/243256774","pull_request_review_id":186975941,"id":243256774,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzI1Njc3NA==","diff_hunk":"@@ -0,0 +1,260 @@\n+import { JsonController, Get, Post, Res, Body } from 'routing-controllers';\n+import { Globals } from '../../utils/globals';\n+import { CreatePaymentModelHandler } from '../../core/paymentModel/CreatePaymentModelHandler';\n+import { SmartContractReader } from '../../utils/blockchain/SmartContractReader';\n+import { HTTPResponseCodes } from '../../utils/web/HTTPResponseCodes';\n+import { HTTPResponseHandler } from '../../utils/web/HTTPResponseHandler';\n+import { DashboardDbConnector } from '../../connectors/dbConnector/DashboardDbConnector';\n+import { MerchantSDK } from '../../core/MerchantSDK';\n+const ether = require('node-etherscan-api');\n+const cc = require('cryptocompare');\n+const WEB3 = require('web3');\n+declare const global;\n+global.fetch = require('node-fetch');\n+\n+@JsonController('/Dashboard')\n+export class DashboardController {\n+\n+    /**\n+     * @api {get} /api/v2/Dashboard/transact\n+     * @apiDescription Retrieve the merchant address\n+     *\n+     * @apiName merchantAddress\n+     * @apiGroup DashboardController\n+     * @apiVersion  1.0.0\n+     *\n+     * @apiSuccess (200) {object} All Payments Details\n+     *\n+     */\n+    @Get('/transact')\n+    public async merchantAddress(): Promise<any> {\n+        try {\n+            const queryResult = await new DashboardDbConnector().getMerchantAddress();\n+            return new HTTPResponseHandler().handleSuccess('Merchant address retrieve successfully', queryResult, HTTPResponseCodes.OK());\n+        } catch (err) {\n+            return new HTTPResponseHandler().handleFailed('Failed to retrieve address', err, 400);\n+        }\n+    }\n+\n+    /**\n+     * @api {get} /api/v2/Dashboard/address\n+     * @apiDescription Retrieve the bank address\n+     *\n+     * @apiName mkeyAddress\n+     * @apiGroup DashboardController\n+     * @apiVersion  1.0.0\n+     *\n+     * @apiSuccess (200) {object} All Payments Details\n+     *\n+     */\n+    @Get('/address')\n+    public async mkeyAddress(): Promise<any> {\n+        try {\n+            const address = (await new CreatePaymentModelHandler().getBankAddress()).bankAddress.toLowerCase();\n+            return new HTTPResponseHandler().handleSuccess('Bank address retrieve successfully', address, HTTPResponseCodes.OK());\n+        } catch (err) {\n+            return new HTTPResponseHandler().handleFailed('Failed to retrieve address', err, 400);\n+        }\n+    }\n+\n+    /**\n+     * @api {get} /api/v2/Dashboard/etherBalance\n+     * @apiDescription Retrieve the balance for bank address\n+     *\n+     * @apiName balance\n+     * @apiGroup DashboardController\n+     * @apiVersion  1.0.0\n+     *\n+     * @apiSuccess (200) {object} All Payments Details\n+     *\n+     */\n+    @Get('/etherBalance')\n+    public async balance(@Body() request: any, @Res() response: any): Promise<any> {\n+        try {\n+            const address = (await new CreatePaymentModelHandler().getBankAddress()).bankAddress;\n+            const web3 = await new WEB3(new WEB3.providers.HttpProvider(Globals.GET_SPECIFIC_INFURA_URL(3)));\n+            const bal = await web3.eth.getBalance(address);\n+            const result = await web3.utils.fromWei(bal, 'ether');\n+            return new HTTPResponseHandler().handleSuccess('Balance retrieve successfully', result, HTTPResponseCodes.OK());","path":"src/api/v2/DashboardController.ts","position":78,"original_position":78,"commit_id":"a8b7b993137baae7a21f087f5c87304ec83e9d9f","original_commit_id":"a8b7b993137baae7a21f087f5c87304ec83e9d9f","user":{"login":"urosh","id":4160230,"node_id":"MDQ6VXNlcjQxNjAyMzA=","avatar_url":"https://avatars2.githubusercontent.com/u/4160230?v=4","gravatar_id":"","url":"https://api.github.com/users/urosh","html_url":"https://github.com/urosh","followers_url":"https://api.github.com/users/urosh/followers","following_url":"https://api.github.com/users/urosh/following{/other_user}","gists_url":"https://api.github.com/users/urosh/gists{/gist_id}","starred_url":"https://api.github.com/users/urosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urosh/subscriptions","organizations_url":"https://api.github.com/users/urosh/orgs","repos_url":"https://api.github.com/users/urosh/repos","events_url":"https://api.github.com/users/urosh/events{/privacy}","received_events_url":"https://api.github.com/users/urosh/received_events","type":"User","site_admin":false},"body":"same as previous comment, call the `HTTPResponseHandler` in a correct way by calling the `handle` method and by passing the `response` and the `result` object. ","created_at":"2018-12-20T12:38:53Z","updated_at":"2018-12-20T12:56:13Z","html_url":"https://github.com/pumapayio/merchant.backend/pull/78#discussion_r243256774","pull_request_url":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/78","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/comments/243256774"},"html":{"href":"https://github.com/pumapayio/merchant.backend/pull/78#discussion_r243256774"},"pull_request":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/78","id":240090217,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwMDkwMjE3","html_url":"https://github.com/pumapayio/merchant.backend/pull/78","diff_url":"https://github.com/pumapayio/merchant.backend/pull/78.diff","patch_url":"https://github.com/pumapayio/merchant.backend/pull/78.patch","issue_url":"https://api.github.com/repos/pumapayio/merchant.backend/issues/78","number":78,"state":"open","locked":false,"title":"Development","user":{"login":"madhanaraj","id":42865128,"node_id":"MDQ6VXNlcjQyODY1MTI4","avatar_url":"https://avatars2.githubusercontent.com/u/42865128?v=4","gravatar_id":"","url":"https://api.github.com/users/madhanaraj","html_url":"https://github.com/madhanaraj","followers_url":"https://api.github.com/users/madhanaraj/followers","following_url":"https://api.github.com/users/madhanaraj/following{/other_user}","gists_url":"https://api.github.com/users/madhanaraj/gists{/gist_id}","starred_url":"https://api.github.com/users/madhanaraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madhanaraj/subscriptions","organizations_url":"https://api.github.com/users/madhanaraj/orgs","repos_url":"https://api.github.com/users/madhanaraj/repos","events_url":"https://api.github.com/users/madhanaraj/events{/privacy}","received_events_url":"https://api.github.com/users/madhanaraj/received_events","type":"User","site_admin":false},"body":"Code committed on master branch kindly get the details from master branch","created_at":"2018-12-20T08:39:01Z","updated_at":"2018-12-20T12:56:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee78da8b3c61d407ca294d255d2e7321746ef28c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/78/commits","review_comments_url":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/78/comments","review_comment_url":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pumapayio/merchant.backend/issues/78/comments","statuses_url":"https://api.github.com/repos/pumapayio/merchant.backend/statuses/a8b7b993137baae7a21f087f5c87304ec83e9d9f","head":{"label":"madhanaraj:development","ref":"development","sha":"a8b7b993137baae7a21f087f5c87304ec83e9d9f","user":{"login":"madhanaraj","id":42865128,"node_id":"MDQ6VXNlcjQyODY1MTI4","avatar_url":"https://avatars2.githubusercontent.com/u/42865128?v=4","gravatar_id":"","url":"https://api.github.com/users/madhanaraj","html_url":"https://github.com/madhanaraj","followers_url":"https://api.github.com/users/madhanaraj/followers","following_url":"https://api.github.com/users/madhanaraj/following{/other_user}","gists_url":"https://api.github.com/users/madhanaraj/gists{/gist_id}","starred_url":"https://api.github.com/users/madhanaraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madhanaraj/subscriptions","organizations_url":"https://api.github.com/users/madhanaraj/orgs","repos_url":"https://api.github.com/users/madhanaraj/repos","events_url":"https://api.github.com/users/madhanaraj/events{/privacy}","received_events_url":"https://api.github.com/users/madhanaraj/received_events","type":"User","site_admin":false},"repo":{"id":157218495,"node_id":"MDEwOlJlcG9zaXRvcnkxNTcyMTg0OTU=","name":"merchant.backend","full_name":"madhanaraj/merchant.backend","private":false,"owner":{"login":"madhanaraj","id":42865128,"node_id":"MDQ6VXNlcjQyODY1MTI4","avatar_url":"https://avatars2.githubusercontent.com/u/42865128?v=4","gravatar_id":"","url":"https://api.github.com/users/madhanaraj","html_url":"https://github.com/madhanaraj","followers_url":"https://api.github.com/users/madhanaraj/followers","following_url":"https://api.github.com/users/madhanaraj/following{/other_user}","gists_url":"https://api.github.com/users/madhanaraj/gists{/gist_id}","starred_url":"https://api.github.com/users/madhanaraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madhanaraj/subscriptions","organizations_url":"https://api.github.com/users/madhanaraj/orgs","repos_url":"https://api.github.com/users/madhanaraj/repos","events_url":"https://api.github.com/users/madhanaraj/events{/privacy}","received_events_url":"https://api.github.com/users/madhanaraj/received_events","type":"User","site_admin":false},"html_url":"https://github.com/madhanaraj/merchant.backend","description":"Node server and PostgreSQL DB for merchant ","fork":true,"url":"https://api.github.com/repos/madhanaraj/merchant.backend","forks_url":"https://api.github.com/repos/madhanaraj/merchant.backend/forks","keys_url":"https://api.github.com/repos/madhanaraj/merchant.backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/madhanaraj/merchant.backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/madhanaraj/merchant.backend/teams","hooks_url":"https://api.github.com/repos/madhanaraj/merchant.backend/hooks","issue_events_url":"https://api.github.com/repos/madhanaraj/merchant.backend/issues/events{/number}","events_url":"https://api.github.com/repos/madhanaraj/merchant.backend/events","assignees_url":"https://api.github.com/repos/madhanaraj/merchant.backend/assignees{/user}","branches_url":"https://api.github.com/repos/madhanaraj/merchant.backend/branches{/branch}","tags_url":"https://api.github.com/repos/madhanaraj/merchant.backend/tags","blobs_url":"https://api.github.com/repos/madhanaraj/merchant.backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/madhanaraj/merchant.backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/madhanaraj/merchant.backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/madhanaraj/merchant.backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/madhanaraj/merchant.backend/statuses/{sha}","languages_url":"https://api.github.com/repos/madhanaraj/merchant.backend/languages","stargazers_url":"https://api.github.com/repos/madhanaraj/merchant.backend/stargazers","contributors_url":"https://api.github.com/repos/madhanaraj/merchant.backend/contributors","subscribers_url":"https://api.github.com/repos/madhanaraj/merchant.backend/subscribers","subscription_url":"https://api.github.com/repos/madhanaraj/merchant.backend/subscription","commits_url":"https://api.github.com/repos/madhanaraj/merchant.backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/madhanaraj/merchant.backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/madhanaraj/merchant.backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/madhanaraj/merchant.backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/madhanaraj/merchant.backend/contents/{+path}","compare_url":"https://api.github.com/repos/madhanaraj/merchant.backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/madhanaraj/merchant.backend/merges","archive_url":"https://api.github.com/repos/madhanaraj/merchant.backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/madhanaraj/merchant.backend/downloads","issues_url":"https://api.github.com/repos/madhanaraj/merchant.backend/issues{/number}","pulls_url":"https://api.github.com/repos/madhanaraj/merchant.backend/pulls{/number}","milestones_url":"https://api.github.com/repos/madhanaraj/merchant.backend/milestones{/number}","notifications_url":"https://api.github.com/repos/madhanaraj/merchant.backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/madhanaraj/merchant.backend/labels{/name}","releases_url":"https://api.github.com/repos/madhanaraj/merchant.backend/releases{/id}","deployments_url":"https://api.github.com/repos/madhanaraj/merchant.backend/deployments","created_at":"2018-11-12T13:33:29Z","updated_at":"2018-12-20T08:16:22Z","pushed_at":"2018-12-20T08:48:41Z","git_url":"git://github.com/madhanaraj/merchant.backend.git","ssh_url":"git@github.com:madhanaraj/merchant.backend.git","clone_url":"https://github.com/madhanaraj/merchant.backend.git","svn_url":"https://github.com/madhanaraj/merchant.backend","homepage":null,"size":576,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pumapayio:development","ref":"development","sha":"87e3bc1f75e6f90d141535d6590d303ee0df5871","user":{"login":"pumapayio","id":34472514,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NDcyNTE0","avatar_url":"https://avatars2.githubusercontent.com/u/34472514?v=4","gravatar_id":"","url":"https://api.github.com/users/pumapayio","html_url":"https://github.com/pumapayio","followers_url":"https://api.github.com/users/pumapayio/followers","following_url":"https://api.github.com/users/pumapayio/following{/other_user}","gists_url":"https://api.github.com/users/pumapayio/gists{/gist_id}","starred_url":"https://api.github.com/users/pumapayio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pumapayio/subscriptions","organizations_url":"https://api.github.com/users/pumapayio/orgs","repos_url":"https://api.github.com/users/pumapayio/repos","events_url":"https://api.github.com/users/pumapayio/events{/privacy}","received_events_url":"https://api.github.com/users/pumapayio/received_events","type":"Organization","site_admin":false},"repo":{"id":140435007,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA0MzUwMDc=","name":"merchant.backend","full_name":"pumapayio/merchant.backend","private":false,"owner":{"login":"pumapayio","id":34472514,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NDcyNTE0","avatar_url":"https://avatars2.githubusercontent.com/u/34472514?v=4","gravatar_id":"","url":"https://api.github.com/users/pumapayio","html_url":"https://github.com/pumapayio","followers_url":"https://api.github.com/users/pumapayio/followers","following_url":"https://api.github.com/users/pumapayio/following{/other_user}","gists_url":"https://api.github.com/users/pumapayio/gists{/gist_id}","starred_url":"https://api.github.com/users/pumapayio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pumapayio/subscriptions","organizations_url":"https://api.github.com/users/pumapayio/orgs","repos_url":"https://api.github.com/users/pumapayio/repos","events_url":"https://api.github.com/users/pumapayio/events{/privacy}","received_events_url":"https://api.github.com/users/pumapayio/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pumapayio/merchant.backend","description":"Node server and PostgreSQL DB for merchant ","fork":false,"url":"https://api.github.com/repos/pumapayio/merchant.backend","forks_url":"https://api.github.com/repos/pumapayio/merchant.backend/forks","keys_url":"https://api.github.com/repos/pumapayio/merchant.backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pumapayio/merchant.backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pumapayio/merchant.backend/teams","hooks_url":"https://api.github.com/repos/pumapayio/merchant.backend/hooks","issue_events_url":"https://api.github.com/repos/pumapayio/merchant.backend/issues/events{/number}","events_url":"https://api.github.com/repos/pumapayio/merchant.backend/events","assignees_url":"https://api.github.com/repos/pumapayio/merchant.backend/assignees{/user}","branches_url":"https://api.github.com/repos/pumapayio/merchant.backend/branches{/branch}","tags_url":"https://api.github.com/repos/pumapayio/merchant.backend/tags","blobs_url":"https://api.github.com/repos/pumapayio/merchant.backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pumapayio/merchant.backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pumapayio/merchant.backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/pumapayio/merchant.backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pumapayio/merchant.backend/statuses/{sha}","languages_url":"https://api.github.com/repos/pumapayio/merchant.backend/languages","stargazers_url":"https://api.github.com/repos/pumapayio/merchant.backend/stargazers","contributors_url":"https://api.github.com/repos/pumapayio/merchant.backend/contributors","subscribers_url":"https://api.github.com/repos/pumapayio/merchant.backend/subscribers","subscription_url":"https://api.github.com/repos/pumapayio/merchant.backend/subscription","commits_url":"https://api.github.com/repos/pumapayio/merchant.backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/pumapayio/merchant.backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/pumapayio/merchant.backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/pumapayio/merchant.backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/pumapayio/merchant.backend/contents/{+path}","compare_url":"https://api.github.com/repos/pumapayio/merchant.backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pumapayio/merchant.backend/merges","archive_url":"https://api.github.com/repos/pumapayio/merchant.backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pumapayio/merchant.backend/downloads","issues_url":"https://api.github.com/repos/pumapayio/merchant.backend/issues{/number}","pulls_url":"https://api.github.com/repos/pumapayio/merchant.backend/pulls{/number}","milestones_url":"https://api.github.com/repos/pumapayio/merchant.backend/milestones{/number}","notifications_url":"https://api.github.com/repos/pumapayio/merchant.backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pumapayio/merchant.backend/labels{/name}","releases_url":"https://api.github.com/repos/pumapayio/merchant.backend/releases{/id}","deployments_url":"https://api.github.com/repos/pumapayio/merchant.backend/deployments","created_at":"2018-07-10T13:18:15Z","updated_at":"2018-12-04T09:24:36Z","pushed_at":"2018-12-20T08:48:42Z","git_url":"git://github.com/pumapayio/merchant.backend.git","ssh_url":"git@github.com:pumapayio/merchant.backend.git","clone_url":"https://github.com/pumapayio/merchant.backend.git","svn_url":"https://github.com/pumapayio/merchant.backend","homepage":null,"size":576,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/78"},"html":{"href":"https://github.com/pumapayio/merchant.backend/pull/78"},"issue":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/issues/78"},"comments":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/pumapayio/merchant.backend/statuses/a8b7b993137baae7a21f087f5c87304ec83e9d9f"}},"author_association":"NONE"}}
{"actor":{"display_login":"urosh"}}