{"action":"created","comment":{"url":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/comments/68126081","id":68126081,"diff_hunk":"@@ -40,80 +144,305 @@ public function index() {\n \t\tif (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/securesubmit.tpl')) {\n \t\t\treturn $this->load->view($this->config->get('config_template') . '/template/payment/securesubmit.tpl', $data);\n \t\t} else {\n-\t\t\treturn $this->load->view('default/template/payment/securesubmit.tpl', $data);\n+\t\t\treturn $this->load->view('payment/securesubmit.tpl', $data);\n \t\t}\n \t}\n \n-\tpublic function send() {\n+    /**\n+     *Process payment\n+     */\n+    public function send() {\n \t\t$this->load->model('checkout/order');\n+        $orderID = $this->session->data['order_id'];\n+        // \\ModelCheckoutOrder::getOrder\n+        $order_info = $this->model_checkout_order->getOrder($orderID);\n+        $curCode = $order_info['currency_code'];\n+        $amt = $order_info['total'];\n+        $json = array();\n \n-\t\t$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);\n+        // \\ControllerPaymentSecureSubmit::getHpsCardHolder\n+        // builds the \\HpsAddress as well\n+        // do this here since it is not specific only to credit card transactions\n+        $cardHolder = $this->getHpsCardHolder($order_info);\n \n-\t\trequire_once(DIR_APPLICATION . 'controller/payment/securesubmitfiles/Hps.php');\n+\t\ttry {\n+            /*\n+             * get \\HpsAuthorization\n+             * in order to facilitate this we will retrieve the setting determining which call to make\n+             */\n+            $response = $this->chargeCreditCard($amt, $curCode, $cardHolder);\n+            $json['redirect'] = $this->buildCreditSuccessMessage($orderID, $response);\n+\t\t}\n+        catch (HpsException $e) {\n+            $maxFail = $this->securesubmit_fraud_fail;\n \n-        $json = array();\n+            if ($this->velocityIncrement() < $maxFail){\n+                $this->sessionVar('previous',$e->getMessage());\n+            }\n+            $json['error'] = $e->getMessage();\n+        }\n+        catch (Exception $e) {\n+\t\t\t$json['error'] = $e->getMessage();\n+\t\t}","path":"catalog/controller/payment/securesubmit.php","position":162,"original_position":162,"commit_id":"b5c167330138d4fa6871689e0bbefbbc212976a4","original_commit_id":"b5c167330138d4fa6871689e0bbefbbc212976a4","user":{"login":"ttnnkkrr","id":1499923,"avatar_url":"https://avatars.githubusercontent.com/u/1499923?v=3","gravatar_id":"","url":"https://api.github.com/users/ttnnkkrr","html_url":"https://github.com/ttnnkkrr","followers_url":"https://api.github.com/users/ttnnkkrr/followers","following_url":"https://api.github.com/users/ttnnkkrr/following{/other_user}","gists_url":"https://api.github.com/users/ttnnkkrr/gists{/gist_id}","starred_url":"https://api.github.com/users/ttnnkkrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ttnnkkrr/subscriptions","organizations_url":"https://api.github.com/users/ttnnkkrr/orgs","repos_url":"https://api.github.com/users/ttnnkkrr/repos","events_url":"https://api.github.com/users/ttnnkkrr/events{/privacy}","received_events_url":"https://api.github.com/users/ttnnkkrr/received_events","type":"User","site_admin":false},"body":"sure","created_at":"2016-06-22T20:13:23Z","updated_at":"2016-06-22T20:13:23Z","html_url":"https://github.com/hps/heartland-opencart-plugin/pull/9#discussion_r68126081","pull_request_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/comments/68126081"},"html":{"href":"https://github.com/hps/heartland-opencart-plugin/pull/9#discussion_r68126081"},"pull_request":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/9","id":73991045,"html_url":"https://github.com/hps/heartland-opencart-plugin/pull/9","diff_url":"https://github.com/hps/heartland-opencart-plugin/pull/9.diff","patch_url":"https://github.com/hps/heartland-opencart-plugin/pull/9.patch","issue_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues/9","number":9,"state":"open","locked":false,"title":"Added velocity checks and updated to latest php-SDK","user":{"login":"ttnnkkrr","id":1499923,"avatar_url":"https://avatars.githubusercontent.com/u/1499923?v=3","gravatar_id":"","url":"https://api.github.com/users/ttnnkkrr","html_url":"https://github.com/ttnnkkrr","followers_url":"https://api.github.com/users/ttnnkkrr/followers","following_url":"https://api.github.com/users/ttnnkkrr/following{/other_user}","gists_url":"https://api.github.com/users/ttnnkkrr/gists{/gist_id}","starred_url":"https://api.github.com/users/ttnnkkrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ttnnkkrr/subscriptions","organizations_url":"https://api.github.com/users/ttnnkkrr/orgs","repos_url":"https://api.github.com/users/ttnnkkrr/repos","events_url":"https://api.github.com/users/ttnnkkrr/events{/privacy}","received_events_url":"https://api.github.com/users/ttnnkkrr/received_events","type":"User","site_admin":false},"body":"Took the opportunity to update a lot of the code for the sake of readability and to lay the ground work for ease of future enhancements. Velocity monitoring done and tested. Open cart preserves sessions indefinitely and I had to invent a method of keeping these limited to a configurable time without affecting sessions as a whole","created_at":"2016-06-15T21:55:14Z","updated_at":"2016-06-22T20:13:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c9426c892266415e185c6674ff7d1cd61404544","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/9/commits","review_comments_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/9/comments","review_comment_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues/9/comments","statuses_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/statuses/b5c167330138d4fa6871689e0bbefbbc212976a4","head":{"label":"hps:velocity-checks","ref":"velocity-checks","sha":"b5c167330138d4fa6871689e0bbefbbc212976a4","user":{"login":"hps","id":5853813,"avatar_url":"https://avatars.githubusercontent.com/u/5853813?v=3","gravatar_id":"","url":"https://api.github.com/users/hps","html_url":"https://github.com/hps","followers_url":"https://api.github.com/users/hps/followers","following_url":"https://api.github.com/users/hps/following{/other_user}","gists_url":"https://api.github.com/users/hps/gists{/gist_id}","starred_url":"https://api.github.com/users/hps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hps/subscriptions","organizations_url":"https://api.github.com/users/hps/orgs","repos_url":"https://api.github.com/users/hps/repos","events_url":"https://api.github.com/users/hps/events{/privacy}","received_events_url":"https://api.github.com/users/hps/received_events","type":"Organization","site_admin":false},"repo":{"id":20064534,"name":"heartland-opencart-plugin","full_name":"hps/heartland-opencart-plugin","owner":{"login":"hps","id":5853813,"avatar_url":"https://avatars.githubusercontent.com/u/5853813?v=3","gravatar_id":"","url":"https://api.github.com/users/hps","html_url":"https://github.com/hps","followers_url":"https://api.github.com/users/hps/followers","following_url":"https://api.github.com/users/hps/following{/other_user}","gists_url":"https://api.github.com/users/hps/gists{/gist_id}","starred_url":"https://api.github.com/users/hps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hps/subscriptions","organizations_url":"https://api.github.com/users/hps/orgs","repos_url":"https://api.github.com/users/hps/repos","events_url":"https://api.github.com/users/hps/events{/privacy}","received_events_url":"https://api.github.com/users/hps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hps/heartland-opencart-plugin","description":"","fork":false,"url":"https://api.github.com/repos/hps/heartland-opencart-plugin","forks_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/forks","keys_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/teams","hooks_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/hooks","issue_events_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/events","assignees_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/tags","blobs_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/languages","stargazers_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/stargazers","contributors_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/contributors","subscribers_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/subscribers","subscription_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/subscription","commits_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/merges","archive_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/downloads","issues_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/labels{/name}","releases_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/deployments","created_at":"2014-05-22T14:40:29Z","updated_at":"2015-02-03T17:30:08Z","pushed_at":"2016-06-22T19:08:11Z","git_url":"git://github.com/hps/heartland-opencart-plugin.git","ssh_url":"git@github.com:hps/heartland-opencart-plugin.git","clone_url":"https://github.com/hps/heartland-opencart-plugin.git","svn_url":"https://github.com/hps/heartland-opencart-plugin","homepage":null,"size":553,"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":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hps:master","ref":"master","sha":"a55725e9c1831e363223650750986a8fa5f78f09","user":{"login":"hps","id":5853813,"avatar_url":"https://avatars.githubusercontent.com/u/5853813?v=3","gravatar_id":"","url":"https://api.github.com/users/hps","html_url":"https://github.com/hps","followers_url":"https://api.github.com/users/hps/followers","following_url":"https://api.github.com/users/hps/following{/other_user}","gists_url":"https://api.github.com/users/hps/gists{/gist_id}","starred_url":"https://api.github.com/users/hps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hps/subscriptions","organizations_url":"https://api.github.com/users/hps/orgs","repos_url":"https://api.github.com/users/hps/repos","events_url":"https://api.github.com/users/hps/events{/privacy}","received_events_url":"https://api.github.com/users/hps/received_events","type":"Organization","site_admin":false},"repo":{"id":20064534,"name":"heartland-opencart-plugin","full_name":"hps/heartland-opencart-plugin","owner":{"login":"hps","id":5853813,"avatar_url":"https://avatars.githubusercontent.com/u/5853813?v=3","gravatar_id":"","url":"https://api.github.com/users/hps","html_url":"https://github.com/hps","followers_url":"https://api.github.com/users/hps/followers","following_url":"https://api.github.com/users/hps/following{/other_user}","gists_url":"https://api.github.com/users/hps/gists{/gist_id}","starred_url":"https://api.github.com/users/hps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hps/subscriptions","organizations_url":"https://api.github.com/users/hps/orgs","repos_url":"https://api.github.com/users/hps/repos","events_url":"https://api.github.com/users/hps/events{/privacy}","received_events_url":"https://api.github.com/users/hps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hps/heartland-opencart-plugin","description":"","fork":false,"url":"https://api.github.com/repos/hps/heartland-opencart-plugin","forks_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/forks","keys_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/teams","hooks_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/hooks","issue_events_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/events","assignees_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/tags","blobs_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/languages","stargazers_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/stargazers","contributors_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/contributors","subscribers_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/subscribers","subscription_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/subscription","commits_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/merges","archive_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/downloads","issues_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/labels{/name}","releases_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/hps/heartland-opencart-plugin/deployments","created_at":"2014-05-22T14:40:29Z","updated_at":"2015-02-03T17:30:08Z","pushed_at":"2016-06-22T19:08:11Z","git_url":"git://github.com/hps/heartland-opencart-plugin.git","ssh_url":"git@github.com:hps/heartland-opencart-plugin.git","clone_url":"https://github.com/hps/heartland-opencart-plugin.git","svn_url":"https://github.com/hps/heartland-opencart-plugin","homepage":null,"size":553,"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":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/9"},"html":{"href":"https://github.com/hps/heartland-opencart-plugin/pull/9"},"issue":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues/9"},"comments":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/hps/heartland-opencart-plugin/statuses/b5c167330138d4fa6871689e0bbefbbc212976a4"}}}}
{"actor":{"display_login":"ttnnkkrr"}}