Version Notes
This version has been commercially tested and is available to the public.
Download this release
Release Info
Developer | Jeffrey Epstein |
Extension | Ambassador |
Version | 1.1.1 |
Comparing to | |
See all releases |
Version 1.1.1
- app/code/community/Ambassador/Affiliate/Model/Observer.php +38 -0
- app/code/community/Ambassador/Affiliate/controllers/AffiliateController.php +75 -0
- app/code/community/Ambassador/Affiliate/etc/config.xml +37 -0
- app/code/community/Ambassador/Event/Model/Observer.php +267 -0
- app/code/community/Ambassador/Event/controllers/CallbackController.php +359 -0
- app/code/community/Ambassador/Event/etc/config.xml +80 -0
- app/code/community/Ambassador/Payout/controllers/PayoutController.php +93 -0
- app/code/community/Ambassador/Payout/etc/config.xml +19 -0
- app/design/frontend/default/default/template/ambassador/checkout/ecommerce.phtml +51 -0
- app/design/frontend/default/default/template/ambassador/checkout/img.phtml +34 -0
- app/design/frontend/default/default/template/ambassador/sso/affiliate_program.phtml +4 -0
- app/design/frontend/default/default/template/ambassador/sso/sso.phtml +1 -0
- app/design/frontend/default/default/template/ambassador/sso/sso_logout.phtml +1 -0
- app/design/frontend/enterprise/default/template/ambassador/checkout/ecommerce.phtml +51 -0
- app/design/frontend/enterprise/default/template/ambassador/checkout/img.phtml +34 -0
- app/design/frontend/enterprise/default/template/ambassador/sso/affiliate_program.phtml +4 -0
- app/design/frontend/enterprise/default/template/ambassador/sso/sso.phtml +1 -0
- app/design/frontend/enterprise/default/template/ambassador/sso/sso_logout.phtml +1 -0
- app/etc/modules/Ambassador_Affiliate.xml +9 -0
- app/etc/modules/Ambassador_Event.xml +9 -0
- app/etc/modules/Ambassador_Payout.xml +9 -0
- package.xml +24 -0
app/code/community/Ambassador/Affiliate/Model/Observer.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Affiliate Observer
|
5 |
+
*
|
6 |
+
* @category Ambassador
|
7 |
+
* @package Ambassador_Event
|
8 |
+
* @author getAmbassador.com
|
9 |
+
*/
|
10 |
+
class Ambassador_Affiliate_Model_Observer extends Varien_Event_Observer
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Embeds iframe in content
|
14 |
+
*
|
15 |
+
* @param Varien_Event_Observer $observer
|
16 |
+
* @return Ambassador_Event
|
17 |
+
*/
|
18 |
+
public function embedIframe($observer)
|
19 |
+
{
|
20 |
+
if (Mage::app()->getRequest()->getParam('getambassador_affiliate_program')) {
|
21 |
+
|
22 |
+
$block = Mage::app()->getLayout()->createBlock(
|
23 |
+
'Mage_Core_Block_Template',
|
24 |
+
'ambassador_affiliate_program',
|
25 |
+
array('template' => "ambassador/sso/affiliate_program.phtml")
|
26 |
+
);
|
27 |
+
|
28 |
+
$block->assign('portal_url', Mage::getModel('core/variable')->loadByCode('getambassador_portal_url')->getValue('plain'));
|
29 |
+
|
30 |
+
Mage::app()->getLayout()->getBlock('customer_account_navigation')->setActive('customer/affiliate');
|
31 |
+
|
32 |
+
Mage::app()->getLayout()->getBlock('content')->unsetChildren();
|
33 |
+
Mage::app()->getLayout()->getBlock('content')->insert($block);
|
34 |
+
}
|
35 |
+
|
36 |
+
return $this;
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Ambassador/Affiliate/controllers/AffiliateController.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ambassador_Affiliate_AffiliateController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function indexAction ()
|
6 |
+
{
|
7 |
+
if (Mage::app()->getRequest()->getParam('sso')) {
|
8 |
+
|
9 |
+
$this->_forward('index', 'account', 'customer', array('getambassador_affiliate_program' => true));
|
10 |
+
|
11 |
+
} else {
|
12 |
+
|
13 |
+
$portal_link_mode = Mage::getModel('core/variable')->loadByCode('getambassador_portal_link_mode')->getValue('plain');
|
14 |
+
$portal_url = Mage::getModel('core/variable')->loadByCode('getambassador_portal_url')->getValue('plain');
|
15 |
+
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
16 |
+
|
17 |
+
if ($mode === 'dev') {
|
18 |
+
$ambassador_url = 'http://getambassador.dev/';
|
19 |
+
} else {
|
20 |
+
$ambassador_url = 'https://getambassador.com/';
|
21 |
+
}
|
22 |
+
|
23 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
24 |
+
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
25 |
+
$response_type = 'json';
|
26 |
+
$mbsy_token = '';
|
27 |
+
$mbsy_email = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
|
28 |
+
$first_name = urlencode(Mage::getSingleton('customer/session')->getCustomer()->getFirstname());
|
29 |
+
$last_name = urlencode(Mage::getSingleton('customer/session')->getCustomer()->getLastname());
|
30 |
+
$mbsy_signature = sha1($api_key.$mbsy_email);
|
31 |
+
$mbsy_email = urlencode($mbsy_email);
|
32 |
+
|
33 |
+
// Build and make company/token API call
|
34 |
+
$url = $ambassador_url.'api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/token';
|
35 |
+
$curl_handle = curl_init();
|
36 |
+
curl_setopt($curl_handle, CURLOPT_URL, $url);
|
37 |
+
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
|
38 |
+
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
|
39 |
+
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);
|
40 |
+
curl_setopt($curl_handle, CURLOPT_POST, FALSE);
|
41 |
+
curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);
|
42 |
+
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
|
43 |
+
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);
|
44 |
+
$response = curl_exec($curl_handle);
|
45 |
+
curl_close($curl_handle);
|
46 |
+
|
47 |
+
$response = json_decode($response, TRUE);
|
48 |
+
|
49 |
+
// Grab token from response
|
50 |
+
$mbsy_token = $response['response']['data']['token'];
|
51 |
+
|
52 |
+
if ($portal_link_mode === 'iframe' && !$this->detect_ie()) {
|
53 |
+
$current_url = Mage::helper('core/url')->getCurrentUrl();
|
54 |
+
$return_url = urlencode(str_replace('/sso', '', $current_url).'?sso=1');
|
55 |
+
|
56 |
+
} else {
|
57 |
+
$return_url = urlencode($portal_url);
|
58 |
+
}
|
59 |
+
|
60 |
+
$url = $portal_url."/sso/login?token=$mbsy_token&email=$mbsy_email&first_name=$first_name&last_name=$last_name&signature=$mbsy_signature&return_url=$return_url";
|
61 |
+
|
62 |
+
$this->_redirectUrl($url);
|
63 |
+
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
private function detect_ie ()
|
68 |
+
{
|
69 |
+
if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
70 |
+
return true;
|
71 |
+
} else {
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
app/code/community/Ambassador/Affiliate/etc/config.xml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ambassador_Affiliate>
|
5 |
+
<version>1.1.1</version>
|
6 |
+
</Ambassador_Affiliate>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<customer>
|
11 |
+
<args>
|
12 |
+
<modules>
|
13 |
+
<Ambassador_Affiliate before="Mage_Customer">Ambassador_Affiliate</Ambassador_Affiliate>
|
14 |
+
</modules>
|
15 |
+
</args>
|
16 |
+
</customer>
|
17 |
+
</routers>
|
18 |
+
<events>
|
19 |
+
<controller_action_layout_render_before_customer_account_index>
|
20 |
+
<observers>
|
21 |
+
<Ambassador_Affiliate_Model_Observer>
|
22 |
+
<type>singleton</type>
|
23 |
+
<class>Ambassador_Affiliate_Model_Observer</class>
|
24 |
+
<method>embedIframe</method>
|
25 |
+
</Ambassador_Affiliate_Model_Observer>
|
26 |
+
</observers>
|
27 |
+
</controller_action_layout_render_before_customer_account_index>
|
28 |
+
</events>
|
29 |
+
</frontend>
|
30 |
+
<global>
|
31 |
+
<models>
|
32 |
+
<ambassador_affiliate>
|
33 |
+
<class>Ambassador_Affiliate_Model_Observer</class>
|
34 |
+
</ambassador_affiliate>
|
35 |
+
</models>
|
36 |
+
</global>
|
37 |
+
</config>
|
app/code/community/Ambassador/Event/Model/Observer.php
ADDED
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Event Observer
|
5 |
+
*
|
6 |
+
* @category Ambassador
|
7 |
+
* @package Ambassador_Event
|
8 |
+
* @author getAmbassador.com
|
9 |
+
*/
|
10 |
+
class Ambassador_Event_Model_Observer extends Varien_Event_Observer
|
11 |
+
{
|
12 |
+
public function __construct() {
|
13 |
+
|
14 |
+
parent::__construct();
|
15 |
+
|
16 |
+
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
17 |
+
|
18 |
+
if ($mode === 'dev') {
|
19 |
+
$this->ambassador_url = 'http://getambassador.dev/';
|
20 |
+
} else {
|
21 |
+
$this->ambassador_url = 'https://getambassador.com/';
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Calls event/record API method
|
27 |
+
*
|
28 |
+
* @param Varien_Event_Observer $observer
|
29 |
+
* @return Ambassador_Event
|
30 |
+
*/
|
31 |
+
public function callEventRecord($observer)
|
32 |
+
{
|
33 |
+
$snippet_type = Mage::getModel('core/variable')->loadByCode('getambassador_snippet_type')->getValue('plain');
|
34 |
+
$campaign_uid = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
35 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
36 |
+
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
37 |
+
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
38 |
+
|
39 |
+
if (empty($username) || empty($api_key) || empty($campaign_uid) || $campaign_uid == 'disabled') {
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
$campaigns = explode(',', $campaign_uid);
|
44 |
+
|
45 |
+
$order = $observer->getEvent()->getInvoice()->getOrder();
|
46 |
+
|
47 |
+
$revenue = $order->getSubtotal();
|
48 |
+
$email = $order->getCustomerEmail();
|
49 |
+
$first_name = $order->getCustomerFirstname();
|
50 |
+
$last_name = $order->getCustomerLastname();
|
51 |
+
$uid = $order->getCustomerId();
|
52 |
+
$transaction_uid = $order->getRealOrderId();
|
53 |
+
$ip_address = $order->getRemoteIp();
|
54 |
+
|
55 |
+
$api_url = $this->ambassador_url."api/v2/$username/$api_key/json/event/record";
|
56 |
+
|
57 |
+
foreach ($campaigns as $i => $campaign) {
|
58 |
+
|
59 |
+
if ($i > 0) {
|
60 |
+
$transaction_uid = '';
|
61 |
+
}
|
62 |
+
|
63 |
+
// Data for API call
|
64 |
+
$data = array(
|
65 |
+
'campaign_uid' => $campaign,
|
66 |
+
'email' => $email,
|
67 |
+
'revenue' => $revenue,
|
68 |
+
'transaction_uid' => $transaction_uid,
|
69 |
+
'first_name' => $first_name,
|
70 |
+
'last_name' => $last_name
|
71 |
+
);
|
72 |
+
|
73 |
+
if ($mode != 'dev') {
|
74 |
+
$data['ip_address'] = $ip_address;
|
75 |
+
}
|
76 |
+
|
77 |
+
$data = http_build_query($data);
|
78 |
+
|
79 |
+
// Call to API via CURL
|
80 |
+
$curl_handle = curl_init();
|
81 |
+
curl_setopt($curl_handle, CURLOPT_URL, $api_url);
|
82 |
+
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
|
83 |
+
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
|
84 |
+
curl_setopt($curl_handle, CURLOPT_POST, 1);
|
85 |
+
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
|
86 |
+
$buffer = curl_exec($curl_handle);
|
87 |
+
curl_close($curl_handle);
|
88 |
+
// Output
|
89 |
+
$returnData = json_decode($buffer, true);
|
90 |
+
}
|
91 |
+
|
92 |
+
return $this;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Adds initial code snippet to record initial event
|
97 |
+
*
|
98 |
+
* @param Varien_Event_Observer $observer
|
99 |
+
* @return Ambassador_Event
|
100 |
+
*/
|
101 |
+
public function addInitialCodeSnippet($observer)
|
102 |
+
{
|
103 |
+
$snippet_type = Mage::getModel('core/variable')->loadByCode('getambassador_snippet_type')->getValue('plain');
|
104 |
+
$campaign_uid = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
105 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
106 |
+
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
107 |
+
|
108 |
+
if (empty($username) || empty($api_key) || empty($campaign_uid) || $campaign_uid == 'disabled') {
|
109 |
+
return $this;
|
110 |
+
}
|
111 |
+
|
112 |
+
switch ($snippet_type) {
|
113 |
+
|
114 |
+
case 'img':
|
115 |
+
$template = 'img';
|
116 |
+
break;
|
117 |
+
default:
|
118 |
+
$template = 'ecommerce';
|
119 |
+
}
|
120 |
+
|
121 |
+
$block = Mage::app()->getLayout()->createBlock(
|
122 |
+
'Mage_Core_Block_Template',
|
123 |
+
'ambassador_img',
|
124 |
+
array('template' => "ambassador/checkout/$template.phtml")
|
125 |
+
);
|
126 |
+
|
127 |
+
Mage::app()->getLayout()->getBlock('content')->append($block);
|
128 |
+
|
129 |
+
return $this;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* SSO
|
134 |
+
*
|
135 |
+
* @param Varien_Event_Observer $observer
|
136 |
+
* @return Ambassador_Event
|
137 |
+
*/
|
138 |
+
public function sso($observer)
|
139 |
+
{
|
140 |
+
if (!Mage::app()->getRequest()->getParam('getambassador_affiliate_program')) {
|
141 |
+
|
142 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
143 |
+
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
144 |
+
$response_type = 'json';
|
145 |
+
$mbsy_token = '';
|
146 |
+
$mbsy_email = Mage::getSingleton('customer/session')->getCustomer()->getEmail(); // Set this to the value of your user's email
|
147 |
+
$mbsy_signature = sha1($api_key.$mbsy_email);
|
148 |
+
|
149 |
+
// Build and make company/token API call
|
150 |
+
$url = $this->ambassador_url.'api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/token';
|
151 |
+
$curl_handle = curl_init();
|
152 |
+
curl_setopt($curl_handle, CURLOPT_URL, $url);
|
153 |
+
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
|
154 |
+
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
|
155 |
+
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);
|
156 |
+
curl_setopt($curl_handle, CURLOPT_POST, FALSE);
|
157 |
+
curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);
|
158 |
+
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
|
159 |
+
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);
|
160 |
+
$response = curl_exec($curl_handle);
|
161 |
+
curl_close($curl_handle);
|
162 |
+
|
163 |
+
// Decode json response to array, you'll need to change this if using XML
|
164 |
+
$response = json_decode($response, TRUE);
|
165 |
+
|
166 |
+
// Grab token from response
|
167 |
+
$mbsy_token = $response['response']['data']['token'];
|
168 |
+
|
169 |
+
$block = Mage::app()->getLayout()->createBlock(
|
170 |
+
'Mage_Core_Block_Template',
|
171 |
+
'ambassador_sso',
|
172 |
+
array('template' => "ambassador/sso/sso.phtml")
|
173 |
+
);
|
174 |
+
|
175 |
+
$block->assign('mbsy_token', $mbsy_token);
|
176 |
+
$block->assign('mbsy_first_name', Mage::getSingleton('customer/session')->getCustomer()->getFirstname());
|
177 |
+
$block->assign('mbsy_last_name', Mage::getSingleton('customer/session')->getCustomer()->getLastname());
|
178 |
+
$block->assign('mbsy_email', $mbsy_email);
|
179 |
+
$block->assign('mbsy_signature', $mbsy_signature);
|
180 |
+
$block->assign('portal_url', Mage::getModel('core/variable')->loadByCode('getambassador_portal_url')->getValue('plain'));
|
181 |
+
|
182 |
+
Mage::app()->getLayout()->getBlock('content')->append($block);
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
return $this;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* SSO logout
|
191 |
+
*
|
192 |
+
* @param Varien_Event_Observer $observer
|
193 |
+
* @return Ambassador_Event
|
194 |
+
*/
|
195 |
+
public function ssoLogout($observer)
|
196 |
+
{
|
197 |
+
|
198 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
199 |
+
$api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
200 |
+
$response_type = 'json';
|
201 |
+
$mbsy_token = '';
|
202 |
+
$mbsy_email = 'magento@example.com';
|
203 |
+
$mbsy_signature = sha1($api_key.$mbsy_email);
|
204 |
+
|
205 |
+
// Build and make company/token API call
|
206 |
+
$url = $this->ambassador_url.'api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/token';
|
207 |
+
$curl_handle = curl_init();
|
208 |
+
curl_setopt($curl_handle, CURLOPT_URL, $url);
|
209 |
+
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
|
210 |
+
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
|
211 |
+
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);
|
212 |
+
curl_setopt($curl_handle, CURLOPT_POST, FALSE);
|
213 |
+
curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);
|
214 |
+
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
|
215 |
+
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);
|
216 |
+
$response = curl_exec($curl_handle);
|
217 |
+
curl_close($curl_handle);
|
218 |
+
|
219 |
+
// Decode json response to array, you'll need to change this if using XML
|
220 |
+
$response = json_decode($response, TRUE);
|
221 |
+
|
222 |
+
// Grab token from response
|
223 |
+
$mbsy_token = $response['response']['data']['token'];
|
224 |
+
|
225 |
+
$block = Mage::app()->getLayout()->createBlock(
|
226 |
+
'Mage_Core_Block_Template',
|
227 |
+
'ambassador_sso_logout',
|
228 |
+
array('template' => "ambassador/sso/sso_logout.phtml")
|
229 |
+
);
|
230 |
+
|
231 |
+
$block->assign('mbsy_token', $mbsy_token);
|
232 |
+
$block->assign('mbsy_email', $mbsy_email);
|
233 |
+
$block->assign('mbsy_signature', $mbsy_signature);
|
234 |
+
$block->assign('portal_url', Mage::getModel('core/variable')->loadByCode('getambassador_portal_url')->getValue('plain'));
|
235 |
+
|
236 |
+
Mage::app()->getLayout()->getBlock('content')->append($block);
|
237 |
+
|
238 |
+
Mage::unregister('ambassador_logout_customer_email');
|
239 |
+
|
240 |
+
return $this;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Adds link to portal
|
245 |
+
*
|
246 |
+
* @param Varien_Event_Observer $observer
|
247 |
+
* @return Ambassador_Event
|
248 |
+
*/
|
249 |
+
public function addLinkToPortal($observer)
|
250 |
+
{
|
251 |
+
$addLink = Mage::getModel('core/variable')->loadByCode('getambassador_add_affiliate_program_link')->getValue('plain');
|
252 |
+
|
253 |
+
if ($addLink === '1') {
|
254 |
+
|
255 |
+
$navigation_block = Mage::app()->getLayout()->getBlock('customer_account_navigation');
|
256 |
+
|
257 |
+
if ($navigation_block) {
|
258 |
+
$label = Mage::getModel('core/variable')->loadByCode('getambassador_portal_link_label')->getValue('plain');
|
259 |
+
Mage::app()->getLayout()->getBlock('customer_account_navigation')->addLink('affiliate_program', 'customer/affiliate', $label);
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
return $this;
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
?>
|
app/code/community/Ambassador/Event/controllers/CallbackController.php
ADDED
@@ -0,0 +1,359 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ambassador_Event_CallbackController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function installAction ()
|
7 |
+
{
|
8 |
+
$api_key = $_POST['api_key'];
|
9 |
+
$username = $_POST['username'];
|
10 |
+
$portal_url = $_POST['portal_url'];
|
11 |
+
$token = $_POST['token'];
|
12 |
+
$mode = $_POST['mode'];
|
13 |
+
|
14 |
+
if ($mode === 'dev') {
|
15 |
+
$ambassador_url = 'http://getambassador.dev/';
|
16 |
+
} else {
|
17 |
+
$ambassador_url = 'https://getambassador.com/';
|
18 |
+
}
|
19 |
+
|
20 |
+
// check if api key & username are correct
|
21 |
+
|
22 |
+
$data = array(
|
23 |
+
'api_key' => $api_key,
|
24 |
+
'token' => $token
|
25 |
+
);
|
26 |
+
|
27 |
+
// verify if token is valid
|
28 |
+
$result = $this->curl_request($ambassador_url.'callback/magento_verify_token', $data);
|
29 |
+
|
30 |
+
if ($result === true) {
|
31 |
+
|
32 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_api_key');
|
33 |
+
|
34 |
+
if (is_null($variable->getValue('plain'))) {
|
35 |
+
|
36 |
+
// save api key to DB
|
37 |
+
$variable = Mage::getModel('core/variable');
|
38 |
+
|
39 |
+
$variable_data = array(
|
40 |
+
'code' => 'getambassador_api_key',
|
41 |
+
'name' => 'getAmbassador Api Key',
|
42 |
+
'plain_value' => $api_key,
|
43 |
+
'html_value' => ''
|
44 |
+
);
|
45 |
+
|
46 |
+
$variable->setData($variable_data);
|
47 |
+
|
48 |
+
} else {
|
49 |
+
|
50 |
+
$variable->setData('plain_value', $api_key);
|
51 |
+
}
|
52 |
+
|
53 |
+
try {
|
54 |
+
$variable->save();
|
55 |
+
|
56 |
+
} catch (Exception $e) {
|
57 |
+
|
58 |
+
echo json_encode($e->getMessage());
|
59 |
+
}
|
60 |
+
|
61 |
+
// save username to DB
|
62 |
+
$variable->cleanModelCache();
|
63 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_username');
|
64 |
+
$variableData = $variable->getData();
|
65 |
+
|
66 |
+
if (empty($variableData)) {
|
67 |
+
|
68 |
+
$variable->cleanModelCache();
|
69 |
+
$variable = Mage::getModel('core/variable');
|
70 |
+
|
71 |
+
$variable_data = array(
|
72 |
+
'code' => 'getambassador_username',
|
73 |
+
'name' => 'getAmbassador Username',
|
74 |
+
'plain_value' => $username,
|
75 |
+
'html_value' => ''
|
76 |
+
);
|
77 |
+
|
78 |
+
$variable->setData($variable_data);
|
79 |
+
|
80 |
+
} else {
|
81 |
+
|
82 |
+
$variable->setData('plain_value', $username);
|
83 |
+
}
|
84 |
+
|
85 |
+
try {
|
86 |
+
$variable->save();
|
87 |
+
|
88 |
+
} catch (Exception $e) {
|
89 |
+
|
90 |
+
echo json_encode($e->getMessage());
|
91 |
+
}
|
92 |
+
|
93 |
+
// save portal URL to DB
|
94 |
+
$variable->cleanModelCache();
|
95 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_portal_url');
|
96 |
+
$variableData = $variable->getData();
|
97 |
+
|
98 |
+
if (empty($variableData)) {
|
99 |
+
|
100 |
+
$variable->cleanModelCache();
|
101 |
+
$variable = Mage::getModel('core/variable');
|
102 |
+
|
103 |
+
$variable_data = array(
|
104 |
+
'code' => 'getambassador_portal_url',
|
105 |
+
'name' => 'getAmbassador Portal URL',
|
106 |
+
'plain_value' => $portal_url,
|
107 |
+
'html_value' => ''
|
108 |
+
);
|
109 |
+
|
110 |
+
$variable->setData($variable_data);
|
111 |
+
|
112 |
+
} else {
|
113 |
+
|
114 |
+
$variable->setData('plain_value', $portal_url);
|
115 |
+
}
|
116 |
+
|
117 |
+
try {
|
118 |
+
$variable->save();
|
119 |
+
|
120 |
+
} catch (Exception $e) {
|
121 |
+
|
122 |
+
echo json_encode($e->getMessage());
|
123 |
+
}
|
124 |
+
|
125 |
+
// save portal link label to DB
|
126 |
+
$variable->cleanModelCache();
|
127 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_portal_link_label');
|
128 |
+
$variableData = $variable->getData();
|
129 |
+
|
130 |
+
if (empty($variableData)) {
|
131 |
+
|
132 |
+
$variable->cleanModelCache();
|
133 |
+
$variable = Mage::getModel('core/variable');
|
134 |
+
|
135 |
+
$variable_data = array(
|
136 |
+
'code' => 'getambassador_portal_link_label',
|
137 |
+
'name' => 'getAmbassador Portal Link Label',
|
138 |
+
'plain_value' => 'Affiliate Program',
|
139 |
+
'html_value' => ''
|
140 |
+
);
|
141 |
+
|
142 |
+
$variable->setData($variable_data);
|
143 |
+
}
|
144 |
+
|
145 |
+
try {
|
146 |
+
$variable->save();
|
147 |
+
|
148 |
+
} catch (Exception $e) {
|
149 |
+
|
150 |
+
echo json_encode($e->getMessage());
|
151 |
+
}
|
152 |
+
|
153 |
+
// save add_affiliate_program_link
|
154 |
+
$variable->cleanModelCache();
|
155 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_add_affiliate_program_link');
|
156 |
+
$variableData = $variable->getData();
|
157 |
+
|
158 |
+
if (empty($variableData)) {
|
159 |
+
|
160 |
+
$variable->cleanModelCache();
|
161 |
+
$variable = Mage::getModel('core/variable');
|
162 |
+
|
163 |
+
$variable_data = array(
|
164 |
+
'code' => 'getambassador_add_affiliate_program_link',
|
165 |
+
'name' => 'getAmbassador Add Affiliate Program Link',
|
166 |
+
'plain_value' => '1',
|
167 |
+
'html_value' => ''
|
168 |
+
);
|
169 |
+
|
170 |
+
$variable->setData($variable_data);
|
171 |
+
}
|
172 |
+
|
173 |
+
try {
|
174 |
+
$variable->save();
|
175 |
+
|
176 |
+
} catch (Exception $e) {
|
177 |
+
|
178 |
+
echo json_encode($e->getMessage());
|
179 |
+
}
|
180 |
+
|
181 |
+
// save mode
|
182 |
+
$variable->cleanModelCache();
|
183 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_mode');
|
184 |
+
$variableData = $variable->getData();
|
185 |
+
|
186 |
+
if (empty($variableData)) {
|
187 |
+
|
188 |
+
$variable->cleanModelCache();
|
189 |
+
$variable = Mage::getModel('core/variable');
|
190 |
+
|
191 |
+
$variable_data = array(
|
192 |
+
'code' => 'getambassador_mode',
|
193 |
+
'name' => 'getAmbassador Mode',
|
194 |
+
'plain_value' => $mode,
|
195 |
+
'html_value' => ''
|
196 |
+
);
|
197 |
+
|
198 |
+
$variable->setData($variable_data);
|
199 |
+
}
|
200 |
+
|
201 |
+
try {
|
202 |
+
$variable->save();
|
203 |
+
|
204 |
+
} catch (Exception $e) {
|
205 |
+
|
206 |
+
echo json_encode($e->getMessage());
|
207 |
+
}
|
208 |
+
|
209 |
+
// save portal link mode
|
210 |
+
$variable->cleanModelCache();
|
211 |
+
$variable = Mage::getModel('core/variable')->loadByCode('getambassador_portal_link_mode');
|
212 |
+
$variableData = $variable->getData();
|
213 |
+
|
214 |
+
if (empty($variableData)) {
|
215 |
+
|
216 |
+
$variable->cleanModelCache();
|
217 |
+
$variable = Mage::getModel('core/variable');
|
218 |
+
|
219 |
+
$variable_data = array(
|
220 |
+
'code' => 'getambassador_portal_link_mode',
|
221 |
+
'name' => 'getambassador Portal Link Mode',
|
222 |
+
'plain_value' => 'iframe',
|
223 |
+
'html_value' => ''
|
224 |
+
);
|
225 |
+
|
226 |
+
$variable->setData($variable_data);
|
227 |
+
}
|
228 |
+
|
229 |
+
try {
|
230 |
+
$variable->save();
|
231 |
+
|
232 |
+
} catch (Exception $e) {
|
233 |
+
|
234 |
+
echo json_encode($e->getMessage());
|
235 |
+
}
|
236 |
+
|
237 |
+
echo json_encode(true);
|
238 |
+
|
239 |
+
} else {
|
240 |
+
|
241 |
+
echo json_encode(false);
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
public function integrateAction ()
|
246 |
+
{
|
247 |
+
$api_key = $_POST['api_key'];
|
248 |
+
$token = $_POST['token'];
|
249 |
+
$campaign_id = $_POST['campaign_id'];
|
250 |
+
$snippet_type = $_POST['snippet_type'];
|
251 |
+
|
252 |
+
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
253 |
+
|
254 |
+
if ($mode === 'dev') {
|
255 |
+
$ambassador_url = 'http://getambassador.dev/';
|
256 |
+
} else {
|
257 |
+
$ambassador_url = 'https://getambassador.com/';
|
258 |
+
}
|
259 |
+
|
260 |
+
$data = array(
|
261 |
+
'api_key' => $api_key,
|
262 |
+
'token' => $token
|
263 |
+
);
|
264 |
+
|
265 |
+
// verify if token is valid
|
266 |
+
$result = $this->curl_request($ambassador_url.'callback/magento_verify_token', $data);
|
267 |
+
|
268 |
+
if ($result === true) {
|
269 |
+
|
270 |
+
// save campaign ID to DB
|
271 |
+
$current_campaign_id = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign');
|
272 |
+
$variableData = $current_campaign_id->getData();
|
273 |
+
|
274 |
+
if (empty($variableData)) {
|
275 |
+
|
276 |
+
$current_campaign_id->cleanModelCache();
|
277 |
+
$current_campaign_id = Mage::getModel('core/variable');
|
278 |
+
|
279 |
+
$variable_data = array(
|
280 |
+
'code' => 'getambassador_active_campaign',
|
281 |
+
'name' => 'getAmbassador Active Campaign',
|
282 |
+
'plain_value' => $campaign_id,
|
283 |
+
'html_value' => ''
|
284 |
+
);
|
285 |
+
|
286 |
+
$current_campaign_id->setData($variable_data);
|
287 |
+
|
288 |
+
} else {
|
289 |
+
|
290 |
+
$current_campaign_id->setData('plain_value', $campaign_id);
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
+
try {
|
295 |
+
$current_campaign_id->save();
|
296 |
+
|
297 |
+
} catch (Exception $e) {
|
298 |
+
|
299 |
+
echo json_encode($e->getMessage());
|
300 |
+
}
|
301 |
+
|
302 |
+
// save snippet type to DB
|
303 |
+
$current_campaign_id->cleanModelCache();
|
304 |
+
$current_snippet_type = Mage::getModel('core/variable')->loadByCode('getambassador_snippet_type');
|
305 |
+
$variableData = $current_snippet_type->getData();
|
306 |
+
|
307 |
+
if (empty($variableData)) {
|
308 |
+
|
309 |
+
$current_snippet_type->cleanModelCache();
|
310 |
+
$current_snippet_type = Mage::getModel('core/variable');
|
311 |
+
$variable_data = array(
|
312 |
+
'code' => 'getambassador_snippet_type',
|
313 |
+
'name' => 'getAmbassador Snippet Type',
|
314 |
+
'plain_value' => $snippet_type,
|
315 |
+
'html_value' => ''
|
316 |
+
);
|
317 |
+
|
318 |
+
$current_snippet_type->setData($variable_data);
|
319 |
+
|
320 |
+
} else {
|
321 |
+
|
322 |
+
$current_snippet_type->setData('plain_value', $snippet_type);
|
323 |
+
}
|
324 |
+
|
325 |
+
try {
|
326 |
+
$current_snippet_type->save();
|
327 |
+
|
328 |
+
} catch (Exception $e) {
|
329 |
+
|
330 |
+
echo json_encode($e->getMessage());
|
331 |
+
}
|
332 |
+
|
333 |
+
echo json_encode(true);
|
334 |
+
|
335 |
+
} else {
|
336 |
+
|
337 |
+
echo json_encode(false);
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
private function curl_request($url, $data)
|
342 |
+
{
|
343 |
+
$data = http_build_query($data);
|
344 |
+
|
345 |
+
$curl_handle = curl_init();
|
346 |
+
curl_setopt($curl_handle, CURLOPT_URL, $url);
|
347 |
+
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 20);
|
348 |
+
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
|
349 |
+
curl_setopt($curl_handle, CURLOPT_POST, 1);
|
350 |
+
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
|
351 |
+
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
|
352 |
+
$result = curl_exec($curl_handle);
|
353 |
+
curl_close($curl_handle);
|
354 |
+
|
355 |
+
return json_decode($result);
|
356 |
+
}
|
357 |
+
}
|
358 |
+
|
359 |
+
?>
|
app/code/community/Ambassador/Event/etc/config.xml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ambassador_Event>
|
5 |
+
<version>1.1.1</version>
|
6 |
+
</Ambassador_Event>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<getambassador>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Ambassador_Event</module>
|
14 |
+
<frontName>getambassador</frontName>
|
15 |
+
</args>
|
16 |
+
</getambassador>
|
17 |
+
</routers>
|
18 |
+
<default>
|
19 |
+
<router>getambassador</router>
|
20 |
+
</default>
|
21 |
+
<events>
|
22 |
+
<checkout_onepage_controller_success_action>
|
23 |
+
<observers>
|
24 |
+
<Ambassador_Event_Model_Observer>
|
25 |
+
<type>singleton</type>
|
26 |
+
<class>Ambassador_Event_Model_Observer</class>
|
27 |
+
<method>addInitialCodeSnippet</method>
|
28 |
+
</Ambassador_Event_Model_Observer>
|
29 |
+
</observers>
|
30 |
+
</checkout_onepage_controller_success_action>
|
31 |
+
<controller_action_layout_render_before_customer_account_index>
|
32 |
+
<observers>
|
33 |
+
<Ambassador_Event_Model_Observer>
|
34 |
+
<type>singleton</type>
|
35 |
+
<class>Ambassador_Event_Model_Observer</class>
|
36 |
+
<method>sso</method>
|
37 |
+
</Ambassador_Event_Model_Observer>
|
38 |
+
</observers>
|
39 |
+
</controller_action_layout_render_before_customer_account_index>
|
40 |
+
<controller_action_layout_render_before_customer_account_logoutSuccess>
|
41 |
+
<observers>
|
42 |
+
<Ambassador_Event_Model_Observer>
|
43 |
+
<type>singleton</type>
|
44 |
+
<class>Ambassador_Event_Model_Observer</class>
|
45 |
+
<method>ssoLogout</method>
|
46 |
+
</Ambassador_Event_Model_Observer>
|
47 |
+
</observers>
|
48 |
+
</controller_action_layout_render_before_customer_account_logoutSuccess>
|
49 |
+
<controller_action_layout_render_before>
|
50 |
+
<observers>
|
51 |
+
<Ambassador_Event_Model_Observer>
|
52 |
+
<type>singleton</type>
|
53 |
+
<class>Ambassador_Event_Model_Observer</class>
|
54 |
+
<method>addLinkToPortal</method>
|
55 |
+
</Ambassador_Event_Model_Observer>
|
56 |
+
</observers>
|
57 |
+
</controller_action_layout_render_before>
|
58 |
+
</events>
|
59 |
+
</frontend>
|
60 |
+
<adminhtml>
|
61 |
+
<events>
|
62 |
+
<sales_order_invoice_pay>
|
63 |
+
<observers>
|
64 |
+
<Ambassador_Event_Model_Observer>
|
65 |
+
<type>singleton</type>
|
66 |
+
<class>Ambassador_Event_Model_Observer</class>
|
67 |
+
<method>callEventRecord</method>
|
68 |
+
</Ambassador_Event_Model_Observer>
|
69 |
+
</observers>
|
70 |
+
</sales_order_invoice_pay>
|
71 |
+
</events>
|
72 |
+
</adminhtml>
|
73 |
+
<global>
|
74 |
+
<models>
|
75 |
+
<ambassador_event>
|
76 |
+
<class>Ambassador_Event_Model</class>
|
77 |
+
</ambassador_event>
|
78 |
+
</models>
|
79 |
+
</global>
|
80 |
+
</config>
|
app/code/community/Ambassador/Payout/controllers/PayoutController.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ambassador_Payout_PayoutController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function creditAction ()
|
6 |
+
{
|
7 |
+
$api_key = $_POST['api_key'];
|
8 |
+
$customer_email = $_POST['email'];
|
9 |
+
$amount = $_POST['amount'];
|
10 |
+
$comment = $_POST['comment'];
|
11 |
+
$website_id = Mage::app()->getStore()->getWebsiteId();
|
12 |
+
$magento_api_key = Mage::getModel('core/variable')->loadByCode('getambassador_api_key')->getValue('plain');
|
13 |
+
|
14 |
+
if ($magento_api_key === $api_key) {
|
15 |
+
|
16 |
+
try {
|
17 |
+
|
18 |
+
if (!Mage::helper('enterprise_customerbalance')->isEnabled()) {
|
19 |
+
echo json_encode(array('type' => 'error', 'message' => 'Store Credit disabled.'));
|
20 |
+
}
|
21 |
+
|
22 |
+
$customer = Mage::getModel('customer/customer');
|
23 |
+
|
24 |
+
if ($customer_email) {
|
25 |
+
|
26 |
+
$customer->setWebsiteId($website_id)->loadByEmail($customer_email);
|
27 |
+
|
28 |
+
if (is_null($customer->getEntityId())) {
|
29 |
+
echo json_encode(array('type' => 'error', 'message' => 'Unknown customer email.'));
|
30 |
+
exit;
|
31 |
+
}
|
32 |
+
|
33 |
+
$data = array(
|
34 |
+
'website_id' => $website_id,
|
35 |
+
'amount_delta' => $amount,
|
36 |
+
'comment' => $comment,
|
37 |
+
'additional_info' => $comment
|
38 |
+
);
|
39 |
+
|
40 |
+
$customer->setCustomerBalanceData($data);
|
41 |
+
$customer->save();
|
42 |
+
|
43 |
+
if ($data = $customer->getCustomerBalanceData()) {
|
44 |
+
if (!empty($data['amount_delta'])) {
|
45 |
+
$balance = Mage::getModel('enterprise_customerbalance/balance')
|
46 |
+
->setCustomer($customer)
|
47 |
+
->setWebsiteId($data['website_id'])
|
48 |
+
->setAmountDelta($data['amount_delta'])
|
49 |
+
->setComment($data['comment'])
|
50 |
+
;
|
51 |
+
if (isset($data['notify_by_email']) && isset($data['store_id'])) {
|
52 |
+
$balance->setNotifyByEmail(true, $data['store_id']);
|
53 |
+
}
|
54 |
+
$balance->save();
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
} catch (Exception $e) {
|
60 |
+
|
61 |
+
echo json_encode(array('type' => 'exception', 'message' => $e->getMessage()));
|
62 |
+
exit;
|
63 |
+
}
|
64 |
+
|
65 |
+
echo json_encode(true);
|
66 |
+
exit;
|
67 |
+
|
68 |
+
} else {
|
69 |
+
|
70 |
+
echo json_encode(array('type' => 'error', 'message' => 'Invalid API key.'));
|
71 |
+
exit;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
private function curl_request($url, $data)
|
76 |
+
{
|
77 |
+
$data = http_build_query($data);
|
78 |
+
|
79 |
+
$curl_handle = curl_init();
|
80 |
+
curl_setopt($curl_handle, CURLOPT_URL, $url);
|
81 |
+
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 20);
|
82 |
+
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
|
83 |
+
curl_setopt($curl_handle, CURLOPT_POST, 1);
|
84 |
+
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
|
85 |
+
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
|
86 |
+
$result = curl_exec($curl_handle);
|
87 |
+
curl_close($curl_handle);
|
88 |
+
|
89 |
+
return json_decode($result);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
?>
|
app/code/community/Ambassador/Payout/etc/config.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ambassador_Payout>
|
5 |
+
<version>1.1.1</version>
|
6 |
+
</Ambassador_Payout>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<getambassador_payout>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Ambassador_Payout</module>
|
14 |
+
<frontName>getambassador_payout</frontName>
|
15 |
+
</args>
|
16 |
+
</getambassador_payout>
|
17 |
+
</routers>
|
18 |
+
</frontend>
|
19 |
+
</config>
|
app/design/frontend/default/default/template/ambassador/checkout/ecommerce.phtml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
4 |
+
$campaign = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
5 |
+
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
6 |
+
|
7 |
+
if ($mode === 'dev') {
|
8 |
+
$mbsy_url = 'http://mbsy.dev/';
|
9 |
+
} else {
|
10 |
+
$mbsy_url = 'https://mbsy.co/';
|
11 |
+
}
|
12 |
+
|
13 |
+
$checkout = Mage::getSingleton('checkout/session');
|
14 |
+
$lastId = $checkout->getLastOrderId();
|
15 |
+
|
16 |
+
if ($lastId) {
|
17 |
+
$order = Mage::getModel('sales/order');
|
18 |
+
$order->load($lastId);
|
19 |
+
}
|
20 |
+
|
21 |
+
if (!empty($order)) {
|
22 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
23 |
+
$email = $order->getCustomerEmail();
|
24 |
+
$first_name = $order->getBillingAddress()->getFirstname();
|
25 |
+
$last_name = $order->getBillingAddress()->getLastname();
|
26 |
+
} else {
|
27 |
+
$email = '';
|
28 |
+
$first_name = '';
|
29 |
+
$last_name = '';
|
30 |
+
}
|
31 |
+
|
32 |
+
?>
|
33 |
+
|
34 |
+
<script type="text/javascript">
|
35 |
+
var mbsy_campaign_uid='<?php echo $campaign ?>'; // Required
|
36 |
+
var mbsy_email='<?php echo $email ?>'; // Required - replace with your new customer's email
|
37 |
+
// Put additional optional variables here
|
38 |
+
var mbsy_revenue='0'; // Required
|
39 |
+
var mbsy_has_trial=1; // Required
|
40 |
+
var mbsy_first_name='<?php echo $first_name ?>';
|
41 |
+
var mbsy_last_name='<?php echo $last_name ?>';
|
42 |
+
var addthis_config = {
|
43 |
+
data_track_clickback: false
|
44 |
+
}
|
45 |
+
var addthis_share = {
|
46 |
+
templates : {
|
47 |
+
twitter : "{{title}} {{url}} (via @GetAmbassador)"
|
48 |
+
}
|
49 |
+
}
|
50 |
+
</script>
|
51 |
+
<script type="text/javascript" src="<?php echo $mbsy_url ?>v3/ecommerce/js/<?php echo $username ?>"></script>
|
app/design/frontend/default/default/template/ambassador/checkout/img.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
4 |
+
$campaign = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
5 |
+
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
6 |
+
|
7 |
+
if ($mode === 'dev') {
|
8 |
+
$mbsy_url = 'http://mbsy.dev/';
|
9 |
+
} else {
|
10 |
+
$mbsy_url = 'https://mbsy.co/';
|
11 |
+
}
|
12 |
+
|
13 |
+
$checkout = Mage::getSingleton('checkout/session');
|
14 |
+
$lastId = $checkout->getLastOrderId();
|
15 |
+
|
16 |
+
if ($lastId) {
|
17 |
+
$order = Mage::getModel('sales/order');
|
18 |
+
$order->load($lastId);
|
19 |
+
}
|
20 |
+
|
21 |
+
if (!empty($order)) {
|
22 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
23 |
+
$email = $order->getCustomerEmail();
|
24 |
+
$first_name = $order->getBillingAddress()->getFirstname();
|
25 |
+
$last_name = $order->getBillingAddress()->getLastname();
|
26 |
+
} else {
|
27 |
+
$email = '';
|
28 |
+
$first_name = '';
|
29 |
+
$last_name = '';
|
30 |
+
}
|
31 |
+
|
32 |
+
?>
|
33 |
+
|
34 |
+
<img src="<?php echo $mbsy_url ?>embed/v2/img/?mbsy_username=<?php echo $username ?>&mbsy_campaign_uid=<?php echo $campaign ?>&mbsy_email=<?php echo $email ?>&mbsy_first_name=<?php echo $first_name ?>&mbsy_last_name=<?php echo $last_name ?>&mbsy_revenue=0&mbsy_has_trial=1" style="border: none; display: none" alt="" />
|
app/design/frontend/default/default/template/ambassador/sso/affiliate_program.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div class="dashboard">
|
2 |
+
<iframe src="<?php echo $portal_url ?>/dashboard?iframe=true" style="border: none; width: 100%; height: 100%; min-height: 1600px; "></iframe>
|
3 |
+
</div>
|
4 |
+
|
app/design/frontend/default/default/template/ambassador/sso/sso.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<img src="<?php echo $portal_url ?>/sso/login/?token=<?php echo $mbsy_token; ?>&email=<?php echo urlencode($mbsy_email); ?>&signature=<?php echo $mbsy_signature; ?>&first_name=<?php echo urlencode($mbsy_first_name) ?>&last_name=<?php echo urlencode($mbsy_last_name) ?>" style="border: none; display: none" alt="" />
|
app/design/frontend/default/default/template/ambassador/sso/sso_logout.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<img src="<?php echo $portal_url ?>/sso/logout/?token=<?php echo $mbsy_token; ?>&email=<?php echo urlencode($mbsy_email); ?>&signature=<?php echo $mbsy_signature; ?>" style="border: none; display: none" alt="" />
|
app/design/frontend/enterprise/default/template/ambassador/checkout/ecommerce.phtml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
4 |
+
$campaign = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
5 |
+
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
6 |
+
|
7 |
+
if ($mode === 'dev') {
|
8 |
+
$mbsy_url = 'http://mbsy.dev/';
|
9 |
+
} else {
|
10 |
+
$mbsy_url = 'https://mbsy.co/';
|
11 |
+
}
|
12 |
+
|
13 |
+
$checkout = Mage::getSingleton('checkout/session');
|
14 |
+
$lastId = $checkout->getLastOrderId();
|
15 |
+
|
16 |
+
if ($lastId) {
|
17 |
+
$order = Mage::getModel('sales/order');
|
18 |
+
$order->load($lastId);
|
19 |
+
}
|
20 |
+
|
21 |
+
if (!empty($order)) {
|
22 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
23 |
+
$email = $order->getCustomerEmail();
|
24 |
+
$first_name = $order->getBillingAddress()->getFirstname();
|
25 |
+
$last_name = $order->getBillingAddress()->getLastname();
|
26 |
+
} else {
|
27 |
+
$email = '';
|
28 |
+
$first_name = '';
|
29 |
+
$last_name = '';
|
30 |
+
}
|
31 |
+
|
32 |
+
?>
|
33 |
+
|
34 |
+
<script type="text/javascript">
|
35 |
+
var mbsy_campaign_uid='<?php echo $campaign ?>'; // Required
|
36 |
+
var mbsy_email='<?php echo $email ?>'; // Required - replace with your new customer's email
|
37 |
+
// Put additional optional variables here
|
38 |
+
var mbsy_revenue='0'; // Required
|
39 |
+
var mbsy_has_trial=1; // Required
|
40 |
+
var mbsy_first_name='<?php echo $first_name ?>';
|
41 |
+
var mbsy_last_name='<?php echo $last_name ?>';
|
42 |
+
var addthis_config = {
|
43 |
+
data_track_clickback: false
|
44 |
+
}
|
45 |
+
var addthis_share = {
|
46 |
+
templates : {
|
47 |
+
twitter : "{{title}} {{url}} (via @GetAmbassador)"
|
48 |
+
}
|
49 |
+
}
|
50 |
+
</script>
|
51 |
+
<script type="text/javascript" src="<?php echo $mbsy_url ?>v3/ecommerce/js/<?php echo $username ?>"></script>
|
app/design/frontend/enterprise/default/template/ambassador/checkout/img.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$username = Mage::getModel('core/variable')->loadByCode('getambassador_username')->getValue('plain');
|
4 |
+
$campaign = Mage::getModel('core/variable')->loadByCode('getambassador_active_campaign')->getValue('plain');
|
5 |
+
$mode = Mage::getModel('core/variable')->loadByCode('getambassador_mode')->getValue('plain');
|
6 |
+
|
7 |
+
if ($mode === 'dev') {
|
8 |
+
$mbsy_url = 'http://mbsy.dev/';
|
9 |
+
} else {
|
10 |
+
$mbsy_url = 'https://mbsy.co/';
|
11 |
+
}
|
12 |
+
|
13 |
+
$checkout = Mage::getSingleton('checkout/session');
|
14 |
+
$lastId = $checkout->getLastOrderId();
|
15 |
+
|
16 |
+
if ($lastId) {
|
17 |
+
$order = Mage::getModel('sales/order');
|
18 |
+
$order->load($lastId);
|
19 |
+
}
|
20 |
+
|
21 |
+
if (!empty($order)) {
|
22 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
23 |
+
$email = $order->getCustomerEmail();
|
24 |
+
$first_name = $order->getBillingAddress()->getFirstname();
|
25 |
+
$last_name = $order->getBillingAddress()->getLastname();
|
26 |
+
} else {
|
27 |
+
$email = '';
|
28 |
+
$first_name = '';
|
29 |
+
$last_name = '';
|
30 |
+
}
|
31 |
+
|
32 |
+
?>
|
33 |
+
|
34 |
+
<img src="<?php echo $mbsy_url ?>embed/v2/img/?mbsy_username=<?php echo $username ?>&mbsy_campaign_uid=<?php echo $campaign ?>&mbsy_email=<?php echo $email ?>&mbsy_first_name=<?php echo $first_name ?>&mbsy_last_name=<?php echo $last_name ?>&mbsy_revenue=0&mbsy_has_trial=1" style="border: none; display: none" alt="" />
|
app/design/frontend/enterprise/default/template/ambassador/sso/affiliate_program.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div class="dashboard">
|
2 |
+
<iframe src="<?php echo $portal_url ?>/dashboard?iframe=true" style="border: none; width: 100%; height: 100%; min-height: 1600px; "></iframe>
|
3 |
+
</div>
|
4 |
+
|
app/design/frontend/enterprise/default/template/ambassador/sso/sso.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<img src="<?php echo $portal_url ?>/sso/login/?token=<?php echo $mbsy_token; ?>&email=<?php echo urlencode($mbsy_email); ?>&signature=<?php echo $mbsy_signature; ?>&first_name=<?php echo urlencode($mbsy_first_name) ?>&last_name=<?php echo urlencode($mbsy_last_name) ?>" style="border: none; display: none" alt="" />
|
app/design/frontend/enterprise/default/template/ambassador/sso/sso_logout.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<img src="<?php echo $portal_url ?>/sso/logout/?token=<?php echo $mbsy_token; ?>&email=<?php echo urlencode($mbsy_email); ?>&signature=<?php echo $mbsy_signature; ?>" style="border: none; display: none" alt="" />
|
app/etc/modules/Ambassador_Affiliate.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ambassador_Affiliate>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Ambassador_Affiliate>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Ambassador_Event.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ambassador_Event>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Ambassador_Event>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Ambassador_Payout.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ambassador_Payout>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Ambassador_Payout>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Ambassador</name>
|
4 |
+
<version>1.1.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="https://getambassador.com/terms">Zferral, Inc, magento@getAmbassador.com</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Ambassador is a social marketing tool for ecommerce. Easily track & manage customer referrals while leveraging your "brand ambassadors" to promote your products; driving more sales and increasing revenue.</summary>
|
10 |
+
<description>Ambassador gives any company the tools to turbo-charge their referral program, turning their customers into brand Ambassadors.
|
11 |
+

|
12 |
+
Use Ambassador to easily create, track & manage custom incentives that drive referrals and evangelize your users. It's as simple as pasting a javascript snippet or can be seamlessly integrated via API -- and super simple with our new Magento Extension!
|
13 |
+

|
14 |
+
Integrate Ambassador into the other existing applications you already use, including Salesforce, Sendgrid, MailChimp, Campaign Monitor, Sailthru, PayPal and Dwolla.
|
15 |
+

|
16 |
+
Get started on Ambassador with a free trial, simply follow the instructions on how to get up and running in just minutes.</description>
|
17 |
+
<notes>This version has been commercially tested and is available to the public.</notes>
|
18 |
+
<authors><author><name>Jeffrey Epstein</name><user>getAmbassador</user><email>magento@getambassador.com</email></author><author><name>Greg Szymczak</name><user>gpszymczak</user><email>gpszymczak@gmail.com</email></author></authors>
|
19 |
+
<date>2013-10-30</date>
|
20 |
+
<time>12:17:25</time>
|
21 |
+
<contents><target name="magecommunity"><dir name="Ambassador"><dir name="Affiliate"><dir name="Model"><file name="Observer.php" hash="b8bb353e129bf09f5eeb6cc9d21a107c"/></dir><dir name="controllers"><file name="AffiliateController.php" hash="675abd910b45ea4320cd30455c36a200"/></dir><dir name="etc"><file name="config.xml" hash="98de110422ad3fe68c234eebba9c401a"/></dir></dir><dir name="Event"><dir name="Model"><file name="Observer.php" hash="3f647f345040e4396bbfc17902ac66b8"/></dir><dir name="controllers"><file name="CallbackController.php" hash="476d887d7f68f7ef5c80b2ca63e49be5"/></dir><dir name="etc"><file name="config.xml" hash="a537a9ed902af080aac135e471c19858"/></dir></dir><dir name="Payout"><dir name="controllers"><file name="PayoutController.php" hash="487bb4245152f0f0d584005a3e92d464"/></dir><dir name="etc"><file name="config.xml" hash="23dbf12c8a05edce63499f19087367a1"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="ambassador"><dir name="checkout"><file name="ecommerce.phtml" hash="d2df6adb0de83dcd23fab6e75630e173"/><file name="img.phtml" hash="1d43bc5960d7d7b391d0b0d159c06bc4"/></dir><dir name="sso"><file name="affiliate_program.phtml" hash="983bfe455fa6bfb67f78966e9a5d607a"/><file name="sso.phtml" hash="4594166a7bd4657dc163b753fe639c21"/><file name="sso_logout.phtml" hash="0721023e06005ca9d102a3218ca0d32f"/></dir></dir></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="template"><dir name="ambassador"><dir name="checkout"><file name="ecommerce.phtml" hash="d2df6adb0de83dcd23fab6e75630e173"/><file name="img.phtml" hash="1d43bc5960d7d7b391d0b0d159c06bc4"/></dir><dir name="sso"><file name="affiliate_program.phtml" hash="983bfe455fa6bfb67f78966e9a5d607a"/><file name="sso.phtml" hash="4594166a7bd4657dc163b753fe639c21"/><file name="sso_logout.phtml" hash="0721023e06005ca9d102a3218ca0d32f"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ambassador_Event.xml" hash="531c19fe928c2fd3b008cf00bc865246"/><file name="Ambassador_Affiliate.xml" hash="806b368fde635b60f5dabad5cfa9e1d8"/><file name="Ambassador_Payout.xml" hash="24f665e03b13562e03b871957e959ae2"/></dir></target></contents>
|
22 |
+
<compatible/>
|
23 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php><package><name>Mage_Core_Controller_Front_Action</name><channel>core</channel><min></min><max></max></package><package><name>Varien_Event_Observer</name><channel>core</channel><min></min><max></max></package><extension><name>curl</name><min></min><max></max></extension><extension><name>json</name><min></min><max></max></extension></required></dependencies>
|
24 |
+
</package>
|