Version Notes
N/A
Download this release
Release Info
Developer | ID.me |
Extension | TroopID_Connect |
Version | 1.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.4.0 to 1.0.0
- app/code/community/TroopID/Connect/Block/Adminhtml/Sales/Order/View/Tab/Affiliation.php +46 -0
- app/code/community/TroopID/Connect/Block/Adminhtml/System/Config/Custom.php +34 -0
- app/code/community/TroopID/Connect/Block/Adminhtml/System/Config/Help.php +0 -21
- app/code/community/TroopID/Connect/Block/Adminhtml/System/Config/Instructions.php +6 -15
- app/code/community/TroopID/Connect/Block/Cart.php +11 -2
- app/code/community/TroopID/Connect/Helper/Data.php +37 -4
- app/code/community/TroopID/Connect/Helper/Oauth.php +24 -9
- app/code/community/TroopID/Connect/Model/Rule/Condition.php +27 -6
- app/code/community/TroopID/Connect/Model/Rule/Observer.php +8 -12
- app/code/community/TroopID/Connect/Model/System/Config/Source/Enabled.php +35 -0
- app/code/community/TroopID/Connect/controllers/AuthorizeController.php +16 -8
- app/code/community/TroopID/Connect/etc/adminhtml.xml +1 -1
- app/code/community/TroopID/Connect/etc/config.xml +14 -28
- app/code/community/TroopID/Connect/etc/system.xml +52 -23
- app/code/community/TroopID/Connect/sql/troopid_connect_setup/mysql4-upgrade-0.2.0-0.3.0.php +8 -0
- app/design/adminhtml/default/default/layout/troopid_connect.xml +7 -4
- app/design/adminhtml/default/default/template/troopid/connect/affiliation.phtml +38 -0
- app/design/adminhtml/default/default/template/troopid/connect/order.phtml +0 -204
- app/design/frontend/{default → base}/default/layout/troopid_connect.xml +5 -13
- app/design/frontend/{default → base}/default/template/troopid/connect/callback.phtml +0 -0
- app/design/frontend/base/default/template/troopid/connect/cart.phtml +53 -0
- app/design/frontend/{default → base}/default/template/troopid/connect/script.phtml +6 -3
- app/design/frontend/default/default/template/troopid/connect/cart.phtml +0 -24
- app/etc/modules/TroopID_Connect.xml +1 -1
- app/locale/en_US/TroopID_Connect.csv +0 -31
- package.xml +5 -5
- skin/adminhtml/default/default/troopid/images/logo.png +0 -0
- skin/adminhtml/default/default/troopid/troopid.css +32 -0
- skin/adminhtml/default/default/troopid_connect/images/logo.png +0 -0
- skin/adminhtml/default/default/troopid_connect/troopid.css +0 -25
- skin/frontend/{default/default/troopid_connect → base/default/troopid}/troopid.css +4 -0
- skin/frontend/enterprise/default/troopid/troopid.css +50 -0
app/code/community/TroopID/Connect/Block/Adminhtml/Sales/Order/View/Tab/Affiliation.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TroopID_Connect_Block_Adminhtml_Sales_Order_View_Tab_Affiliation extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface {
|
4 |
+
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->setTemplate("troopid/connect/affiliation.phtml");
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getTabLabel() {
|
12 |
+
return $this->__("ID.me Affiliation");
|
13 |
+
}
|
14 |
+
|
15 |
+
public function getTabTitle() {
|
16 |
+
return $this->__("ID.me Affiliation");
|
17 |
+
}
|
18 |
+
|
19 |
+
public function canShowTab() {
|
20 |
+
return true;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function isHidden() {
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getOrder(){
|
28 |
+
return Mage::registry("current_order");
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getUID() {
|
32 |
+
return $this->getOrder()->getTroopidUid();
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getScope() {
|
36 |
+
return $this->getOrder()->getTroopidScope();
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getAffiliation() {
|
40 |
+
$helper = Mage::helper("troopid_connect");
|
41 |
+
$group = $this->getOrder()->getTroopidAffiliation();
|
42 |
+
$scope = $this->getOrder()->getTroopidScope();
|
43 |
+
|
44 |
+
return $helper->formatAffiliation($scope, $group);
|
45 |
+
}
|
46 |
+
}
|
app/code/community/TroopID/Connect/Block/Adminhtml/System/Config/Custom.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class TroopID_Connect_Block_Adminhtml_System_Config_Custom extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
3 |
+
|
4 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
5 |
+
$html = '<div class="' . $this->_getFrontendClass($element) . '">';
|
6 |
+
$html .= '<div class="heading"><strong>' . $element->getLabel() . '</strong>';
|
7 |
+
$html .= $this->_getCommentHtml($element);
|
8 |
+
$html .= $this->_getContentHtml($element);
|
9 |
+
$html .= '</div></div>';
|
10 |
+
|
11 |
+
return $html;
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _getCommentHtml($element) {
|
15 |
+
$html = "";
|
16 |
+
|
17 |
+
if ($element->getComment())
|
18 |
+
$html .= '<span class="comment">' . $element->getComment() . '</span>';
|
19 |
+
|
20 |
+
return $html;
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _getContentHtml($element) {
|
24 |
+
return "";
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _getFrontendClass($element) {
|
28 |
+
$config = $element->getData("field_config")->asArray();
|
29 |
+
$frontendClass = (string) $config["frontend_class"];
|
30 |
+
|
31 |
+
return 'section-custom' . (empty($frontendClass) ? '' : (' ' . $frontendClass));
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
app/code/community/TroopID/Connect/Block/Adminhtml/System/Config/Help.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class TroopID_Connect_Block_Adminhtml_System_Config_Help extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
|
4 |
-
|
5 |
-
protected function _getHeaderTitleHtml($element) {
|
6 |
-
$html = '<div class="config-heading"><div class="heading"><strong>' . $element->getLegend() . '</strong>';
|
7 |
-
$html .= '<span class="heading-intro">' . $element->getComment() . '</span></div>';
|
8 |
-
$html .= '</div>';
|
9 |
-
|
10 |
-
return $html;
|
11 |
-
}
|
12 |
-
|
13 |
-
protected function _getHeaderCommentHtml($element) {
|
14 |
-
return '';
|
15 |
-
}
|
16 |
-
|
17 |
-
protected function _getCollapseState($element) {
|
18 |
-
return false;
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/TroopID/Connect/Block/Adminhtml/System/Config/Instructions.php
CHANGED
@@ -1,34 +1,25 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class TroopID_Connect_Block_Adminhtml_System_Config_Instructions extends
|
4 |
|
5 |
-
protected function
|
6 |
-
$config = $
|
7 |
|
8 |
-
$html = '<
|
9 |
-
$html .= '<ul class="steps">';
|
10 |
$html .= '<li>' . $this->__("Create a developer account at") . ' <a href="' . $config["developer_url"] . '" target="_blank">' . $config["developer_url"] . '</a></li>';
|
11 |
$html .= '<li>' . $this->__("Register an application at") . ' <a href="' . $config["apps_url"] . '" target="_blank">' . $config["apps_url"] . '</a></li>';
|
12 |
$html .= '<li>' . $this->__("Fill in <strong>Redirect URI</strong> with") . ' ' . Mage::getUrl("troopid/authorize/callback", array("_store" => $this->getStore()->getCode(), "_store_to_url" => false, "_nosid" => true)) . '</li>';
|
13 |
$html .= '<li>' . $this->__("Fill in <strong>Base URI</strong> with") . ' ' . $this->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . '</li>';
|
14 |
-
$html .= '<li>' . $this->__("Copy and paste your <strong>Client ID</strong> and <strong>Client Secret</strong> values from your application settings on
|
15 |
$html .= '<li>' . $this->__("That's it! You are ready to go.") . '</li>';
|
16 |
$html .= '</ul>';
|
17 |
-
$html .= '<div class="heading"><span class="heading-intro"><a href="' . $config["learn_more_url"] . '" target="_blank">' . $this->__("Learn more about
|
18 |
$html .= '<div class="heading"><span class="heading-intro"><a href="' . $config["docs_url"] . '" target="_blank">' . $this->__("Read developer documentation") . '</a></span></div>';
|
19 |
$html .= '</div>';
|
20 |
|
21 |
return $html;
|
22 |
}
|
23 |
|
24 |
-
protected function _getHeaderCommentHtml($element) {
|
25 |
-
return '';
|
26 |
-
}
|
27 |
-
|
28 |
-
protected function _getCollapseState($element) {
|
29 |
-
return false;
|
30 |
-
}
|
31 |
-
|
32 |
protected function getStore() {
|
33 |
$store = Mage::app()->getRequest()->getParam("store");
|
34 |
$site = Mage::app()->getRequest()->getParam("website");
|
1 |
<?php
|
2 |
|
3 |
+
class TroopID_Connect_Block_Adminhtml_System_Config_Instructions extends TroopID_Connect_Block_Adminhtml_System_Config_Custom {
|
4 |
|
5 |
+
protected function _getContentHtml($element) {
|
6 |
+
$config = $element->getData("field_config")->asArray();
|
7 |
|
8 |
+
$html = '<ul class="steps">';
|
|
|
9 |
$html .= '<li>' . $this->__("Create a developer account at") . ' <a href="' . $config["developer_url"] . '" target="_blank">' . $config["developer_url"] . '</a></li>';
|
10 |
$html .= '<li>' . $this->__("Register an application at") . ' <a href="' . $config["apps_url"] . '" target="_blank">' . $config["apps_url"] . '</a></li>';
|
11 |
$html .= '<li>' . $this->__("Fill in <strong>Redirect URI</strong> with") . ' ' . Mage::getUrl("troopid/authorize/callback", array("_store" => $this->getStore()->getCode(), "_store_to_url" => false, "_nosid" => true)) . '</li>';
|
12 |
$html .= '<li>' . $this->__("Fill in <strong>Base URI</strong> with") . ' ' . $this->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . '</li>';
|
13 |
+
$html .= '<li>' . $this->__("Copy and paste your <strong>Client ID</strong> and <strong>Client Secret</strong> values from your application settings on ID.me") . '</li>';
|
14 |
$html .= '<li>' . $this->__("That's it! You are ready to go.") . '</li>';
|
15 |
$html .= '</ul>';
|
16 |
+
$html .= '<div class="heading"><span class="heading-intro"><a href="' . $config["learn_more_url"] . '" target="_blank">' . $this->__("Learn more about ID.me") . '</a></span></div>';
|
17 |
$html .= '<div class="heading"><span class="heading-intro"><a href="' . $config["docs_url"] . '" target="_blank">' . $this->__("Read developer documentation") . '</a></span></div>';
|
18 |
$html .= '</div>';
|
19 |
|
20 |
return $html;
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
protected function getStore() {
|
24 |
$store = Mage::app()->getRequest()->getParam("store");
|
25 |
$site = Mage::app()->getRequest()->getParam("website");
|
app/code/community/TroopID/Connect/Block/Cart.php
CHANGED
@@ -5,16 +5,25 @@ class TroopID_Connect_Block_Cart extends Mage_Checkout_Block_Cart_Abstract {
|
|
5 |
return Mage::helper("troopid_connect")->isOperational();
|
6 |
}
|
7 |
|
|
|
|
|
|
|
|
|
8 |
public function getEndpoint() {
|
9 |
return Mage::getUrl("troopid/authorize/authorize");
|
10 |
}
|
11 |
|
12 |
public function hasAffiliation() {
|
13 |
-
return $this->getQuote() && $this->getQuote()->
|
14 |
}
|
15 |
|
16 |
public function getAffiliation() {
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
public function getAbout() {
|
5 |
return Mage::helper("troopid_connect")->isOperational();
|
6 |
}
|
7 |
|
8 |
+
public function isEnabled($scope) {
|
9 |
+
return Mage::helper("troopid_connect")->isEnabled($scope);
|
10 |
+
}
|
11 |
+
|
12 |
public function getEndpoint() {
|
13 |
return Mage::getUrl("troopid/authorize/authorize");
|
14 |
}
|
15 |
|
16 |
public function hasAffiliation() {
|
17 |
+
return $this->getQuote() && $this->getQuote()->getTroopidScope() !== null;
|
18 |
}
|
19 |
|
20 |
public function getAffiliation() {
|
21 |
+
$helper = Mage::helper("troopid_connect");
|
22 |
+
$quote = $this->getQuote();
|
23 |
+
$scope = $quote->getTroopidScope();
|
24 |
+
$group = $quote->getTroopidAffiliation();
|
25 |
+
|
26 |
+
return $helper->formatAffiliation($scope, $group);
|
27 |
}
|
28 |
|
29 |
public function getAbout() {
|
app/code/community/TroopID/Connect/Helper/Data.php
CHANGED
@@ -9,8 +9,8 @@ class TroopID_Connect_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
9 |
return Mage::getStoreConfig("troopid_connect/settings/" . $key, $storeId);
|
10 |
}
|
11 |
|
12 |
-
public function isEnabled() {
|
13 |
-
return $this->getKey("
|
14 |
}
|
15 |
|
16 |
public function isSandbox() {
|
@@ -18,11 +18,35 @@ class TroopID_Connect_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
18 |
}
|
19 |
|
20 |
public function isOperational() {
|
21 |
-
return $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
public function getAffiliations() {
|
25 |
-
$cache = Mage::getSingleton(
|
26 |
$oauth = Mage::helper("troopid_connect/oauth");
|
27 |
$values = $cache->load(self::CACHE_KEY);
|
28 |
|
@@ -35,4 +59,13 @@ class TroopID_Connect_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
35 |
return $values;
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
9 |
return Mage::getStoreConfig("troopid_connect/settings/" . $key, $storeId);
|
10 |
}
|
11 |
|
12 |
+
public function isEnabled($scope) {
|
13 |
+
return $this->getKey("enabled_" . $scope) === "1";
|
14 |
}
|
15 |
|
16 |
public function isSandbox() {
|
18 |
}
|
19 |
|
20 |
public function isOperational() {
|
21 |
+
return $this->getKey("enabled") == "1" && $this->getKey("client_id") && $this->getKey("client_secret");
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getAffiliationByScope($scope) {
|
25 |
+
$result = null;
|
26 |
+
$groups = $this->getAffiliations();
|
27 |
+
|
28 |
+
foreach ($groups as $group) {
|
29 |
+
if ($group["scope"] == $scope)
|
30 |
+
$result = $group["name"];
|
31 |
+
}
|
32 |
+
|
33 |
+
return $result;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getScopeByAffiliation($affiliation) {
|
37 |
+
$result = null;
|
38 |
+
$groups = $this->getAffiliations();
|
39 |
+
|
40 |
+
foreach ($groups as $group) {
|
41 |
+
if ($group["name"] == $affiliation)
|
42 |
+
$result = $group["scope"];
|
43 |
+
}
|
44 |
+
|
45 |
+
return $result;
|
46 |
}
|
47 |
|
48 |
public function getAffiliations() {
|
49 |
+
$cache = Mage::getSingleton("core/cache");
|
50 |
$oauth = Mage::helper("troopid_connect/oauth");
|
51 |
$values = $cache->load(self::CACHE_KEY);
|
52 |
|
59 |
return $values;
|
60 |
}
|
61 |
|
62 |
+
public function formatAffiliation($scope, $group) {
|
63 |
+
$affiliation = $this->getAffiliationByScope($scope);
|
64 |
+
|
65 |
+
if (!empty($group))
|
66 |
+
$affiliation .= " - " . $group;
|
67 |
+
|
68 |
+
return $affiliation;
|
69 |
+
}
|
70 |
+
|
71 |
}
|
app/code/community/TroopID/Connect/Helper/Oauth.php
CHANGED
@@ -2,13 +2,14 @@
|
|
2 |
|
3 |
class TroopID_Connect_Helper_Oauth extends Mage_Core_Helper_Abstract {
|
4 |
|
5 |
-
const ENDPOINT_SANDBOX = "https://api.sandbox.
|
6 |
-
const ENDPOINT_PRODUCTION = "https://api.
|
7 |
|
8 |
const AUTHORIZE_PATH = "/oauth/authorize";
|
9 |
const TOKEN_PATH = "/oauth/token";
|
10 |
-
const
|
11 |
-
|
|
|
12 |
|
13 |
private function getConfig() {
|
14 |
return Mage::helper("troopid_connect");
|
@@ -18,11 +19,12 @@ class TroopID_Connect_Helper_Oauth extends Mage_Core_Helper_Abstract {
|
|
18 |
return Mage::getUrl("troopid/authorize/callback");
|
19 |
}
|
20 |
|
21 |
-
public function getAuthorizeUrl() {
|
22 |
|
23 |
$params = array(
|
24 |
"client_id" => $this->getConfig()->getKey("client_id"),
|
25 |
"redirect_uri" => $this->getCallbackUrl(),
|
|
|
26 |
"response_type" => "code",
|
27 |
"display" => "popup"
|
28 |
);
|
@@ -36,6 +38,10 @@ class TroopID_Connect_Helper_Oauth extends Mage_Core_Helper_Abstract {
|
|
36 |
$client = new Zend_Http_Client();
|
37 |
|
38 |
$client->setUri($this->getDomain() . self::TOKEN_PATH);
|
|
|
|
|
|
|
|
|
39 |
$client->setParameterPost(array(
|
40 |
"client_id" => $config->getKey("client_id"),
|
41 |
"client_secret" => $config->getKey("client_secret"),
|
@@ -59,19 +65,28 @@ class TroopID_Connect_Helper_Oauth extends Mage_Core_Helper_Abstract {
|
|
59 |
}
|
60 |
|
61 |
|
62 |
-
public function getProfileData($token) {
|
63 |
|
64 |
if (empty($token))
|
65 |
return null;
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
$client = new Zend_Http_Client();
|
68 |
-
$client->setUri($this->getDomain() .
|
69 |
$client->setParameterGet(array(
|
70 |
"access_token" => $token
|
71 |
));
|
72 |
|
73 |
$client->setHeaders(array(
|
74 |
-
"X-API-ORIGIN" =>
|
75 |
));
|
76 |
|
77 |
try {
|
@@ -96,7 +111,7 @@ class TroopID_Connect_Helper_Oauth extends Mage_Core_Helper_Abstract {
|
|
96 |
));
|
97 |
|
98 |
$client->setHeaders(array(
|
99 |
-
"X-API-ORIGIN" =>
|
100 |
));
|
101 |
|
102 |
$response = $client->request("GET");
|
2 |
|
3 |
class TroopID_Connect_Helper_Oauth extends Mage_Core_Helper_Abstract {
|
4 |
|
5 |
+
const ENDPOINT_SANDBOX = "https://api.sandbox.id.me";
|
6 |
+
const ENDPOINT_PRODUCTION = "https://api.id.me";
|
7 |
|
8 |
const AUTHORIZE_PATH = "/oauth/authorize";
|
9 |
const TOKEN_PATH = "/oauth/token";
|
10 |
+
const AFFILIATIONS_PATH = "/v2/affiliations.json";
|
11 |
+
|
12 |
+
const API_ORIGIN = "MAGENTO-IDME";
|
13 |
|
14 |
private function getConfig() {
|
15 |
return Mage::helper("troopid_connect");
|
19 |
return Mage::getUrl("troopid/authorize/callback");
|
20 |
}
|
21 |
|
22 |
+
public function getAuthorizeUrl($scope = "military") {
|
23 |
|
24 |
$params = array(
|
25 |
"client_id" => $this->getConfig()->getKey("client_id"),
|
26 |
"redirect_uri" => $this->getCallbackUrl(),
|
27 |
+
"scope" => $scope,
|
28 |
"response_type" => "code",
|
29 |
"display" => "popup"
|
30 |
);
|
38 |
$client = new Zend_Http_Client();
|
39 |
|
40 |
$client->setUri($this->getDomain() . self::TOKEN_PATH);
|
41 |
+
$client->setHeaders(array(
|
42 |
+
"X-API-ORIGIN" => self::API_ORIGIN
|
43 |
+
));
|
44 |
+
|
45 |
$client->setParameterPost(array(
|
46 |
"client_id" => $config->getKey("client_id"),
|
47 |
"client_secret" => $config->getKey("client_secret"),
|
65 |
}
|
66 |
|
67 |
|
68 |
+
public function getProfileData($token, $scope) {
|
69 |
|
70 |
if (empty($token))
|
71 |
return null;
|
72 |
|
73 |
+
if (empty($scope))
|
74 |
+
$scope = "military";
|
75 |
+
|
76 |
+
$endpoints = array(
|
77 |
+
"military" => "/v2/military.json",
|
78 |
+
"student" => "/v2/student.json",
|
79 |
+
"responder" => "/v2/responder.json"
|
80 |
+
);
|
81 |
+
|
82 |
$client = new Zend_Http_Client();
|
83 |
+
$client->setUri($this->getDomain() . $endpoints[$scope]);
|
84 |
$client->setParameterGet(array(
|
85 |
"access_token" => $token
|
86 |
));
|
87 |
|
88 |
$client->setHeaders(array(
|
89 |
+
"X-API-ORIGIN" => self::API_ORIGIN
|
90 |
));
|
91 |
|
92 |
try {
|
111 |
));
|
112 |
|
113 |
$client->setHeaders(array(
|
114 |
+
"X-API-ORIGIN" => self::API_ORIGIN
|
115 |
));
|
116 |
|
117 |
$response = $client->request("GET");
|
app/code/community/TroopID/Connect/Model/Rule/Condition.php
CHANGED
@@ -4,7 +4,7 @@ class TroopID_Connect_Model_Rule_Condition extends Mage_Rule_Model_Condition_Abs
|
|
4 |
public function loadAttributeOptions() {
|
5 |
|
6 |
$this->setAttributeOption(array(
|
7 |
-
"troopid_affiliation" => Mage::helper("troopid_connect")->__("
|
8 |
));
|
9 |
|
10 |
return $this;
|
@@ -25,7 +25,17 @@ class TroopID_Connect_Model_Rule_Condition extends Mage_Rule_Model_Condition_Abs
|
|
25 |
$affiliations = Mage::helper("troopid_connect")->getAffiliations();
|
26 |
|
27 |
foreach ($affiliations as $affiliation) {
|
28 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
$this->setData("value_select_options", $options);
|
@@ -43,13 +53,24 @@ class TroopID_Connect_Model_Rule_Condition extends Mage_Rule_Model_Condition_Abs
|
|
43 |
|
44 |
public function validate(Varien_Object $object) {
|
45 |
|
46 |
-
|
|
|
|
|
47 |
return true;
|
48 |
|
49 |
-
$quote
|
50 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
return
|
53 |
}
|
54 |
|
55 |
}
|
4 |
public function loadAttributeOptions() {
|
5 |
|
6 |
$this->setAttributeOption(array(
|
7 |
+
"troopid_affiliation" => Mage::helper("troopid_connect")->__("ID.me Verified Affiliation")
|
8 |
));
|
9 |
|
10 |
return $this;
|
25 |
$affiliations = Mage::helper("troopid_connect")->getAffiliations();
|
26 |
|
27 |
foreach ($affiliations as $affiliation) {
|
28 |
+
$name = $affiliation["name"];
|
29 |
+
$groups = $affiliation["groups"];
|
30 |
+
|
31 |
+
if (sizeof($groups) > 0)
|
32 |
+
$options[$name] = $name . " (including all subgroups)";
|
33 |
+
else
|
34 |
+
$options[$name] = $name;
|
35 |
+
|
36 |
+
foreach ($groups as $group) {
|
37 |
+
$options[$name . " - " . $group] = $name . " - " . $group;
|
38 |
+
}
|
39 |
}
|
40 |
|
41 |
$this->setData("value_select_options", $options);
|
53 |
|
54 |
public function validate(Varien_Object $object) {
|
55 |
|
56 |
+
$helper = Mage::helper("troopid_connect");
|
57 |
+
|
58 |
+
if (!$helper->isOperational())
|
59 |
return true;
|
60 |
|
61 |
+
$quote = $object->getQuote();
|
62 |
+
$scope = $quote->getTroopidScope();
|
63 |
+
$group = $quote->getTroopidAffiliation();
|
64 |
+
$name = $helper->getAffiliationByScope($scope);
|
65 |
+
$value = $this->getValue();
|
66 |
+
|
67 |
+
if ($name === $value)
|
68 |
+
return true;
|
69 |
+
|
70 |
+
if ($name === ($value . " - " . $group))
|
71 |
+
return true;
|
72 |
|
73 |
+
return false;
|
74 |
}
|
75 |
|
76 |
}
|
app/code/community/TroopID/Connect/Model/Rule/Observer.php
CHANGED
@@ -3,21 +3,17 @@ class TroopID_Connect_Model_Rule_Observer {
|
|
3 |
|
4 |
public function addCondition(Varien_Event_Observer $observer) {
|
5 |
|
6 |
-
if (!Mage::helper("troopid_connect")->
|
7 |
return;
|
8 |
|
9 |
$conditions = (array) $observer->getEvent()->getAdditional()->getConditions();
|
10 |
-
$conditions = array_merge_recursive($conditions, array(
|
11 |
-
|
12 |
-
|
13 |
-
"
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
)
|
18 |
-
)
|
19 |
-
)
|
20 |
-
));
|
21 |
|
22 |
$observer->getEvent()->getAdditional()->setConditions($conditions);
|
23 |
}
|
3 |
|
4 |
public function addCondition(Varien_Event_Observer $observer) {
|
5 |
|
6 |
+
if (!Mage::helper("troopid_connect")->isOperational())
|
7 |
return;
|
8 |
|
9 |
$conditions = (array) $observer->getEvent()->getAdditional()->getConditions();
|
10 |
+
$conditions = array_merge_recursive($conditions, array(array(
|
11 |
+
"label" => Mage::helper("troopid_connect")->__("ID.me"),
|
12 |
+
"value" => array(array(
|
13 |
+
"label" => Mage::helper("troopid_connect")->__("Verified Affiliation"),
|
14 |
+
"value" => "troopid_connect/rule_condition"
|
15 |
+
))
|
16 |
+
)));
|
|
|
|
|
|
|
|
|
17 |
|
18 |
$observer->getEvent()->getAdditional()->setConditions($conditions);
|
19 |
}
|
app/code/community/TroopID/Connect/Model/System/Config/Source/Enabled.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Used in creating options for Enabled|Disabled config value selection
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class TroopID_Connect_Model_System_Config_Source_Enabled
|
7 |
+
{
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Options getter
|
11 |
+
*
|
12 |
+
* @return array
|
13 |
+
*/
|
14 |
+
public function toOptionArray()
|
15 |
+
{
|
16 |
+
return array(
|
17 |
+
array("value" => 1, "label" => Mage::helper("troopid_connect")->__("Enabled")),
|
18 |
+
array("value" => 0, "label" => Mage::helper("troopid_connect")->__("Disabled")),
|
19 |
+
);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get options in "key-value" format
|
24 |
+
*
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function toArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
0 => Mage::helper("troopid_connect")->__("No"),
|
31 |
+
1 => Mage::helper("troopid_connect")->__("Yes"),
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
app/code/community/TroopID/Connect/controllers/AuthorizeController.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
class TroopID_Connect_AuthorizeController extends Mage_Core_Controller_Front_Action {
|
4 |
|
5 |
private function getSession() {
|
@@ -19,7 +18,12 @@ class TroopID_Connect_AuthorizeController extends Mage_Core_Controller_Front_Act
|
|
19 |
}
|
20 |
|
21 |
public function authorizeAction() {
|
22 |
-
$
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
public function callbackAction() {
|
@@ -28,34 +32,38 @@ class TroopID_Connect_AuthorizeController extends Mage_Core_Controller_Front_Act
|
|
28 |
$oauth = $this->getOauth();
|
29 |
$session = $this->getSession();
|
30 |
|
|
|
|
|
|
|
31 |
/* code from initial callback */
|
32 |
$code = $this->getRequest()->getParam("code");
|
33 |
|
34 |
/* code was not found, invalid callback request */
|
35 |
if (empty($code)) {
|
36 |
-
$session->addError($config->__("
|
37 |
} else {
|
38 |
|
39 |
/* request access token with the given code */
|
40 |
$token = $oauth->getAccessToken($code);
|
41 |
|
42 |
/* request user profile data with the given access token */
|
43 |
-
$data = $oauth->getProfileData($token);
|
44 |
|
45 |
if (empty($data)) {
|
46 |
-
$session->addError($config->__("
|
47 |
} else {
|
48 |
$cart = $this->getCart();
|
49 |
$quote = $cart->getQuote();
|
50 |
|
51 |
if ($data["verified"]) {
|
52 |
-
$quote->setTroopidAffiliation($data["affiliation"]);
|
53 |
$quote->setTroopidUid($data["id"]);
|
|
|
|
|
54 |
$quote->save();
|
55 |
|
56 |
-
$session->addSuccess($config->__("Successfully verified
|
57 |
} else {
|
58 |
-
$session->addError($config->__("Unfortunately your have not verified your affiliation with
|
59 |
}
|
60 |
}
|
61 |
}
|
1 |
<?php
|
|
|
2 |
class TroopID_Connect_AuthorizeController extends Mage_Core_Controller_Front_Action {
|
3 |
|
4 |
private function getSession() {
|
18 |
}
|
19 |
|
20 |
public function authorizeAction() {
|
21 |
+
$session = $this->getSession();
|
22 |
+
$scope = $this->getRequest()->getParam("scope");
|
23 |
+
$url = $this->getOauth()->getAuthorizeUrl($scope);
|
24 |
+
|
25 |
+
$session->setScope($scope);
|
26 |
+
$this->getResponse()->setRedirect($url);
|
27 |
}
|
28 |
|
29 |
public function callbackAction() {
|
32 |
$oauth = $this->getOauth();
|
33 |
$session = $this->getSession();
|
34 |
|
35 |
+
/* scope from session */
|
36 |
+
$scope = $session->getScope();
|
37 |
+
|
38 |
/* code from initial callback */
|
39 |
$code = $this->getRequest()->getParam("code");
|
40 |
|
41 |
/* code was not found, invalid callback request */
|
42 |
if (empty($code)) {
|
43 |
+
$session->addError($config->__("ID.me verification failed, please contact the store owner"));
|
44 |
} else {
|
45 |
|
46 |
/* request access token with the given code */
|
47 |
$token = $oauth->getAccessToken($code);
|
48 |
|
49 |
/* request user profile data with the given access token */
|
50 |
+
$data = $oauth->getProfileData($token, $scope);
|
51 |
|
52 |
if (empty($data)) {
|
53 |
+
$session->addError($config->__("ID.me verification failed, please contact the store owner"));
|
54 |
} else {
|
55 |
$cart = $this->getCart();
|
56 |
$quote = $cart->getQuote();
|
57 |
|
58 |
if ($data["verified"]) {
|
|
|
59 |
$quote->setTroopidUid($data["id"]);
|
60 |
+
$quote->setTroopidScope($scope);
|
61 |
+
$quote->setTroopidAffiliation($data["affiliation"]);
|
62 |
$quote->save();
|
63 |
|
64 |
+
$session->addSuccess($config->__("Successfully verified your affiliation via ID.me"));
|
65 |
} else {
|
66 |
+
$session->addError($config->__("Unfortunately your have not verified your affiliation with ID.me"));
|
67 |
}
|
68 |
}
|
69 |
}
|
app/code/community/TroopID/Connect/etc/adminhtml.xml
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
<children>
|
9 |
<config>
|
10 |
<children>
|
11 |
-
<troopid_connect
|
12 |
<title>Troop ID Connect Settings</title>
|
13 |
<sort_order>9999</sort_order>
|
14 |
</troopid_connect>
|
8 |
<children>
|
9 |
<config>
|
10 |
<children>
|
11 |
+
<troopid_connect module="troopid_connect">
|
12 |
<title>Troop ID Connect Settings</title>
|
13 |
<sort_order>9999</sort_order>
|
14 |
</troopid_connect>
|
app/code/community/TroopID/Connect/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<TroopID_Connect>
|
5 |
-
<version>0.
|
6 |
</TroopID_Connect>
|
7 |
</modules>
|
8 |
|
@@ -24,16 +24,6 @@
|
|
24 |
</troopid_connect>
|
25 |
</updates>
|
26 |
</layout>
|
27 |
-
|
28 |
-
<translate>
|
29 |
-
<modules>
|
30 |
-
<TroopID_Connect>
|
31 |
-
<files>
|
32 |
-
<default>TroopID_Connect.csv</default>
|
33 |
-
</files>
|
34 |
-
</TroopID_Connect>
|
35 |
-
</modules>
|
36 |
-
</translate>
|
37 |
</frontend>
|
38 |
|
39 |
<adminhtml>
|
@@ -45,29 +35,19 @@
|
|
45 |
</updates>
|
46 |
</layout>
|
47 |
|
48 |
-
<translate>
|
49 |
-
<modules>
|
50 |
-
<TroopID_Connect>
|
51 |
-
<files>
|
52 |
-
<default>TroopID_Connect.csv</default>
|
53 |
-
</files>
|
54 |
-
</TroopID_Connect>
|
55 |
-
</modules>
|
56 |
-
</translate>
|
57 |
-
</adminhtml>
|
58 |
-
|
59 |
-
<global>
|
60 |
<events>
|
61 |
<salesrule_rule_condition_combine>
|
62 |
<observers>
|
63 |
-
<
|
64 |
<class>troopid_connect/rule_observer</class>
|
65 |
<method>addCondition</method>
|
66 |
-
</
|
67 |
</observers>
|
68 |
</salesrule_rule_condition_combine>
|
69 |
</events>
|
|
|
70 |
|
|
|
71 |
<fieldsets>
|
72 |
<sales_convert_quote>
|
73 |
<troopid_affiliation>
|
@@ -76,6 +56,9 @@
|
|
76 |
<troopid_uid>
|
77 |
<to_order>*</to_order>
|
78 |
</troopid_uid>
|
|
|
|
|
|
|
79 |
</sales_convert_quote>
|
80 |
</fieldsets>
|
81 |
|
@@ -127,10 +110,13 @@
|
|
127 |
<settings>
|
128 |
<enabled>1</enabled>
|
129 |
<sandbox_mode>1</sandbox_mode>
|
|
|
|
|
|
|
130 |
<about><![CDATA[
|
131 |
-
<p><strong>Who is eligible for
|
132 |
-
Veterans, Service Members, Retirees, Military Spouses and their Immediate Family Members i.e. parents and children of Veterans, Service Members, Retirees and Military Spouses are eligible to sign up for
|
133 |
-
<p><strong>Does signing up for
|
134 |
No, you may receive a message inviting you to opt in to relevant communications, but you are not required or automatically signed up for these newsletters.</p>
|
135 |
]]>
|
136 |
</about>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<TroopID_Connect>
|
5 |
+
<version>0.3.0</version>
|
6 |
</TroopID_Connect>
|
7 |
</modules>
|
8 |
|
24 |
</troopid_connect>
|
25 |
</updates>
|
26 |
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
</frontend>
|
28 |
|
29 |
<adminhtml>
|
35 |
</updates>
|
36 |
</layout>
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
<events>
|
39 |
<salesrule_rule_condition_combine>
|
40 |
<observers>
|
41 |
+
<add_troopid_condition_to_sales_rule>
|
42 |
<class>troopid_connect/rule_observer</class>
|
43 |
<method>addCondition</method>
|
44 |
+
</add_troopid_condition_to_sales_rule>
|
45 |
</observers>
|
46 |
</salesrule_rule_condition_combine>
|
47 |
</events>
|
48 |
+
</adminhtml>
|
49 |
|
50 |
+
<global>
|
51 |
<fieldsets>
|
52 |
<sales_convert_quote>
|
53 |
<troopid_affiliation>
|
56 |
<troopid_uid>
|
57 |
<to_order>*</to_order>
|
58 |
</troopid_uid>
|
59 |
+
<troopid_scope>
|
60 |
+
<to_order>*</to_order>
|
61 |
+
</troopid_scope>
|
62 |
</sales_convert_quote>
|
63 |
</fieldsets>
|
64 |
|
110 |
<settings>
|
111 |
<enabled>1</enabled>
|
112 |
<sandbox_mode>1</sandbox_mode>
|
113 |
+
<enable_military>1</enable_military>
|
114 |
+
<enable_student>1</enable_student>
|
115 |
+
<enable_responder>1</enable_responder>
|
116 |
<about><![CDATA[
|
117 |
+
<p><strong>Who is eligible for ID.me membership?</strong><br/>
|
118 |
+
Students, First Responders, Veterans, Service Members, Retirees, Military Spouses and their Immediate Family Members i.e. parents and children of Veterans, Service Members, Retirees and Military Spouses are eligible to sign up for ID.me</p>
|
119 |
+
<p><strong>Does signing up for ID.me mean I'll start receiving newsletters and promotions from ID.me?</strong><br/>
|
120 |
No, you may receive a message inviting you to opt in to relevant communications, but you are not required or automatically signed up for these newsletters.</p>
|
121 |
]]>
|
122 |
</about>
|
app/code/community/TroopID/Connect/etc/system.xml
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
<config>
|
2 |
<tabs>
|
3 |
-
<troopid_config
|
4 |
-
<label>
|
5 |
<sort_order>99999</sort_order>
|
6 |
</troopid_config>
|
7 |
</tabs>
|
8 |
<sections>
|
9 |
-
<troopid_connect
|
10 |
-
<label>
|
11 |
<tab>troopid_config</tab>
|
12 |
<sort_order>9999</sort_order>
|
13 |
<show_in_default>1</show_in_default>
|
14 |
<show_in_website>1</show_in_website>
|
15 |
<show_in_store>1</show_in_store>
|
16 |
<groups>
|
17 |
-
<settings
|
18 |
<label>Application Settings</label>
|
19 |
<expanded>1</expanded>
|
20 |
<sort_order>10</sort_order>
|
21 |
<show_in_default>1</show_in_default>
|
22 |
<show_in_website>1</show_in_website>
|
23 |
<show_in_store>1</show_in_store>
|
24 |
-
<
|
25 |
<fields>
|
26 |
-
<info
|
27 |
-
<label>
|
28 |
<frontend_class>troopid-connect first</frontend_class>
|
29 |
-
<frontend_model>troopid_connect/
|
30 |
<comment>
|
31 |
-
<![CDATA[Create discounts on special offers exclusively for verified military members via
|
32 |
</comment>
|
33 |
<sort_order>0</sort_order>
|
34 |
<show_in_default>1</show_in_default>
|
35 |
<show_in_website>1</show_in_website>
|
36 |
<show_in_store>1</show_in_store>
|
37 |
</info>
|
38 |
-
<instructions
|
39 |
<label>Required steps to get started</label>
|
40 |
<frontend_class>troopid-connect last</frontend_class>
|
41 |
<frontend_model>troopid_connect/adminhtml_system_config_instructions</frontend_model>
|
@@ -43,13 +43,12 @@
|
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
46 |
-
<developer_url><![CDATA[https://developer.
|
47 |
-
<apps_url><![CDATA[https://developer.
|
48 |
-
<docs_url><![CDATA[https://developer.
|
49 |
-
<learn_more_url><![CDATA[https://www.
|
50 |
</instructions>
|
51 |
-
|
52 |
-
<enabled translate="label">
|
53 |
<label>Enabled?</label>
|
54 |
<frontend_type>select</frontend_type>
|
55 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -59,7 +58,7 @@
|
|
59 |
<show_in_store>1</show_in_store>
|
60 |
<comment/>
|
61 |
</enabled>
|
62 |
-
<client_id
|
63 |
<label>Client ID</label>
|
64 |
<frontend_type>text</frontend_type>
|
65 |
<sort_order>3</sort_order>
|
@@ -68,7 +67,7 @@
|
|
68 |
<show_in_store>1</show_in_store>
|
69 |
<comment/>
|
70 |
</client_id>
|
71 |
-
<client_secret
|
72 |
<label>Client Secret</label>
|
73 |
<frontend_type>text</frontend_type>
|
74 |
<sort_order>4</sort_order>
|
@@ -77,7 +76,7 @@
|
|
77 |
<show_in_store>1</show_in_store>
|
78 |
<comment/>
|
79 |
</client_secret>
|
80 |
-
<sandbox_mode
|
81 |
<label>Sandbox Mode?</label>
|
82 |
<frontend_type>select</frontend_type>
|
83 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -87,15 +86,45 @@
|
|
87 |
<show_in_store>1</show_in_store>
|
88 |
<comment/>
|
89 |
</sandbox_mode>
|
90 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
<label>Instructions</label>
|
92 |
<frontend_type>textarea</frontend_type>
|
93 |
-
<sort_order>
|
94 |
<show_in_default>1</show_in_default>
|
95 |
<show_in_website>1</show_in_website>
|
96 |
<show_in_store>1</show_in_store>
|
97 |
<comment>
|
98 |
-
<![CDATA[This text will be displayed as "What is this?" in your shopping cart next to
|
99 |
</comment>
|
100 |
</about>
|
101 |
</fields>
|
1 |
<config>
|
2 |
<tabs>
|
3 |
+
<troopid_config module="troopid_connect">
|
4 |
+
<label>ID.me Settings</label>
|
5 |
<sort_order>99999</sort_order>
|
6 |
</troopid_config>
|
7 |
</tabs>
|
8 |
<sections>
|
9 |
+
<troopid_connect module="troopid_connect">
|
10 |
+
<label>ID.me Connect</label>
|
11 |
<tab>troopid_config</tab>
|
12 |
<sort_order>9999</sort_order>
|
13 |
<show_in_default>1</show_in_default>
|
14 |
<show_in_website>1</show_in_website>
|
15 |
<show_in_store>1</show_in_store>
|
16 |
<groups>
|
17 |
+
<settings module="troopid_connect">
|
18 |
<label>Application Settings</label>
|
19 |
<expanded>1</expanded>
|
20 |
<sort_order>10</sort_order>
|
21 |
<show_in_default>1</show_in_default>
|
22 |
<show_in_website>1</show_in_website>
|
23 |
<show_in_store>1</show_in_store>
|
24 |
+
<fieldset_css>troopid-config</fieldset_css>
|
25 |
<fields>
|
26 |
+
<info>
|
27 |
+
<label>ID.me Affiliation Verification</label>
|
28 |
<frontend_class>troopid-connect first</frontend_class>
|
29 |
+
<frontend_model>troopid_connect/adminhtml_system_config_custom</frontend_model>
|
30 |
<comment>
|
31 |
+
<![CDATA[Create discounts on special offers exclusively for verified military members, students or first responders via ID.me]]>
|
32 |
</comment>
|
33 |
<sort_order>0</sort_order>
|
34 |
<show_in_default>1</show_in_default>
|
35 |
<show_in_website>1</show_in_website>
|
36 |
<show_in_store>1</show_in_store>
|
37 |
</info>
|
38 |
+
<instructions>
|
39 |
<label>Required steps to get started</label>
|
40 |
<frontend_class>troopid-connect last</frontend_class>
|
41 |
<frontend_model>troopid_connect/adminhtml_system_config_instructions</frontend_model>
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
46 |
+
<developer_url><![CDATA[https://developer.id.me]]></developer_url>
|
47 |
+
<apps_url><![CDATA[https://developer.id.me/applications]]></apps_url>
|
48 |
+
<docs_url><![CDATA[https://developer.id.me/documentation]]></docs_url>
|
49 |
+
<learn_more_url><![CDATA[https://www.id.me/partner-with-us]]></learn_more_url>
|
50 |
</instructions>
|
51 |
+
<enabled>
|
|
|
52 |
<label>Enabled?</label>
|
53 |
<frontend_type>select</frontend_type>
|
54 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
58 |
<show_in_store>1</show_in_store>
|
59 |
<comment/>
|
60 |
</enabled>
|
61 |
+
<client_id>
|
62 |
<label>Client ID</label>
|
63 |
<frontend_type>text</frontend_type>
|
64 |
<sort_order>3</sort_order>
|
67 |
<show_in_store>1</show_in_store>
|
68 |
<comment/>
|
69 |
</client_id>
|
70 |
+
<client_secret>
|
71 |
<label>Client Secret</label>
|
72 |
<frontend_type>text</frontend_type>
|
73 |
<sort_order>4</sort_order>
|
76 |
<show_in_store>1</show_in_store>
|
77 |
<comment/>
|
78 |
</client_secret>
|
79 |
+
<sandbox_mode>
|
80 |
<label>Sandbox Mode?</label>
|
81 |
<frontend_type>select</frontend_type>
|
82 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
86 |
<show_in_store>1</show_in_store>
|
87 |
<comment/>
|
88 |
</sandbox_mode>
|
89 |
+
<enabled_military>
|
90 |
+
<label>Military verification</label>
|
91 |
+
<frontend_type>select</frontend_type>
|
92 |
+
<source_model>troopid_connect/system_config_source_enabled</source_model>
|
93 |
+
<sort_order>6</sort_order>
|
94 |
+
<show_in_default>1</show_in_default>
|
95 |
+
<show_in_website>1</show_in_website>
|
96 |
+
<show_in_store>1</show_in_store>
|
97 |
+
<comment/>
|
98 |
+
</enabled_military>
|
99 |
+
<enabled_student>
|
100 |
+
<label>Student verification</label>
|
101 |
+
<frontend_type>select</frontend_type>
|
102 |
+
<source_model>troopid_connect/system_config_source_enabled</source_model>
|
103 |
+
<sort_order>7</sort_order>
|
104 |
+
<show_in_default>1</show_in_default>
|
105 |
+
<show_in_website>1</show_in_website>
|
106 |
+
<show_in_store>1</show_in_store>
|
107 |
+
<comment/>
|
108 |
+
</enabled_student>
|
109 |
+
<enabled_responder>
|
110 |
+
<label>First Responder verification</label>
|
111 |
+
<frontend_type>select</frontend_type>
|
112 |
+
<source_model>troopid_connect/system_config_source_enabled</source_model>
|
113 |
+
<sort_order>8</sort_order>
|
114 |
+
<show_in_default>1</show_in_default>
|
115 |
+
<show_in_website>1</show_in_website>
|
116 |
+
<show_in_store>1</show_in_store>
|
117 |
+
<comment/>
|
118 |
+
</enabled_responder>
|
119 |
+
<about>
|
120 |
<label>Instructions</label>
|
121 |
<frontend_type>textarea</frontend_type>
|
122 |
+
<sort_order>9</sort_order>
|
123 |
<show_in_default>1</show_in_default>
|
124 |
<show_in_website>1</show_in_website>
|
125 |
<show_in_store>1</show_in_store>
|
126 |
<comment>
|
127 |
+
<![CDATA[This text will be displayed as "What is this?" in your shopping cart next to ID.me Connect button]]>
|
128 |
</comment>
|
129 |
</about>
|
130 |
</fields>
|
app/code/community/TroopID/Connect/sql/troopid_connect_setup/mysql4-upgrade-0.2.0-0.3.0.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$this->startSetup();
|
4 |
+
|
5 |
+
$this->getConnection()->addColumn($this->getTable("sales/order"), "troopid_scope", "varchar(255)");
|
6 |
+
$this->getConnection()->addColumn($this->getTable("sales/quote"), "troopid_scope", "varchar(255)");
|
7 |
+
|
8 |
+
$this->endSetup();
|
app/design/adminhtml/default/default/layout/troopid_connect.xml
CHANGED
@@ -2,14 +2,17 @@
|
|
2 |
<layout version="0.1.0">
|
3 |
<default>
|
4 |
<reference name="head">
|
5 |
-
<action method="addCss"
|
|
|
|
|
6 |
</reference>
|
7 |
</default>
|
8 |
|
9 |
<adminhtml_sales_order_view>
|
10 |
-
<reference name="
|
11 |
-
<action method="
|
12 |
-
<
|
|
|
13 |
</action>
|
14 |
</reference>
|
15 |
</adminhtml_sales_order_view>
|
2 |
<layout version="0.1.0">
|
3 |
<default>
|
4 |
<reference name="head">
|
5 |
+
<action method="addCss">
|
6 |
+
<stylesheet>troopid/troopid.css</stylesheet>
|
7 |
+
</action>
|
8 |
</reference>
|
9 |
</default>
|
10 |
|
11 |
<adminhtml_sales_order_view>
|
12 |
+
<reference name="sales_order_tabs">
|
13 |
+
<action method="addTab">
|
14 |
+
<name>troopid_affiliation</name>
|
15 |
+
<block>troopid_connect/adminhtml_sales_order_view_tab_affiliation</block>
|
16 |
</action>
|
17 |
</reference>
|
18 |
</adminhtml_sales_order_view>
|
app/design/adminhtml/default/default/template/troopid/connect/affiliation.phtml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="box-left">
|
2 |
+
<div class="entry-edit">
|
3 |
+
<div class="entry-edit-head">
|
4 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper("troopid_connect")->__("ID.me Verified Affiliation") ?></h4>
|
5 |
+
<div class="tools"></div>
|
6 |
+
</div>
|
7 |
+
<div class="fieldset">
|
8 |
+
<div class="hor-scroll">
|
9 |
+
<table cellspacing="0" class="form-list">
|
10 |
+
<tr>
|
11 |
+
<td class="label">
|
12 |
+
<label><?php echo Mage::helper("troopid_connect")->__("Affiliation") ?></label>
|
13 |
+
</td>
|
14 |
+
<td class="value">
|
15 |
+
<strong><?php echo $this->getAffiliation() ?></strong>
|
16 |
+
</td>
|
17 |
+
</tr>
|
18 |
+
<tr>
|
19 |
+
<td class="label">
|
20 |
+
<label><?php echo Mage::helper("troopid_connect")->__("UID") ?></label>
|
21 |
+
</td>
|
22 |
+
<td class="value">
|
23 |
+
<strong><?php echo $this->getUID() ?></strong>
|
24 |
+
</td>
|
25 |
+
</tr>
|
26 |
+
<tr>
|
27 |
+
<td class="label">
|
28 |
+
<label><?php echo Mage::helper("troopid_connect")->__("Scope") ?></label>
|
29 |
+
</td>
|
30 |
+
<td class="value">
|
31 |
+
<strong><?php echo $this->getScope() ?></strong>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
</table>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
</div>
|
app/design/adminhtml/default/default/template/troopid/connect/order.phtml
DELETED
@@ -1,204 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php $_order = $this->getOrder() ?>
|
28 |
-
<?php
|
29 |
-
$orderAdminDate = $this->formatDate($_order->getCreatedAtDate(), 'medium', true);
|
30 |
-
$orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true);
|
31 |
-
?>
|
32 |
-
<div class="box-left">
|
33 |
-
<!--Order Information-->
|
34 |
-
<div class="entry-edit">
|
35 |
-
<?php if ($_order->getEmailSent()):
|
36 |
-
$_email = Mage::helper('sales')->__('the order confirmation email was sent');
|
37 |
-
else:
|
38 |
-
$_email = Mage::helper('sales')->__('the order confirmation email is not sent');
|
39 |
-
endif; ?>
|
40 |
-
<div class="entry-edit-head">
|
41 |
-
<?php if ($this->getNoUseOrderLink()): ?>
|
42 |
-
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?> (<?php echo $_email ?>)</h4>
|
43 |
-
<?php else: ?>
|
44 |
-
<a href="<?php echo $this->getViewUrl($_order->getId()) ?>"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?></a>
|
45 |
-
<strong>(<?php echo $_email ?>)</strong>
|
46 |
-
<?php endif; ?>
|
47 |
-
</div>
|
48 |
-
<div class="fieldset">
|
49 |
-
<table cellspacing="0" class="form-list">
|
50 |
-
<tr>
|
51 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Order Date') ?></label></td>
|
52 |
-
<td class="value"><strong><?php echo $orderAdminDate ?></strong></td>
|
53 |
-
</tr>
|
54 |
-
<?php if ($orderAdminDate != $orderStoreDate):?>
|
55 |
-
<tr>
|
56 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Order Date (%s)', $_order->getCreatedAtStoreDate()->getTimezone()) ?></label></td>
|
57 |
-
<td class="value"><strong><?php echo $orderStoreDate ?></strong></td>
|
58 |
-
</tr>
|
59 |
-
<?php endif;?>
|
60 |
-
<tr>
|
61 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Order Status') ?></label></td>
|
62 |
-
<td class="value"><strong><span id="order_status"><?php echo $_order->getStatusLabel() ?></span></strong></td>
|
63 |
-
</tr>
|
64 |
-
<tr>
|
65 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Purchased From') ?></label></td>
|
66 |
-
<td class="value"><strong><?php echo $this->getOrderStoreName() ?></strong></td>
|
67 |
-
</tr>
|
68 |
-
<?php if($_order->getRelationChildId()): ?>
|
69 |
-
<tr>
|
70 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Link to the New Order') ?></label></td>
|
71 |
-
<td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationChildId()) ?>">
|
72 |
-
<?php echo $_order->getRelationChildRealId() ?>
|
73 |
-
</a></td>
|
74 |
-
</tr>
|
75 |
-
<?php endif; ?>
|
76 |
-
<?php if($_order->getRelationParentId()): ?>
|
77 |
-
<tr>
|
78 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Link to the Previous Order') ?></label></td>
|
79 |
-
<td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationParentId()) ?>">
|
80 |
-
<?php echo $_order->getRelationParentRealId() ?>
|
81 |
-
</a></td>
|
82 |
-
</tr>
|
83 |
-
<?php endif; ?>
|
84 |
-
<?php if($_order->getRemoteIp() && $this->shouldDisplayCustomerIp()): ?>
|
85 |
-
<tr>
|
86 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Placed from IP') ?></label></td>
|
87 |
-
<td class="value"><strong><?php echo $_order->getRemoteIp(); echo ($_order->getXForwardedFor())?' (' . $this->escapeHtml($_order->getXForwardedFor()) . ')':''; ?></strong></td>
|
88 |
-
</tr>
|
89 |
-
<?php endif; ?>
|
90 |
-
<?php if($_order->getGlobalCurrencyCode() != $_order->getBaseCurrencyCode()): ?>
|
91 |
-
<tr>
|
92 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getGlobalCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
|
93 |
-
<td class="value"><strong><?php echo $_order->getBaseToGlobalRate() ?></strong></td>
|
94 |
-
</tr>
|
95 |
-
<?php endif; ?>
|
96 |
-
<?php if($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?>
|
97 |
-
<tr>
|
98 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
|
99 |
-
<td class="value"><strong><?php echo $_order->getBaseToOrderRate() ?></strong></td>
|
100 |
-
</tr>
|
101 |
-
<?php endif; ?>
|
102 |
-
</table>
|
103 |
-
</div>
|
104 |
-
</div>
|
105 |
-
</div>
|
106 |
-
<div class="box-right">
|
107 |
-
<!--Account Information-->
|
108 |
-
<div class="entry-edit">
|
109 |
-
<div class="entry-edit-head">
|
110 |
-
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Account Information') ?></h4>
|
111 |
-
<div class="tools"><?php echo $this->getAccountEditLink()?></div>
|
112 |
-
</div>
|
113 |
-
<div class="fieldset">
|
114 |
-
<div class="hor-scroll">
|
115 |
-
<table cellspacing="0" class="form-list">
|
116 |
-
<tr>
|
117 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Customer Name') ?></label></td>
|
118 |
-
<td class="value">
|
119 |
-
<?php if ($_customerUrl=$this->getCustomerViewUrl()) : ?>
|
120 |
-
<a href="<?php echo $_customerUrl ?>" target="_blank"><strong><?php echo $this->htmlEscape($_order->getCustomerName()) ?></strong></a>
|
121 |
-
<?php else: ?>
|
122 |
-
<strong><?php echo $this->htmlEscape($_order->getCustomerName()) ?></strong>
|
123 |
-
<?php endif; ?>
|
124 |
-
</td>
|
125 |
-
</tr>
|
126 |
-
<tr>
|
127 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Email') ?></label></td>
|
128 |
-
<td class="value"><a href="mailto:<?php echo $_order->getCustomerEmail() ?>"><strong><?php echo $_order->getCustomerEmail() ?></strong></a></td>
|
129 |
-
</tr>
|
130 |
-
<?php if ($_groupName = $this->getCustomerGroupName()) : ?>
|
131 |
-
<tr>
|
132 |
-
<td class="label"><label><?php echo Mage::helper('sales')->__('Customer Group') ?></label></td>
|
133 |
-
<td class="value"><strong><?php echo $_groupName ?></strong></td>
|
134 |
-
</tr>
|
135 |
-
<?php endif; ?>
|
136 |
-
<?php foreach ($this->getCustomerAccountData() as $data):?>
|
137 |
-
<tr>
|
138 |
-
<td class="label"><label><?php echo $data['label'] ?></label></td>
|
139 |
-
<td class="value"><strong><?php echo $data['value'] ?></strong></td>
|
140 |
-
</tr>
|
141 |
-
<?php endforeach;?>
|
142 |
-
</table>
|
143 |
-
</div>
|
144 |
-
</div>
|
145 |
-
</div>
|
146 |
-
|
147 |
-
<div class="entry-edit">
|
148 |
-
<div class="entry-edit-head">
|
149 |
-
<h4 class="icon-head head-account"><?php echo Mage::helper("troopid_connect")->__("Troop ID Verified Affiliation") ?></h4>
|
150 |
-
<div class="tools"></div>
|
151 |
-
</div>
|
152 |
-
<div class="fieldset">
|
153 |
-
<div class="hor-scroll">
|
154 |
-
<table cellspacing="0" class="form-list">
|
155 |
-
<tr>
|
156 |
-
<td class="label">
|
157 |
-
<label><?php echo Mage::helper("troopid_connect")->__("Affiliation") ?></label>
|
158 |
-
</td>
|
159 |
-
<td class="value">
|
160 |
-
<strong><?php echo $this->getOrder()->getTroopidAffiliation() ?></strong>
|
161 |
-
</td>
|
162 |
-
</tr>
|
163 |
-
<tr>
|
164 |
-
<td class="label">
|
165 |
-
<label><?php echo Mage::helper("troopid_connect")->__("UID") ?></label>
|
166 |
-
</td>
|
167 |
-
<td class="value">
|
168 |
-
<strong><?php echo $this->getOrder()->getTroopidUid() ?></strong>
|
169 |
-
</td>
|
170 |
-
</tr>
|
171 |
-
</table>
|
172 |
-
</div>
|
173 |
-
</div>
|
174 |
-
</div>
|
175 |
-
</div>
|
176 |
-
<div class="clear"></div>
|
177 |
-
|
178 |
-
<div class="box-left">
|
179 |
-
<!--Billing Address-->
|
180 |
-
<div class="entry-edit">
|
181 |
-
<div class="entry-edit-head">
|
182 |
-
<h4 class="icon-head head-billing-address"><?php echo Mage::helper('sales')->__('Billing Address') ?></h4>
|
183 |
-
<div class="tools"><?php echo $this->getAddressEditLink($_order->getBillingAddress())?></div>
|
184 |
-
</div>
|
185 |
-
<fieldset>
|
186 |
-
<address><?php echo $_order->getBillingAddress()->getFormated(true) ?></address>
|
187 |
-
</fieldset>
|
188 |
-
</div>
|
189 |
-
</div>
|
190 |
-
<?php if (!$this->getOrder()->getIsVirtual()): ?>
|
191 |
-
<div class="box-right">
|
192 |
-
<!--Shipping Address-->
|
193 |
-
<div class="entry-edit">
|
194 |
-
<div class="entry-edit-head">
|
195 |
-
<h4 class="icon-head head-shipping-address"><?php echo Mage::helper('sales')->__('Shipping Address') ?></h4>
|
196 |
-
<div class="tools"><?php echo $this->getAddressEditLink($_order->getShippingAddress())?></div>
|
197 |
-
</div>
|
198 |
-
<fieldset>
|
199 |
-
<address><?php echo $_order->getShippingAddress()->getFormated(true) ?></address>
|
200 |
-
</fieldset>
|
201 |
-
</div>
|
202 |
-
</div>
|
203 |
-
<div class="clear"></div>
|
204 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/{default → base}/default/layout/troopid_connect.xml
RENAMED
@@ -1,25 +1,17 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
-
<
|
4 |
<reference name="head">
|
5 |
-
<action method="addCss"
|
|
|
|
|
6 |
</reference>
|
7 |
<reference name="before_body_end">
|
8 |
<block type="troopid_connect/cart" name="troopid.connect.script" as="script" template="troopid/connect/script.phtml" />
|
9 |
</reference>
|
10 |
-
</default>
|
11 |
|
12 |
-
<checkout_cart_index>
|
13 |
<reference name="checkout.cart">
|
14 |
-
<
|
15 |
-
<alias>coupon</alias>
|
16 |
-
</action>
|
17 |
-
<block type="core/text_list" name="checkout.custom.coupon" as="coupon">
|
18 |
-
<action method="insert">
|
19 |
-
<block>checkout.cart.coupon</block>
|
20 |
-
</action>
|
21 |
-
<block type="troopid_connect/cart" name="checkout.cart.connect" as="connect" template="troopid/connect/cart.phtml" before="-"/>
|
22 |
-
</block>
|
23 |
</reference>
|
24 |
</checkout_cart_index>
|
25 |
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
+
<checkout_cart_index>
|
4 |
<reference name="head">
|
5 |
+
<action method="addCss">
|
6 |
+
<stylesheet>troopid/troopid.css</stylesheet>
|
7 |
+
</action>
|
8 |
</reference>
|
9 |
<reference name="before_body_end">
|
10 |
<block type="troopid_connect/cart" name="troopid.connect.script" as="script" template="troopid/connect/script.phtml" />
|
11 |
</reference>
|
|
|
12 |
|
|
|
13 |
<reference name="checkout.cart">
|
14 |
+
<block type="troopid_connect/cart" name="checkout.cart.extra" as="checkout.cart.extra" template="troopid/connect/cart.phtml" before="-"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
</reference>
|
16 |
</checkout_cart_index>
|
17 |
|
app/design/frontend/{default → base}/default/template/troopid/connect/callback.phtml
RENAMED
File without changes
|
app/design/frontend/base/default/template/troopid/connect/cart.phtml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ($this->isOperational()) : ?>
|
2 |
+
<div class="discount troopid-connect">
|
3 |
+
<h2><?php echo $this->__("Discounts with ID.me") ?></h2>
|
4 |
+
<?php if ($this->hasAffiliation()): ?>
|
5 |
+
<div class="affiliation">
|
6 |
+
<?php echo $this->__("You have verified yourself as") ?>
|
7 |
+
<strong><?php echo $this->getAffiliation() ?></strong>
|
8 |
+
</div>
|
9 |
+
<?php else: ?>
|
10 |
+
|
11 |
+
<?php if ($this->isEnabled("military")) : ?>
|
12 |
+
|
13 |
+
<div class="button">
|
14 |
+
<a href="javascript:void(0);" class="troopid-connect-trigger" data-scope="military" title="<?php echo $this->__("Verify your military affiliation with ID.me") ?>">
|
15 |
+
<img alt="<?php echo $this->__("Verify your military affiliation with ID.me") ?>" src="https://s3.amazonaws.com/idme/buttons/troop_gray2_rnd_32.png" />
|
16 |
+
</a>
|
17 |
+
</div>
|
18 |
+
|
19 |
+
<?php endif ?>
|
20 |
+
|
21 |
+
<?php if ($this->isEnabled("student")) : ?>
|
22 |
+
|
23 |
+
<div class="button">
|
24 |
+
<a href="javascript:void(0);" class="troopid-connect-trigger" data-scope="student" title="<?php echo $this->__("Verify your student affiliation with ID.me") ?>">
|
25 |
+
<img alt="<?php echo $this->__("Verify your student affiliation with ID.me") ?>" src="https://s3.amazonaws.com/idme/buttons/student_gray2_rnd_32.png" />
|
26 |
+
</a>
|
27 |
+
</div>
|
28 |
+
|
29 |
+
<?php endif ?>
|
30 |
+
|
31 |
+
<?php if ($this->isEnabled("responder")) : ?>
|
32 |
+
|
33 |
+
<div class="button">
|
34 |
+
<a href="javascript:void(0);" class="troopid-connect-trigger" data-scope="responder" title="<?php echo $this->__("Verify your first responder affiliation with ID.me") ?>">
|
35 |
+
<img alt="<?php echo $this->__("Verify your first responder affiliation with ID.me") ?>" src="https://s3.amazonaws.com/idme/buttons/responder_gray2_rnd_32.png" />
|
36 |
+
</a>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
<?php endif ?>
|
40 |
+
|
41 |
+
<?php endif ?>
|
42 |
+
<div class="about">
|
43 |
+
<a href="javascript:void(0);" id="troopid-modal-trigger"><?php echo $this->__("What is this?") ?></a>
|
44 |
+
</div>
|
45 |
+
|
46 |
+
<div id="troopid-modal" style="display: none;"></div>
|
47 |
+
<div id="troopid-modal-content" style="display: none;">
|
48 |
+
<h3><?php echo $this->__("What is ID.me?") ?></h3>
|
49 |
+
<a href="javascript:void(0);" class="close" id="troopid-modal-closer">[x]</a>
|
50 |
+
<?php echo $this->getAbout() ?>
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
<?php endif ?>
|
app/design/frontend/{default → base}/default/template/troopid/connect/script.phtml
RENAMED
@@ -5,12 +5,13 @@
|
|
5 |
TroopID.Connect = Class.create({
|
6 |
|
7 |
initialize: function(selector) {
|
8 |
-
this.selector
|
|
|
9 |
this.selector.observe("click", this.open.bind(this));
|
10 |
},
|
11 |
|
12 |
open: function(event) {
|
13 |
-
window.open("<?php echo $this->getEndpoint()
|
14 |
},
|
15 |
|
16 |
getTop: function() {
|
@@ -67,7 +68,9 @@
|
|
67 |
});
|
68 |
|
69 |
document.observe("dom:loaded", function() {
|
70 |
-
|
|
|
|
|
71 |
new TroopID.Modal("troopid-modal-trigger");
|
72 |
});
|
73 |
</script>
|
5 |
TroopID.Connect = Class.create({
|
6 |
|
7 |
initialize: function(selector) {
|
8 |
+
this.selector = selector;
|
9 |
+
this.scope = this.selector.readAttribute("data-scope");
|
10 |
this.selector.observe("click", this.open.bind(this));
|
11 |
},
|
12 |
|
13 |
open: function(event) {
|
14 |
+
window.open("<?php echo $this->getEndpoint() ?>?scope=" + this.scope, "", "scrollbars=yes,menubar=no,status=no,location=no,toolbar=no,width=750,height=620,top=" + this.getTop() + ",left=" + this.getLeft());
|
15 |
},
|
16 |
|
17 |
getTop: function() {
|
68 |
});
|
69 |
|
70 |
document.observe("dom:loaded", function() {
|
71 |
+
$$(".troopid-connect-trigger").each(function(item) {
|
72 |
+
new TroopID.Connect(item);
|
73 |
+
});
|
74 |
new TroopID.Modal("troopid-modal-trigger");
|
75 |
});
|
76 |
</script>
|
app/design/frontend/default/default/template/troopid/connect/cart.phtml
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<div class="discount troopid-connect">
|
2 |
-
<h2><?php echo $this->__("Military Discounts with Troop ID") ?></h2>
|
3 |
-
<?php if ($this->hasAffiliation()): ?>
|
4 |
-
<div class="affiliation">
|
5 |
-
<?php echo $this->__("You have verified yourself as") . " <strong>" . $this->getAffiliation() . "</strong>" ?>
|
6 |
-
</div>
|
7 |
-
<?php else: ?>
|
8 |
-
<div class="button">
|
9 |
-
<a href="javascript:void(0);" id="troopid-connect-trigger" title="<?php echo $this->__("Verify your military affiliation with Troop ID") ?>">
|
10 |
-
<img alt="<?php echo $this->__("Verify your military affiliation with Troop ID") ?>" src="https://s3.amazonaws.com/troopid/buttons/verify-button-red-235x40.png" />
|
11 |
-
</a>
|
12 |
-
</div>
|
13 |
-
<?php endif ?>
|
14 |
-
<div class="about">
|
15 |
-
<a href="javascript:void(0);" id="troopid-modal-trigger"><?php echo $this->__("What is this?") ?></a>
|
16 |
-
</div>
|
17 |
-
|
18 |
-
<div id="troopid-modal" style="display: none;"></div>
|
19 |
-
<div id="troopid-modal-content" style="display: none;">
|
20 |
-
<h3><?php echo $this->__("What is Troop ID?") ?></h3>
|
21 |
-
<a href="javascript:void(0);" class="close" id="troopid-modal-closer">[x]</a>
|
22 |
-
<?php echo $this->getAbout() ?>
|
23 |
-
</div>
|
24 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/TroopID_Connect.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<!--
|
3 |
/**
|
4 |
* @category troopid
|
5 |
-
* @package
|
6 |
*/
|
7 |
-->
|
8 |
<config>
|
2 |
<!--
|
3 |
/**
|
4 |
* @category troopid
|
5 |
+
* @package troopid
|
6 |
*/
|
7 |
-->
|
8 |
<config>
|
app/locale/en_US/TroopID_Connect.csv
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
Troop ID Attribute, Troop ID Attribute
|
2 |
-
Troop ID Verified Affiliation, Troop ID Verified Affiliation
|
3 |
-
Military Family, Military Family
|
4 |
-
Military Spouse, Military Spouse
|
5 |
-
Retiree, Retiree
|
6 |
-
Service Member, Service Member
|
7 |
-
Veteran, Veteran
|
8 |
-
Military Discounts with Troop ID, Military Discounts with Troop ID
|
9 |
-
Verify your military affiliation with Troop ID, Verify your military affiliation with Troop ID
|
10 |
-
Fill in <strong>Redirect URI</strong> with, Fill in <strong>Redirect URI</strong> with
|
11 |
-
Fill in <strong>Base URI</strong> with, Fill in <strong>Base URI</strong> with
|
12 |
-
|
13 |
-
Troop ID Settings, Troop ID Settings
|
14 |
-
Application Settings, Application Settings
|
15 |
-
Enabled?, Enabled?
|
16 |
-
Sandbox Mode?, Sandbox Mode?
|
17 |
-
Client ID, Client ID
|
18 |
-
Client Secret, Client Secret
|
19 |
-
Instructions, Instructions
|
20 |
-
Troop ID Military Affiliation Verification, Troop ID Military Affiliation Verification
|
21 |
-
Create discounts on special offers exclusively for verified military members via Troop ID, Create discounts on special offers exclusively for verified military members via Troop ID
|
22 |
-
Required steps to get started, Required steps to get started
|
23 |
-
Create a developer account at, Create a developer account at
|
24 |
-
Register an application at, Register an application at
|
25 |
-
Copy and paste your Client ID and Client Secret values from your application settings on Troop ID, Copy and paste your Client ID and Client Secret values from your application settings on Troop ID
|
26 |
-
This text will be displayed as "What is this?" in your shopping cart next to Troop ID Connect button, This text will be displayed as "What is this?" in your shopping cart next to Troop ID Connect button
|
27 |
-
Troop ID verification failed, please contact the store owner, Troop ID verification failed, please contact the store owner
|
28 |
-
Unfortunately your affiliation is not verified on Troop ID, Unfortunately your affiliation is not verified on Troop ID
|
29 |
-
You have verified yourself as, You have verified yourself as
|
30 |
-
What is this?, What is this?
|
31 |
-
What is Troop ID?, What is Troop ID?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TroopID_Connect</name>
|
4 |
-
<version>0.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -9,10 +9,10 @@
|
|
9 |
<summary>TroopID Connect integration.</summary>
|
10 |
<description>N/A</description>
|
11 |
<notes>N/A</notes>
|
12 |
-
<authors><author><name>
|
13 |
-
<date>2013-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="TroopID"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TroopID_Connect</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>TroopID Connect integration.</summary>
|
10 |
<description>N/A</description>
|
11 |
<notes>N/A</notes>
|
12 |
+
<authors><author><name>ID.me</name><user>idme</user><email>support@id.me</email></author></authors>
|
13 |
+
<date>2013-08-08</date>
|
14 |
+
<time>17:18:51</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="TroopID"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Affiliation.php" hash="d2f7b9f00585fc7d2b558096c31f5de1"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><file name="Custom.php" hash="0f7f75b4b55edb638d241852a0220b3f"/><file name="Instructions.php" hash="2e88a85a12693d4a26ec350bec190e06"/></dir></dir></dir><file name="Cart.php" hash="c521e18c2ffeaa45e8a90fe0de3875e5"/></dir><dir name="Helper"><file name="Data.php" hash="479b430508e6b12dd3904492808f33d8"/><file name="Oauth.php" hash="9089fd8f96397a3c0fa5231b5709b8dd"/></dir><dir name="Model"><dir name="Rule"><file name="Condition.php" hash="60e1a5b8cfbd1b9f66a2892a3fe16133"/><file name="Observer.php" hash="ff3a6cc43e4d46401a4bbb37262f4f56"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Enabled.php" hash="103e4776ee228d313fcb63c0eefcb0db"/></dir></dir></dir></dir><dir name="controllers"><file name="AuthorizeController.php" hash="bcd7c53ccd2637029d98c4e33ccf64f3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2bba51d29a0e9c444ff401a460a44142"/><file name="config.xml" hash="51917e16d2f556e7e020caf721a59f16"/><file name="system.xml" hash="db9f790e2234ae3bae57dbd32f004ad7"/></dir><dir name="sql"><dir name="troopid_connect_setup"><file name="mysql4-install-0.1.0.php" hash="2ed9e5f82407c756477d7fc2d3cd20ff"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="6160551e6951f91ab7ef18e887ea73a9"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="troopid_connect.xml" hash="b5c1ab02bb09e99d59465add1182e5e0"/></dir><dir name="template"><dir name="troopid"><dir name="connect"><file name="affiliation.phtml" hash="69c74c5b4d78f1f6822be88d1a3bd928"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="troopid_connect.xml" hash="2252d9dd57d061eeaca3577190fb67c2"/></dir><dir name="template"><dir name="troopid"><dir name="connect"><file name="callback.phtml" hash="71b10af7408d6f50999529c08aa75dfb"/><file name="cart.phtml" hash="37dc81699976160624f5a217e41d847c"/><file name="script.phtml" hash="09ce30b067bd81d04503a1b9a58e16e4"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TroopID_Connect.xml" hash="daae0990b13ba4071764efd4f9f674ec"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="troopid"><dir name="images"><file name="logo.png" hash="65421456771898d7cbced7b99d4b56ea"/></dir><file name="troopid.css" hash="9a264cce4e0e9897a33708031124c77b"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="troopid"><file name="troopid.css" hash="05c691747e19934f56d4f9f9f777d440"/></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="troopid"><file name="troopid.css" hash="4bba21e6846610c2acc9f50207292a1c"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
skin/adminhtml/default/default/troopid/images/logo.png
ADDED
Binary file
|
skin/adminhtml/default/default/troopid/troopid.css
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.troopid-config .troopid-connect {
|
2 |
+
background: #EFEFEF;
|
3 |
+
border: 1px solid #D8D8D8;
|
4 |
+
padding: 10px 10px 10px 25px;
|
5 |
+
}
|
6 |
+
.troopid-config .troopid-connect .intro {
|
7 |
+
display: block;
|
8 |
+
}
|
9 |
+
.troopid-config .troopid-connect.first {
|
10 |
+
margin: 5px 0 0 0;
|
11 |
+
}
|
12 |
+
.troopid-config .troopid-connect.last {
|
13 |
+
border-top: none;
|
14 |
+
margin: 0 0 10px 0;
|
15 |
+
padding-bottom: 15px;
|
16 |
+
}
|
17 |
+
.troopid-config .troopid-connect.first .heading {
|
18 |
+
padding: 0 0 0 150px;
|
19 |
+
height: 35px;
|
20 |
+
background: url("images/logo.png") no-repeat scroll 0 0 transparent;
|
21 |
+
}
|
22 |
+
.troopid-config .troopid-connect.first .heading {
|
23 |
+
padding-top: 16px;
|
24 |
+
}
|
25 |
+
.troopid-config .troopid-connect .comment {
|
26 |
+
display: block;
|
27 |
+
padding: 0;
|
28 |
+
}
|
29 |
+
.troopid-config .troopid-connect .steps {
|
30 |
+
margin: 0 0 0 15px;
|
31 |
+
list-style: square;
|
32 |
+
}
|
skin/adminhtml/default/default/troopid_connect/images/logo.png
DELETED
Binary file
|
skin/adminhtml/default/default/troopid_connect/troopid.css
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
.troopid .form-list {
|
2 |
-
width: 100%;
|
3 |
-
|
4 |
-
}
|
5 |
-
.troopid-connect.first {
|
6 |
-
margin: 5px 0 0 0;
|
7 |
-
}
|
8 |
-
.troopid-connect.last {
|
9 |
-
margin: 0 0 10px 0;
|
10 |
-
}
|
11 |
-
.troopid-connect fieldset.config {
|
12 |
-
display: none;
|
13 |
-
}
|
14 |
-
.troopid-connect .heading {
|
15 |
-
display: block;
|
16 |
-
float: none;
|
17 |
-
}
|
18 |
-
.troopid-connect.first .heading {
|
19 |
-
padding: 2px 0 0 150px;
|
20 |
-
background: url("images/logo.png") no-repeat scroll 0 0 transparent;
|
21 |
-
}
|
22 |
-
.troopid-connect .steps {
|
23 |
-
margin: 0 0 0 15px;
|
24 |
-
list-style: square;
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/frontend/{default/default/troopid_connect → base/default/troopid}/troopid.css
RENAMED
@@ -13,6 +13,10 @@
|
|
13 |
margin: 10px 0 0 0;
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
16 |
#troopid-modal {
|
17 |
position: fixed;
|
18 |
top: 0;
|
13 |
margin: 10px 0 0 0;
|
14 |
}
|
15 |
|
16 |
+
.troopid-connect .affiliation strong {
|
17 |
+
display: block;
|
18 |
+
}
|
19 |
+
|
20 |
#troopid-modal {
|
21 |
position: fixed;
|
22 |
top: 0;
|
skin/frontend/enterprise/default/troopid/troopid.css
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.troopid-connect h2 {
|
2 |
+
padding: 0 !important;
|
3 |
+
background: none !important;
|
4 |
+
}
|
5 |
+
.troopid-connect .button {
|
6 |
+
margin: 10px 0 0 0;
|
7 |
+
}
|
8 |
+
|
9 |
+
.troopid-connect .about {
|
10 |
+
margin: 10px 0 0 0;
|
11 |
+
}
|
12 |
+
|
13 |
+
.troopid-connect .affiliation strong {
|
14 |
+
display: block;
|
15 |
+
}
|
16 |
+
|
17 |
+
#troopid-modal {
|
18 |
+
position: fixed;
|
19 |
+
top: 0;
|
20 |
+
left: 0;
|
21 |
+
width: 100%;
|
22 |
+
height: 100%;
|
23 |
+
background: #000000;
|
24 |
+
opacity: 0.75;
|
25 |
+
z-index: 100;
|
26 |
+
}
|
27 |
+
|
28 |
+
#troopid-modal-content {
|
29 |
+
position: fixed;
|
30 |
+
left: 25%;
|
31 |
+
top: 25%;
|
32 |
+
background: #ffffff;
|
33 |
+
opacity: 1;
|
34 |
+
z-index: 200;
|
35 |
+
text-align: left;
|
36 |
+
padding: 20px;
|
37 |
+
max-width: 900px;
|
38 |
+
}
|
39 |
+
|
40 |
+
#troopid-modal-content h3 {
|
41 |
+
font-weight: bold;
|
42 |
+
display: inline-block;
|
43 |
+
}
|
44 |
+
|
45 |
+
#troopid-modal-content .close {
|
46 |
+
float: right;
|
47 |
+
font-weight: bold;
|
48 |
+
margin: -5px 0 0 0;
|
49 |
+
text-decoration: none;
|
50 |
+
}
|