{"action":"created","comment":{"url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/comments/107979739","pull_request_review_id":28988594,"id":107979739,"diff_hunk":"@@ -724,6 +729,155 @@ public function ebanx_sidebar_shortcut()\n \t\t\t\t21\n \t\t\t);\n \t\t}\n+\n+\t\tpublic function ebanx_metabox_payment_link_save ($post_id, $post) {\n+\n+\t\t\techo 'EBANXERROR EBANX SAVE POST';\n+\n+\t\t\t// Check if user has permissions to save data.\n+\t\t\tif ( ! current_user_can( 'edit_post', $post_id ) ) {\n+\t\t\t\techo 'EBANXERROR edit_post';\n+\t\t\t\treturn;\n+\t\t\t}\n+\n+\t\t\t// Check if not an autosave.\n+\t\t\tif ( wp_is_post_autosave( $post_id ) ) {\n+\t\t\t\techo 'EBANXERROR autosave';\n+\t\t\t\treturn;\n+\t\t\t}\n+\n+\t\t\t// Check if not a revision.\n+\t\t\tif ( wp_is_post_revision( $post_id ) ) {\n+\t\t\t\techo 'EBANXERROR revision';\n+\t\t\t\treturn;\n+\t\t\t}\n+\n+\t\t\t// Check if is an EBANX request\n+\t\t\tif ( ! isset($_REQUEST['save_order_ebanx']) || $_REQUEST['save_order_ebanx'] !== 'Save EBANX Order' ) {\n+\t\t\t\techo 'EBANXERROR errroooo';\n+\t\t\t\treturn;\n+\t\t\t}\n+\n+\t\t\t$has_errors = false;\n+\n+\t\t\t$order = wc_get_order($post_id);\n+\n+\t\t\t$ebanx_countries = array('br', 'mx', 'cl', 'co', 'pe');\n+\n+\t\t\tif ( empty($order->billing_first_name) || empty($order->billing_last_name) ) {\n+\t\t\t\t$this->notices\n+\t\t\t\t\t->with_message(__('The customer name is required, please provide a valid customer name and last name.', 'woocommerce-gateway-ebanx'))\n+\t\t\t\t\t->with_type('error')\n+\t\t\t\t\t->persistent()\n+\t\t\t\t\t->enqueue();\n+\n+\t\t\t\t$has_errors = true;\n+\t\t\t}\n+\n+\t\t\tif ( !in_array(strtolower($order->billing_country), $ebanx_countries) ) {\n+\t\t\t\t$this->notices\n+\t\t\t\t\t->with_message(__('EBANX only support the countries: Brazil, Mexico, Peru, Colombia and Chile. Please, use one of these.', 'woocommerce-gateway-ebanx'))\n+\t\t\t\t\t->with_type('error')\n+\t\t\t\t\t->persistent()\n+\t\t\t\t\t->enqueue();\n+\n+\t\t\t\t$has_errors = true;\n+\t\t\t}\n+\n+\t\t\tif ( $order->get_total() < 1 ) {\n+\t\t\t\t$this->notices\n+\t\t\t\t\t->with_message(__('The total amount needs to be greater than $1.', 'woocommerce-gateway-ebanx'))\n+\t\t\t\t\t->with_type('error')\n+\t\t\t\t\t->persistent()\n+\t\t\t\t\t->enqueue();\n+\n+\t\t\t\t$has_errors = true;\n+\t\t\t}\n+\n+\t\t\t// TODO: Novo erro: Verificar se o status da ordem é 'wc-pending', só pode criar com o status de 'wc-pending'\n+\n+\t\t\tif ( $has_errors ) {\n+\t\t\t\techo 'EBANXERROR has_errors';\n+\t\t\t\treturn;\n+\t\t\t}\n+\n+\t\t\t$home_url = esc_url( home_url() );\n+\n+\t\t\t$payment_type_code = array(\n+\t\t\t\t'ebanx-banking-ticket' => 'boleto',\n+\t\t\t\t'ebanx-credit-card-br' => 'creditcard',\n+\t\t\t\t'ebanx-credit-card-mx' => 'creditcard',\n+\t\t\t\t'ebanx-debit-card' => 'debitcard',\n+\t\t\t\t'ebanx-oxxo' => 'oxxo',\n+\t\t\t\t'ebanx-sencillito' => 'sencillito',\n+\t\t\t\t'ebanx-servipag' => 'servipag',\n+\t\t\t\t'ebanx-tef' => 'tef',\n+\t\t\t\t'ebanx-pagoefectivo' => 'pagoefectivo',\n+\t\t\t\t'ebanx-safetypay' => 'safetypay',\n+\t\t\t\t'ebanx-eft' => 'eft',\n+\t\t\t\t'ebanx-account' => 'ebanxaccount'\n+\t\t\t);\n+\n+\t\t\t$payment_data = array(","path":"woocommerce-gateway-ebanx/woocommerce-gateway-ebanx.php","position":114,"original_position":114,"commit_id":"7ff96683fe4ea81cbd41deecdbdddb24349ee403","original_commit_id":"7ff96683fe4ea81cbd41deecdbdddb24349ee403","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars2.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Avoid unused local variables such as '$payment_data'.](https://www.codacy.com/app/EBANX/woocommerce-gateway-ebanx/pullRequest?prid=546711)","created_at":"2017-03-24T19:12:50Z","updated_at":"2017-03-24T19:12:50Z","html_url":"https://github.com/ebanx/woocommerce-gateway-ebanx/pull/338#discussion_r107979739","pull_request_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/338","_links":{"self":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/comments/107979739"},"html":{"href":"https://github.com/ebanx/woocommerce-gateway-ebanx/pull/338#discussion_r107979739"},"pull_request":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/338"}}},"pull_request":{"url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/338","id":109323870,"html_url":"https://github.com/ebanx/woocommerce-gateway-ebanx/pull/338","diff_url":"https://github.com/ebanx/woocommerce-gateway-ebanx/pull/338.diff","patch_url":"https://github.com/ebanx/woocommerce-gateway-ebanx/pull/338.patch","issue_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues/338","number":338,"state":"open","locked":false,"title":"[WIP] Implements Payment by link","user":{"login":"gpressutto5","id":12385501,"avatar_url":"https://avatars1.githubusercontent.com/u/12385501?v=3","gravatar_id":"","url":"https://api.github.com/users/gpressutto5","html_url":"https://github.com/gpressutto5","followers_url":"https://api.github.com/users/gpressutto5/followers","following_url":"https://api.github.com/users/gpressutto5/following{/other_user}","gists_url":"https://api.github.com/users/gpressutto5/gists{/gist_id}","starred_url":"https://api.github.com/users/gpressutto5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpressutto5/subscriptions","organizations_url":"https://api.github.com/users/gpressutto5/orgs","repos_url":"https://api.github.com/users/gpressutto5/repos","events_url":"https://api.github.com/users/gpressutto5/events{/privacy}","received_events_url":"https://api.github.com/users/gpressutto5/received_events","type":"User","site_admin":false},"body":"Closes #331","created_at":"2017-03-06T18:53:19Z","updated_at":"2017-03-24T19:12:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"911b359ed65539d5dbc2d05692172e656f00302a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/338/commits","review_comments_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/338/comments","review_comment_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues/338/comments","statuses_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/statuses/7ff96683fe4ea81cbd41deecdbdddb24349ee403","head":{"label":"ebanx:feature/payment-by-link","ref":"feature/payment-by-link","sha":"7ff96683fe4ea81cbd41deecdbdddb24349ee403","user":{"login":"ebanx","id":5168667,"avatar_url":"https://avatars0.githubusercontent.com/u/5168667?v=3","gravatar_id":"","url":"https://api.github.com/users/ebanx","html_url":"https://github.com/ebanx","followers_url":"https://api.github.com/users/ebanx/followers","following_url":"https://api.github.com/users/ebanx/following{/other_user}","gists_url":"https://api.github.com/users/ebanx/gists{/gist_id}","starred_url":"https://api.github.com/users/ebanx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebanx/subscriptions","organizations_url":"https://api.github.com/users/ebanx/orgs","repos_url":"https://api.github.com/users/ebanx/repos","events_url":"https://api.github.com/users/ebanx/events{/privacy}","received_events_url":"https://api.github.com/users/ebanx/received_events","type":"Organization","site_admin":false},"repo":{"id":70833779,"name":"woocommerce-gateway-ebanx","full_name":"ebanx/woocommerce-gateway-ebanx","owner":{"login":"ebanx","id":5168667,"avatar_url":"https://avatars0.githubusercontent.com/u/5168667?v=3","gravatar_id":"","url":"https://api.github.com/users/ebanx","html_url":"https://github.com/ebanx","followers_url":"https://api.github.com/users/ebanx/followers","following_url":"https://api.github.com/users/ebanx/following{/other_user}","gists_url":"https://api.github.com/users/ebanx/gists{/gist_id}","starred_url":"https://api.github.com/users/ebanx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebanx/subscriptions","organizations_url":"https://api.github.com/users/ebanx/orgs","repos_url":"https://api.github.com/users/ebanx/repos","events_url":"https://api.github.com/users/ebanx/events{/privacy}","received_events_url":"https://api.github.com/users/ebanx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ebanx/woocommerce-gateway-ebanx","description":null,"fork":false,"url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx","forks_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/forks","keys_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/teams","hooks_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/hooks","issue_events_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues/events{/number}","events_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/events","assignees_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/assignees{/user}","branches_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/branches{/branch}","tags_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/tags","blobs_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/refs{/sha}","trees_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/statuses/{sha}","languages_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/languages","stargazers_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/stargazers","contributors_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/contributors","subscribers_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/subscribers","subscription_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/subscription","commits_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/commits{/sha}","git_commits_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/commits{/sha}","comments_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/comments{/number}","issue_comment_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues/comments{/number}","contents_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/contents/{+path}","compare_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/merges","archive_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/downloads","issues_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues{/number}","pulls_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls{/number}","milestones_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/milestones{/number}","notifications_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/labels{/name}","releases_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/releases{/id}","deployments_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/deployments","created_at":"2016-10-13T18:00:19Z","updated_at":"2017-02-08T19:05:50Z","pushed_at":"2017-03-24T19:09:48Z","git_url":"git://github.com/ebanx/woocommerce-gateway-ebanx.git","ssh_url":"git@github.com:ebanx/woocommerce-gateway-ebanx.git","clone_url":"https://github.com/ebanx/woocommerce-gateway-ebanx.git","svn_url":"https://github.com/ebanx/woocommerce-gateway-ebanx","homepage":null,"size":31341,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":26,"forks":1,"open_issues":26,"watchers":0,"default_branch":"master"}},"base":{"label":"ebanx:develop","ref":"develop","sha":"3d5ee4af271939e68c6528f7230ca6954a787880","user":{"login":"ebanx","id":5168667,"avatar_url":"https://avatars0.githubusercontent.com/u/5168667?v=3","gravatar_id":"","url":"https://api.github.com/users/ebanx","html_url":"https://github.com/ebanx","followers_url":"https://api.github.com/users/ebanx/followers","following_url":"https://api.github.com/users/ebanx/following{/other_user}","gists_url":"https://api.github.com/users/ebanx/gists{/gist_id}","starred_url":"https://api.github.com/users/ebanx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebanx/subscriptions","organizations_url":"https://api.github.com/users/ebanx/orgs","repos_url":"https://api.github.com/users/ebanx/repos","events_url":"https://api.github.com/users/ebanx/events{/privacy}","received_events_url":"https://api.github.com/users/ebanx/received_events","type":"Organization","site_admin":false},"repo":{"id":70833779,"name":"woocommerce-gateway-ebanx","full_name":"ebanx/woocommerce-gateway-ebanx","owner":{"login":"ebanx","id":5168667,"avatar_url":"https://avatars0.githubusercontent.com/u/5168667?v=3","gravatar_id":"","url":"https://api.github.com/users/ebanx","html_url":"https://github.com/ebanx","followers_url":"https://api.github.com/users/ebanx/followers","following_url":"https://api.github.com/users/ebanx/following{/other_user}","gists_url":"https://api.github.com/users/ebanx/gists{/gist_id}","starred_url":"https://api.github.com/users/ebanx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebanx/subscriptions","organizations_url":"https://api.github.com/users/ebanx/orgs","repos_url":"https://api.github.com/users/ebanx/repos","events_url":"https://api.github.com/users/ebanx/events{/privacy}","received_events_url":"https://api.github.com/users/ebanx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ebanx/woocommerce-gateway-ebanx","description":null,"fork":false,"url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx","forks_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/forks","keys_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/teams","hooks_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/hooks","issue_events_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues/events{/number}","events_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/events","assignees_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/assignees{/user}","branches_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/branches{/branch}","tags_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/tags","blobs_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/refs{/sha}","trees_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/statuses/{sha}","languages_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/languages","stargazers_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/stargazers","contributors_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/contributors","subscribers_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/subscribers","subscription_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/subscription","commits_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/commits{/sha}","git_commits_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/git/commits{/sha}","comments_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/comments{/number}","issue_comment_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues/comments{/number}","contents_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/contents/{+path}","compare_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/merges","archive_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/downloads","issues_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues{/number}","pulls_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls{/number}","milestones_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/milestones{/number}","notifications_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/labels{/name}","releases_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/releases{/id}","deployments_url":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/deployments","created_at":"2016-10-13T18:00:19Z","updated_at":"2017-02-08T19:05:50Z","pushed_at":"2017-03-24T19:09:48Z","git_url":"git://github.com/ebanx/woocommerce-gateway-ebanx.git","ssh_url":"git@github.com:ebanx/woocommerce-gateway-ebanx.git","clone_url":"https://github.com/ebanx/woocommerce-gateway-ebanx.git","svn_url":"https://github.com/ebanx/woocommerce-gateway-ebanx","homepage":null,"size":31341,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":26,"forks":1,"open_issues":26,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/338"},"html":{"href":"https://github.com/ebanx/woocommerce-gateway-ebanx/pull/338"},"issue":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues/338"},"comments":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/issues/338/comments"},"review_comments":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/338/comments"},"review_comment":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/pulls/338/commits"},"statuses":{"href":"https://api.github.com/repos/ebanx/woocommerce-gateway-ebanx/statuses/7ff96683fe4ea81cbd41deecdbdddb24349ee403"}}}}
{"actor":{"display_login":"codacy-bot"}}