{"action":"created","comment":{"url":"https://api.github.com/repos/paymentwall/module-cscart/pulls/comments/33220322","id":33220322,"diff_hunk":"@@ -0,0 +1,141 @@\n+<?php\r\n+if (!defined('BOOTSTRAP')) {\r\n+    die('Access denied');\r\n+}\r\n+\r\n+use Tygh\\Registry;\r\n+\r\n+require_once Registry::get('config.dir.lib') . DS . 'other' . DS . 'paymentwall-php' . DS . 'lib' . DS . 'paymentwall.php';\r\n+\r\n+if ($mode == 'ajax') {\r\n+    $status = db_get_field(\"SELECT status FROM ?:orders WHERE order_id = ?i\", $_REQUEST['order_id']);\r\n+    if ($status == \"P\") {\r\n+        fn_clear_cart($_SESSION['cart']);\r\n+    }\r\n+    die($status);\r\n+}\r\n+\r\n+if ($mode == 'frame') {\r\n+    $view->assign('orderId', $_REQUEST['order_id']);\r\n+}\r\n+\r\n+// Payment widget\r\n+if ($mode == 'payment') {\r\n+\r\n+    $rid = $_REQUEST['order_id'];\r\n+    $sid = $_SESSION['pw_order_id'];\r\n+    $iframe = '';\r\n+    $baseUrl = fn_url();\r\n+    $matchOrder = ($rid == $sid);\r\n+    $orderId = $sid;\r\n+    $orderInfo = fn_get_order_info($orderId);\r\n+\r\n+    if ($matchOrder && $orderInfo) {\r\n+\r\n+        $coefficient = db_get_field(\"SELECT coefficient FROM ?:currencies WHERE currency_code = ?s\", $orderInfo['secondary_currency']);\r\n+        $realPrice = $orderInfo['total'] / $coefficient;\r\n+        $paymentInfo = getPaymentConfigs($orderInfo['payment_id']);\r\n+\r\n+        // Prepare Widget Data\r\n+        $uid = empty($orderInfo['user_id']) ? $orderInfo['ip_address'] : $orderInfo['user_id'];\r\n+        $widgetCode = $paymentInfo['widget_type'];\r\n+        $currencyCode = $orderInfo['secondary_currency'];\r\n+        $testMode = $paymentInfo['test_mode'];\r\n+        $products = array();\r\n+\r\n+        Paymentwall_Config::getInstance()->set(array(\r\n+            'api_type' => Paymentwall_Config::API_GOODS,\r\n+            'public_key' => $paymentInfo['key'],\r\n+            'private_key' => $paymentInfo['secret']\r\n+        ));\r\n+\r\n+        if (count($orderInfo['products']) > 0) {\r\n+            $products[] = new Paymentwall_Product($orderId, $realPrice, $currencyCode, 'Order #' . $orderId);\r\n+        }\r\n+\r\n+        $widget = new Paymentwall_Widget($uid, $widgetCode, $products, array(\r\n+            'email' => $orderInfo['email'],\r\n+            'payment_id' => $orderInfo['payment_id'],\r\n+            'integration_module' => 'cs_cart',\r\n+            'test_mode' => $testMode,\r\n+            'ref' => rand(99, 999)\r\n+        ));\r\n+\r\n+        // Generate Widget\r\n+        $iframe = $widget->getHtmlCode(array(\r\n+            'width' => '100%',\r\n+            'height' => 400,\r\n+            'frameborder' => 0\r\n+        ));\r\n+    }\r\n+\r\n+    fn_add_breadcrumb('Paymentwall Payment', '#', true);\r\n+\r\n+    Tygh::$app['view']->assign('matchOrder', $matchOrder);\r\n+    Tygh::$app['view']->assign('orderId', $orderId);\r\n+    Tygh::$app['view']->assign('baseUrl', $baseUrl);\r\n+    Tygh::$app['view']->assign('iframe', $iframe);\r\n+}\r\n+\r\n+if ($mode == 'pingback') {\r\n+\r\n+    define('CREDIT_TYPE_CHARGEBACK', 2);\r\n+    unset($_GET['dispatch']);\r\n+\r\n+    $orderId = isset($_GET['goodsid']) ? $_GET['goodsid'] : null;\r\n+    $paymentId = isset($_GET['payment_id']) ? $_GET['payment_id'] : null;\r\n+    $type = isset($_GET['type']) ? $_GET['type'] : null;\r\n+    $result = false;\r\n+\r\n+    $configs = getPaymentConfigs($paymentId);\r\n+    $result = handlePingback($configs, $orderId, $type);\r\n+\r\n+    if ($result) die('OK');\r\n+\r\n+    exit;\r\n+}\r\n+\r\n+function handlePingback($configs, $orderId, $type)\r\n+{\r\n+    Paymentwall_Config::getInstance()->set(array(\r\n+        'api_type' => Paymentwall_Config::API_GOODS,\r\n+        'public_key' => isset($configs['key']) ? $configs['key'] : null,\r\n+        'private_key' => isset($configs['secret']) ? $configs['secret'] : null,\r\n+    ));\r","path":"src/app/addons/paymentwall/controllers/common/paymentwall.php","position":104,"original_position":104,"commit_id":"de283a4ad73e6401fee84bfed527a6f1a8908797","original_commit_id":"de283a4ad73e6401fee84bfed527a6f1a8908797","user":{"login":"davex69","id":1830504,"avatar_url":"https://avatars.githubusercontent.com/u/1830504?v=3","gravatar_id":"","url":"https://api.github.com/users/davex69","html_url":"https://github.com/davex69","followers_url":"https://api.github.com/users/davex69/followers","following_url":"https://api.github.com/users/davex69/following{/other_user}","gists_url":"https://api.github.com/users/davex69/gists{/gist_id}","starred_url":"https://api.github.com/users/davex69/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davex69/subscriptions","organizations_url":"https://api.github.com/users/davex69/orgs","repos_url":"https://api.github.com/users/davex69/repos","events_url":"https://api.github.com/users/davex69/events{/privacy}","received_events_url":"https://api.github.com/users/davex69/received_events","type":"User","site_admin":false},"body":"move to external function initPaymentwallSdk()\r\n\r\nAnd init there sdk for Widget Call and Pingback","created_at":"2015-06-25T03:52:10Z","updated_at":"2015-06-25T03:52:10Z","html_url":"https://github.com/paymentwall/module-cscart/pull/1#discussion_r33220322","pull_request_url":"https://api.github.com/repos/paymentwall/module-cscart/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/paymentwall/module-cscart/pulls/comments/33220322"},"html":{"href":"https://github.com/paymentwall/module-cscart/pull/1#discussion_r33220322"},"pull_request":{"href":"https://api.github.com/repos/paymentwall/module-cscart/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/paymentwall/module-cscart/pulls/1","id":38092426,"html_url":"https://github.com/paymentwall/module-cscart/pull/1","diff_url":"https://github.com/paymentwall/module-cscart/pull/1.diff","patch_url":"https://github.com/paymentwall/module-cscart/pull/1.patch","issue_url":"https://api.github.com/repos/paymentwall/module-cscart/issues/1","number":1,"state":"open","locked":false,"title":"Update payment module for CS-Cart 4.3.x","user":{"login":"dzung2t","id":6998801,"avatar_url":"https://avatars.githubusercontent.com/u/6998801?v=3","gravatar_id":"","url":"https://api.github.com/users/dzung2t","html_url":"https://github.com/dzung2t","followers_url":"https://api.github.com/users/dzung2t/followers","following_url":"https://api.github.com/users/dzung2t/following{/other_user}","gists_url":"https://api.github.com/users/dzung2t/gists{/gist_id}","starred_url":"https://api.github.com/users/dzung2t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzung2t/subscriptions","organizations_url":"https://api.github.com/users/dzung2t/orgs","repos_url":"https://api.github.com/users/dzung2t/repos","events_url":"https://api.github.com/users/dzung2t/events{/privacy}","received_events_url":"https://api.github.com/users/dzung2t/received_events","type":"User","site_admin":false},"body":"Hi @davex69 and @ivan-kovalyov,\r\nI've updated this module for CS-Cart 4.3.x . Please review it.","created_at":"2015-06-19T09:52:14Z","updated_at":"2015-06-25T03:52:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a303f0b29cb993d2daaec264a45332bf2a34464d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/paymentwall/module-cscart/pulls/1/commits","review_comments_url":"https://api.github.com/repos/paymentwall/module-cscart/pulls/1/comments","review_comment_url":"https://api.github.com/repos/paymentwall/module-cscart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/paymentwall/module-cscart/issues/1/comments","statuses_url":"https://api.github.com/repos/paymentwall/module-cscart/statuses/de283a4ad73e6401fee84bfed527a6f1a8908797","head":{"label":"dzung2t:master","ref":"master","sha":"de283a4ad73e6401fee84bfed527a6f1a8908797","user":{"login":"dzung2t","id":6998801,"avatar_url":"https://avatars.githubusercontent.com/u/6998801?v=3","gravatar_id":"","url":"https://api.github.com/users/dzung2t","html_url":"https://github.com/dzung2t","followers_url":"https://api.github.com/users/dzung2t/followers","following_url":"https://api.github.com/users/dzung2t/following{/other_user}","gists_url":"https://api.github.com/users/dzung2t/gists{/gist_id}","starred_url":"https://api.github.com/users/dzung2t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzung2t/subscriptions","organizations_url":"https://api.github.com/users/dzung2t/orgs","repos_url":"https://api.github.com/users/dzung2t/repos","events_url":"https://api.github.com/users/dzung2t/events{/privacy}","received_events_url":"https://api.github.com/users/dzung2t/received_events","type":"User","site_admin":false},"repo":{"id":37711934,"name":"module-cscart","full_name":"dzung2t/module-cscart","owner":{"login":"dzung2t","id":6998801,"avatar_url":"https://avatars.githubusercontent.com/u/6998801?v=3","gravatar_id":"","url":"https://api.github.com/users/dzung2t","html_url":"https://github.com/dzung2t","followers_url":"https://api.github.com/users/dzung2t/followers","following_url":"https://api.github.com/users/dzung2t/following{/other_user}","gists_url":"https://api.github.com/users/dzung2t/gists{/gist_id}","starred_url":"https://api.github.com/users/dzung2t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzung2t/subscriptions","organizations_url":"https://api.github.com/users/dzung2t/orgs","repos_url":"https://api.github.com/users/dzung2t/repos","events_url":"https://api.github.com/users/dzung2t/events{/privacy}","received_events_url":"https://api.github.com/users/dzung2t/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dzung2t/module-cscart","description":"Paymentwall Module for CS-Cart","fork":true,"url":"https://api.github.com/repos/dzung2t/module-cscart","forks_url":"https://api.github.com/repos/dzung2t/module-cscart/forks","keys_url":"https://api.github.com/repos/dzung2t/module-cscart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dzung2t/module-cscart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dzung2t/module-cscart/teams","hooks_url":"https://api.github.com/repos/dzung2t/module-cscart/hooks","issue_events_url":"https://api.github.com/repos/dzung2t/module-cscart/issues/events{/number}","events_url":"https://api.github.com/repos/dzung2t/module-cscart/events","assignees_url":"https://api.github.com/repos/dzung2t/module-cscart/assignees{/user}","branches_url":"https://api.github.com/repos/dzung2t/module-cscart/branches{/branch}","tags_url":"https://api.github.com/repos/dzung2t/module-cscart/tags","blobs_url":"https://api.github.com/repos/dzung2t/module-cscart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dzung2t/module-cscart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dzung2t/module-cscart/git/refs{/sha}","trees_url":"https://api.github.com/repos/dzung2t/module-cscart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dzung2t/module-cscart/statuses/{sha}","languages_url":"https://api.github.com/repos/dzung2t/module-cscart/languages","stargazers_url":"https://api.github.com/repos/dzung2t/module-cscart/stargazers","contributors_url":"https://api.github.com/repos/dzung2t/module-cscart/contributors","subscribers_url":"https://api.github.com/repos/dzung2t/module-cscart/subscribers","subscription_url":"https://api.github.com/repos/dzung2t/module-cscart/subscription","commits_url":"https://api.github.com/repos/dzung2t/module-cscart/commits{/sha}","git_commits_url":"https://api.github.com/repos/dzung2t/module-cscart/git/commits{/sha}","comments_url":"https://api.github.com/repos/dzung2t/module-cscart/comments{/number}","issue_comment_url":"https://api.github.com/repos/dzung2t/module-cscart/issues/comments{/number}","contents_url":"https://api.github.com/repos/dzung2t/module-cscart/contents/{+path}","compare_url":"https://api.github.com/repos/dzung2t/module-cscart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dzung2t/module-cscart/merges","archive_url":"https://api.github.com/repos/dzung2t/module-cscart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dzung2t/module-cscart/downloads","issues_url":"https://api.github.com/repos/dzung2t/module-cscart/issues{/number}","pulls_url":"https://api.github.com/repos/dzung2t/module-cscart/pulls{/number}","milestones_url":"https://api.github.com/repos/dzung2t/module-cscart/milestones{/number}","notifications_url":"https://api.github.com/repos/dzung2t/module-cscart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dzung2t/module-cscart/labels{/name}","releases_url":"https://api.github.com/repos/dzung2t/module-cscart/releases{/id}","created_at":"2015-06-19T08:54:08Z","updated_at":"2015-06-19T09:46:23Z","pushed_at":"2015-06-24T09:09:50Z","git_url":"git://github.com/dzung2t/module-cscart.git","ssh_url":"git@github.com:dzung2t/module-cscart.git","clone_url":"https://github.com/dzung2t/module-cscart.git","svn_url":"https://github.com/dzung2t/module-cscart","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"paymentwall:master","ref":"master","sha":"600bb204f516a9e65c461e689ee613ee8603f155","user":{"login":"paymentwall","id":5666029,"avatar_url":"https://avatars.githubusercontent.com/u/5666029?v=3","gravatar_id":"","url":"https://api.github.com/users/paymentwall","html_url":"https://github.com/paymentwall","followers_url":"https://api.github.com/users/paymentwall/followers","following_url":"https://api.github.com/users/paymentwall/following{/other_user}","gists_url":"https://api.github.com/users/paymentwall/gists{/gist_id}","starred_url":"https://api.github.com/users/paymentwall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paymentwall/subscriptions","organizations_url":"https://api.github.com/users/paymentwall/orgs","repos_url":"https://api.github.com/users/paymentwall/repos","events_url":"https://api.github.com/users/paymentwall/events{/privacy}","received_events_url":"https://api.github.com/users/paymentwall/received_events","type":"Organization","site_admin":false},"repo":{"id":37711244,"name":"module-cscart","full_name":"paymentwall/module-cscart","owner":{"login":"paymentwall","id":5666029,"avatar_url":"https://avatars.githubusercontent.com/u/5666029?v=3","gravatar_id":"","url":"https://api.github.com/users/paymentwall","html_url":"https://github.com/paymentwall","followers_url":"https://api.github.com/users/paymentwall/followers","following_url":"https://api.github.com/users/paymentwall/following{/other_user}","gists_url":"https://api.github.com/users/paymentwall/gists{/gist_id}","starred_url":"https://api.github.com/users/paymentwall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paymentwall/subscriptions","organizations_url":"https://api.github.com/users/paymentwall/orgs","repos_url":"https://api.github.com/users/paymentwall/repos","events_url":"https://api.github.com/users/paymentwall/events{/privacy}","received_events_url":"https://api.github.com/users/paymentwall/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paymentwall/module-cscart","description":"Paymentwall Module for CS-Cart","fork":false,"url":"https://api.github.com/repos/paymentwall/module-cscart","forks_url":"https://api.github.com/repos/paymentwall/module-cscart/forks","keys_url":"https://api.github.com/repos/paymentwall/module-cscart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paymentwall/module-cscart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paymentwall/module-cscart/teams","hooks_url":"https://api.github.com/repos/paymentwall/module-cscart/hooks","issue_events_url":"https://api.github.com/repos/paymentwall/module-cscart/issues/events{/number}","events_url":"https://api.github.com/repos/paymentwall/module-cscart/events","assignees_url":"https://api.github.com/repos/paymentwall/module-cscart/assignees{/user}","branches_url":"https://api.github.com/repos/paymentwall/module-cscart/branches{/branch}","tags_url":"https://api.github.com/repos/paymentwall/module-cscart/tags","blobs_url":"https://api.github.com/repos/paymentwall/module-cscart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paymentwall/module-cscart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paymentwall/module-cscart/git/refs{/sha}","trees_url":"https://api.github.com/repos/paymentwall/module-cscart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paymentwall/module-cscart/statuses/{sha}","languages_url":"https://api.github.com/repos/paymentwall/module-cscart/languages","stargazers_url":"https://api.github.com/repos/paymentwall/module-cscart/stargazers","contributors_url":"https://api.github.com/repos/paymentwall/module-cscart/contributors","subscribers_url":"https://api.github.com/repos/paymentwall/module-cscart/subscribers","subscription_url":"https://api.github.com/repos/paymentwall/module-cscart/subscription","commits_url":"https://api.github.com/repos/paymentwall/module-cscart/commits{/sha}","git_commits_url":"https://api.github.com/repos/paymentwall/module-cscart/git/commits{/sha}","comments_url":"https://api.github.com/repos/paymentwall/module-cscart/comments{/number}","issue_comment_url":"https://api.github.com/repos/paymentwall/module-cscart/issues/comments{/number}","contents_url":"https://api.github.com/repos/paymentwall/module-cscart/contents/{+path}","compare_url":"https://api.github.com/repos/paymentwall/module-cscart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paymentwall/module-cscart/merges","archive_url":"https://api.github.com/repos/paymentwall/module-cscart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paymentwall/module-cscart/downloads","issues_url":"https://api.github.com/repos/paymentwall/module-cscart/issues{/number}","pulls_url":"https://api.github.com/repos/paymentwall/module-cscart/pulls{/number}","milestones_url":"https://api.github.com/repos/paymentwall/module-cscart/milestones{/number}","notifications_url":"https://api.github.com/repos/paymentwall/module-cscart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paymentwall/module-cscart/labels{/name}","releases_url":"https://api.github.com/repos/paymentwall/module-cscart/releases{/id}","created_at":"2015-06-19T08:39:50Z","updated_at":"2015-06-19T08:39:50Z","pushed_at":"2015-06-24T09:09:50Z","git_url":"git://github.com/paymentwall/module-cscart.git","ssh_url":"git@github.com:paymentwall/module-cscart.git","clone_url":"https://github.com/paymentwall/module-cscart.git","svn_url":"https://github.com/paymentwall/module-cscart","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"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/paymentwall/module-cscart/pulls/1"},"html":{"href":"https://github.com/paymentwall/module-cscart/pull/1"},"issue":{"href":"https://api.github.com/repos/paymentwall/module-cscart/issues/1"},"comments":{"href":"https://api.github.com/repos/paymentwall/module-cscart/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/paymentwall/module-cscart/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/paymentwall/module-cscart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/paymentwall/module-cscart/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/paymentwall/module-cscart/statuses/de283a4ad73e6401fee84bfed527a6f1a8908797"}}}}