Sharemagnet_Social_Rebate - Version 1.1.1

Version Notes

This is a development version.

Download this release

Release Info

Developer Ben Stewart
Extension Sharemagnet_Social_Rebate
Version 1.1.1
Comparing to
See all releases


Code changes from version 1.0.7 to 1.1.1

app/code/community/Sharemagnet/Social/Rebate/Model/Observer.php CHANGED
@@ -1,116 +1,121 @@
1
  <?php
2
-
3
- class Sharemagnet_Social_Rebate_Model_Observer
4
- {
5
- /*
6
- Resource name: rebate_session
7
- Request method: POST
8
- Endpoint URL: http://sharemagnet.com/rest/v1/social-rebates/rebate_session/
9
- Mime type: application/json
10
- */
11
- protected $_initSharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session/';
12
-
13
- /*
14
- Resource name: rebate_session
15
- Request method: GET
16
- Endpoint URL: http://sharemagnet.com/rest/v1/social-rebates/rebate_session/<id>/
17
- GET params:
18
 
19
- magnet_key = ‘538441DA’
20
- */
21
  protected $_requestSharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session/';
22
-
23
- /**
24
- *
25
- * Resource name: rebate_session_order
26
- Request method: PUT
27
- Endpoint URL: http://sharemagnet.com/rest/v1/social-rebates/rebate_session_order/<order_id>/
28
- GET params:
29
-
30
- api_key = ‘c7c43d18154e8fa317f0d0b8ae76d321f97fd221’
31
- api_secret = ‘0491c4c7f8e90ee93fd5b9e7be1b1d70a35374ca’
32
- magnet_key = ‘538441DA’
33
- backend = ‘magento’
34
- PUT params:
35
-
36
- order_verified (boolean)
37
- *
38
- *
39
- */
40
  protected $_verifySharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session_order/';
41
 
42
- public function prepareService($event)
43
- {
44
  $order = $event->getOrder();
45
  $orderId= $order->getId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  $orderEmail=$order->getCustomerEmail();
47
  $purchase_amount = $order->getGrandTotal() - $order->getShippingAmount();
48
- try
49
- {
50
  $restApiKey = $this->getRestApiKey();
51
  $restApiSecret = $this->getRestApiSecret();
52
  $restApiMagnet = $this->getRestMagnetKey();
53
-
54
- if ($restApiKey !="" && $restApiSecret !="" & $restApiMagnet!="")
55
- {
56
  $client = new Zend_Http_Client();
57
-
58
  // initialize api session
59
  $client->setUri($this->_initSharemagnetApiUrl);
60
-
61
-
62
- $arr=array('magnet_key'=>$restApiMagnet,'type'=>'magento','order_id'=>$orderId,'order_email'=>$orderEmail,'total_purchase'=>$purchase_amount);
63
  $response=$client->setRawData(json_encode($arr), 'application/json')->request('POST');
64
  $call_integration_url=$response->getHeader("Location")."?magnet_key=".$restApiMagnet."&format=json";
65
- if ($response->getStatus()==201 && $response->getMessage()=="CREATED")
66
- {
67
-
68
  //get existing api session
69
- $client1 =new Zend_Http_Client();
70
-
71
  $client1->setUri($response->getHeader("Location"));
72
- $client1->setParameterGet(array('magnet_key'=>$restApiMagnet,'format'=>'json'));
73
-
74
  $response1 = $client1->request();
75
- if ($response1->getStatus()==500 || $response1->getStatus()==501)
76
- {
77
-
78
- }
79
- else
80
- {
81
  $responseBody1 = json_decode($response1->getBody());
82
  $integration_code=$responseBody1->integration_code;
83
  $offer_type=$responseBody1->offer_type;
84
  $order_id=$responseBody1->order_id;
85
  $order_email=$responseBody1->order_email;
86
-
87
  Mage::getSingleton('core/session')->setIntegrationCode($integration_code);
88
- /* */
89
  Mage::getSingleton('core/session')->setOfferType($offer_type);
90
  }
91
  }
92
- else
93
- {
94
-
95
- }
96
  }
97
- } catch (Exception $e) {
98
  $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
99
  $responseBody = '';
100
  }
101
-
102
  return $this;
103
  }
104
- public function getRestApiKey() {
 
105
  return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_apikey'));
106
  }
107
 
108
- public function getRestApiSecret() {
109
  return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_apisecret'));
110
  }
111
- public function getRestMagnetKey() {
 
112
  return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_magnetkey'));
113
  }
114
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
- ?>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ class Sharemagnet_Social_Rebate_Model_Observer{
4
+ protected $_initSharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session/';
5
  protected $_requestSharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session/';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  protected $_verifySharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session_order/';
7
 
8
+ public function prepareService($event){
 
9
  $order = $event->getOrder();
10
  $orderId= $order->getId();
11
+ $incrementId = $order->getIncremementId();
12
+ $realOrderId=$order->getRealOrderId();
13
+ if(!$orderId){
14
+ $orderId = 'NONE';
15
+ }
16
+ if(!$realOrderId){
17
+ $realOrderId = 'NONE';
18
+ }
19
+ if(!$incrementId){
20
+ $incrementId = 'NONE';
21
+ }
22
+ try{
23
+ $order_created = $order->created_at;
24
+ }
25
+ catch(Exception $e){
26
+ $order_created = NULL;
27
+ }
28
+ if(!$order_created){
29
+ $order_created = strftime('%Y-%m-%d %H:%M:%S',time());
30
+ }
31
  $orderEmail=$order->getCustomerEmail();
32
  $purchase_amount = $order->getGrandTotal() - $order->getShippingAmount();
33
+ try{
 
34
  $restApiKey = $this->getRestApiKey();
35
  $restApiSecret = $this->getRestApiSecret();
36
  $restApiMagnet = $this->getRestMagnetKey();
37
+ if ($restApiKey !="" && $restApiSecret !="" & $restApiMagnet!=""){
 
 
38
  $client = new Zend_Http_Client();
 
39
  // initialize api session
40
  $client->setUri($this->_initSharemagnetApiUrl);
41
+ $arr=array('magnet_key'=>$restApiMagnet,'type'=>'magento','order_id'=>$orderId,'increment_id'=>$incrementId,'real_order_id'=>$realOrderId,'order_email'=>$orderEmail,'total_purchase'=>$purchase_amount,'order_created'=>$order_created);
 
 
42
  $response=$client->setRawData(json_encode($arr), 'application/json')->request('POST');
43
  $call_integration_url=$response->getHeader("Location")."?magnet_key=".$restApiMagnet."&format=json";
44
+ $call_integration_url .= "&real_order_id=" . $realOrderId . "&increment_id=" . $incrementId . "&order_created=" . $order_created . "&order_email=" . $orderEmail. "&purchase_amount=" . $purchase_amount;
45
+ if ($response->getStatus()==201 && $response->getMessage()=="CREATED"){
 
46
  //get existing api session
47
+ $client1 =new Zend_Http_Client();
 
48
  $client1->setUri($response->getHeader("Location"));
49
+ $client1->setParameterGet(array('magnet_key'=>$restApiMagnet,'type'=>'magento','format'=>'json','order_id'=>$orderId,'increment_id'=>$incrementId,'real_order_id'=>$realOrderId,'order_email'=>$orderEmail,'total_purchase'=>$purchase_amount,'order_created'=>$order_created));
 
50
  $response1 = $client1->request();
51
+ if($response1->getStatus()!=500 && $response1->getStatus()!=501){
 
 
 
 
 
52
  $responseBody1 = json_decode($response1->getBody());
53
  $integration_code=$responseBody1->integration_code;
54
  $offer_type=$responseBody1->offer_type;
55
  $order_id=$responseBody1->order_id;
56
  $order_email=$responseBody1->order_email;
 
57
  Mage::getSingleton('core/session')->setIntegrationCode($integration_code);
 
58
  Mage::getSingleton('core/session')->setOfferType($offer_type);
59
  }
60
  }
 
 
 
 
61
  }
62
+ }catch(Exception $e){
63
  $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
64
  $responseBody = '';
65
  }
 
66
  return $this;
67
  }
68
+
69
+ public function getRestApiKey(){
70
  return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_apikey'));
71
  }
72
 
73
+ public function getRestApiSecret(){
74
  return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_apisecret'));
75
  }
76
+
77
+ public function getRestMagnetKey(){
78
  return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_magnetkey'));
79
  }
80
+
81
+ public function verifyOrderToSharemagnet($event){
82
+ $order = $event->getOrder();
83
+ if ($order->getState()==Mage_Sales_Model_Order::STATE_PROCESSING){
84
+ $restApiKey = $this->getRestApiKey();
85
+ $restApiSecret = $this->getRestApiSecret();
86
+ $restApiMagnet = $this->getRestMagnetKey();
87
+ $orderId= $order->getId();
88
+ $incrementId = $order->getIncremementId();
89
+ $realOrderId=$order->getRealOrderId();
90
+ if(!$orderId){
91
+ $orderId = 'NONE';
92
+ }
93
+ if(!$realOrderId){
94
+ $realOrderId = 'NONE';
95
+ }
96
+ if(!$incrementId){
97
+ $incrementId = 'NONE';
98
+ }
99
+
100
+ try{
101
+ $order_created = $order->created_at;
102
+ }
103
+ catch(Exception $e){
104
+ $order_created = NULL;
105
+ }
106
+ if(!$order_created){
107
+ $order_created = 'NONE';
108
+ }
109
+ $orderEmail=$order->getCustomerEmail();
110
+ $purchase_amount = $order->getGrandTotal() - $order->getShippingAmount();
111
+ if ($restApiKey !="" && $restApiSecret !="" & $restApiMagnet!=""){
112
+ $client1 =new Zend_Http_Client();
113
+ $client1->setUri($this->_verifySharemagnetApiUrl.$order->getId().'/');
114
+ $client1->setParameterGet(array('api_key'=>$restApiKey,'api_secret'=>$restApiSecret,'magnet_key'=>$restApiMagnet,'type'=>'magento','backend'=>'magento','format'=>'json','order_id'=>$orderId,'increment_id'=>$incrementId,'real_order_id'=>$realOrderId,'order_email'=>$orderEmail,'total_purchase'=>$purchase_amount,'order_created'=>$order_created));
115
+ $arr1=array('order_verified'=>1);
116
+ $response=$client1->setRawData(json_encode($arr1), 'application/json')->request(Zend_Http_Client::PUT);
117
+ }
118
+ }
119
+ }
120
  }
121
+ ?>
app/code/community/Sharemagnet/Social/Rebate/Model/Observer.php~ ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Sharemagnet_Social_Rebate_Model_Observer{
4
+ protected $_initSharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session/';
5
+ protected $_requestSharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session/';
6
+ protected $_verifySharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session_order/';
7
+
8
+ public function prepareService($event){
9
+ $order = $event->getOrder();
10
+ $orderId= $order->getId();
11
+ $incrementId = $order->getIncremementId();
12
+ $realOrderId=$order->getRealOrderId();
13
+ if(!$orderId){
14
+ $orderId = 'NONE';
15
+ }
16
+ if(!$realOrderId){
17
+ $realOrderId = 'NONE';
18
+ }
19
+ if(!$incrementId){
20
+ $incrementId = 'NONE';
21
+ }
22
+ try{
23
+ $order_created = $order->created_at;
24
+ }
25
+ catch(Exception $e){
26
+ $order_created = NULL;
27
+ }
28
+ if(!$order_created){
29
+ $order_created = strftime('%Y-%m-%d %H:%M:%S',time());
30
+ }
31
+ $orderEmail=$order->getCustomerEmail();
32
+ $purchase_amount = $order->getGrandTotal() - $order->getShippingAmount();
33
+ try{
34
+ $restApiKey = $this->getRestApiKey();
35
+ $restApiSecret = $this->getRestApiSecret();
36
+ $restApiMagnet = $this->getRestMagnetKey();
37
+ if ($restApiKey !="" && $restApiSecret !="" & $restApiMagnet!=""){
38
+ $client = new Zend_Http_Client();
39
+ // initialize api session
40
+ $client->setUri($this->_initSharemagnetApiUrl);
41
+ $arr=array('magnet_key'=>$restApiMagnet,'type'=>'magento','order_id'=>$orderId,'increment_id'=>$incrementId,'real_order_id'=>$realOrderId,'order_email'=>$orderEmail,'total_purchase'=>$purchase_amount,'order_created'=>$order_created);
42
+ $response=$client->setRawData(json_encode($arr), 'application/json')->request('POST');
43
+ $call_integration_url=$response->getHeader("Location")."?magnet_key=".$restApiMagnet."&format=json";
44
+ $call_integration_url .= "&real_order_id=" . $realOrderId . "&increment_id=" . $incrementId . "&order_created=" . $order_created . "&order_email=" . $orderEmail. "&purchase_amount=" . $purchase_amount;
45
+ if ($response->getStatus()==201 && $response->getMessage()=="CREATED"){
46
+ //get existing api session
47
+ $client1 =new Zend_Http_Client();
48
+ $client1->setUri($response->getHeader("Location"));
49
+ $client1->setParameterGet(array('magnet_key'=>$restApiMagnet,'type'=>'magento','format'=>'json','order_id'=>$orderId,'increment_id'=>$incrementId,'real_order_id'=>$realOrderId,'order_email'=>$orderEmail,'total_purchase'=>$purchase_amount,'order_created'=>$order_created));
50
+ $response1 = $client1->request();
51
+ if($response1->getStatus()!=500 && $response1->getStatus()!=501){
52
+ $responseBody1 = json_decode($response1->getBody());
53
+ $integration_code=$responseBody1->integration_code;
54
+ $offer_type=$responseBody1->offer_type;
55
+ $order_id=$responseBody1->order_id;
56
+ $order_email=$responseBody1->order_email;
57
+ Mage::getSingleton('core/session')->setIntegrationCode($integration_code);
58
+ Mage::getSingleton('core/session')->setOfferType($offer_type);
59
+ }
60
+ }
61
+ }
62
+ }catch(Exception $e){
63
+ $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
64
+ $responseBody = '';
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ public function getRestApiKey(){
70
+ return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_apikey'));
71
+ }
72
+
73
+ public function getRestApiSecret(){
74
+ return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_apisecret'));
75
+ }
76
+
77
+ public function getRestMagnetKey(){
78
+ return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_magnetkey'));
79
+ }
80
+
81
+ public function verifyOrderToSharemagnet($event){
82
+ $order = $event->getOrder();
83
+ if ($order->getState()==Mage_Sales_Model_Order::STATE_PROCESSING){
84
+ $restApiKey = $this->getRestApiKey();
85
+ $restApiSecret = $this->getRestApiSecret();
86
+ $restApiMagnet = $this->getRestMagnetKey();
87
+ $orderId= $order->getId();
88
+ $incrementId = $order->getIncremementId();
89
+ $realOrderId=$order->getRealOrderId();
90
+ if(!$orderId){
91
+ $orderId = 'NONE';
92
+ }
93
+ if(!$realOrderId){
94
+ $realOrderId = 'NONE';
95
+ }
96
+ if(!$incrementId){
97
+ $incrementId = 'NONE';
98
+ }
99
+ try{
100
+ $order_created = $order->created_at;
101
+ }
102
+ catch(Exception $e){
103
+ $order_created = NULL;
104
+ }
105
+ if(!$order_created){
106
+ $order_created = 'NONE';
107
+ }
108
+ $orderEmail=$order->getCustomerEmail();
109
+ $purchase_amount = $order->getGrandTotal() - $order->getShippingAmount();
110
+ if ($restApiKey !="" && $restApiSecret !="" & $restApiMagnet!=""){
111
+ $client1 =new Zend_Http_Client();
112
+ $client1->setUri($this->_verifySharemagnetApiUrl.$order->getId().'/');
113
+ $client1->setParameterGet(array('api_key'=>$restApiKey,'api_secret'=>$restApiSecret,'magnet_key'=>$restApiMagnet,'type'=>'magento','backend'=>'magento','format'=>'json','order_id'=>$orderId,'increment_id'=>$incrementId,'real_order_id'=>$realOrderId,'order_email'=>$orderEmail,'total_purchase'=>$purchase_amount,'order_created'=>$order_created));
114
+ $arr1=array('order_verified'=>1);
115
+ $response=$client1->setRawData(json_encode($arr1), 'application/json')->request(Zend_Http_Client::PUT);
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ?>
app/code/community/Sharemagnet/Social/Rebate/Model/Order.php DELETED
@@ -1,58 +0,0 @@
1
- <?php
2
- class Sharemagnet_Social_Rebate_Model_Order extends Mage_Sales_Model_Order
3
- {
4
- /**
5
- *
6
- * Resource name: rebate_session_order
7
- Request method: PUT
8
- Endpoint URL: http://sharemagnet.com/rest/v1/social-rebates/rebate_session_order/<order_id>/
9
- GET params:
10
-
11
- api_key = ‘c7c43d18154e8fa317f0d0b8ae76d321f97fd221’
12
- api_secret = ‘0491c4c7f8e90ee93fd5b9e7be1b1d70a35374ca’
13
- magnet_key = ‘538441DA’
14
- backend = ‘magento’
15
- PUT params:
16
-
17
- order_verified (boolean)
18
- *
19
- *
20
- */
21
- protected $_verifySharemagnetApiUrl = 'http://sharemagnet.com/rest/v1/social-rebates/rebate_session_order/';
22
-
23
- protected function _beforeSave()
24
- {
25
- parent::_beforeSave();
26
- if ($this->getState()==Mage_Sales_Model_Order::STATE_PROCESSING) //STATE_PROCESSING
27
- {
28
- $restApiKey = $this->getRestApiKey();
29
- $restApiSecret = $this->getRestApiSecret();
30
- $restApiMagnet = $this->getRestMagnetKey();
31
- if ($restApiKey !="" && $restApiSecret !="" & $restApiMagnet!="")
32
- {
33
- $client1 =new Zend_Http_Client();
34
-
35
-
36
- $client1->setUri($this->_verifySharemagnetApiUrl.$this->getId().'/?api_key='.$restApiKey.'&api_secret='.$restApiSecret.'&magnet_key='.$restApiMagnet.'&backend=magento');
37
-
38
-
39
- $arr1=array('order_verified'=>1);
40
- $response=$client1->setRawData(json_encode($arr1), 'application/json')->request(Zend_Http_Client::PUT);
41
-
42
-
43
- }
44
- }
45
-
46
- }
47
- public function getRestApiKey() {
48
- return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_apikey'));
49
- }
50
-
51
- public function getRestApiSecret() {
52
- return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_apisecret'));
53
- }
54
- public function getRestMagnetKey() {
55
- return trim(Mage::getStoreConfig('social_rebate_section/social_rebate_group/social_rebate_magnetkey'));
56
- }
57
- }
58
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sharemagnet/Social/Rebate/etc/config.xml CHANGED
@@ -1,6 +1,7 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
 
4
  <Sharemagnet_Social_Rebate>
5
  <version>1.5.0.0</version>
6
  </Sharemagnet_Social_Rebate>
@@ -11,16 +12,6 @@
11
  <class>Sharemagnet_Social_Rebate_Block</class>
12
  </social_rebate>
13
  </blocks>
14
- <models>
15
- <social_rebate>
16
- <class>Sharemagnet_Social_Rebate_Model</class>
17
- </social_rebate>
18
- <sales>
19
- <rewrite>
20
- <order>Sharemagnet_Social_Rebate_Model_Order</order>
21
- </rewrite>
22
- </sales>
23
- </models>
24
  <helpers>
25
  <social_rebate>
26
  <class>Sharemagnet_Social_Rebate_Helper</class>
@@ -29,14 +20,23 @@
29
  <events>
30
  <sales_order_place_after>
31
  <observers>
32
- <prepare_sharemagent_service>
33
  <type>singleton</type>
34
  <class>Sharemagnet_Social_Rebate_Model_Observer</class>
35
  <method>prepareService</method>
36
- </prepare_sharemagent_service>
37
  </observers>
38
  </sales_order_place_after>
39
- </events>
 
 
 
 
 
 
 
 
 
40
  </global>
41
  <frontend>
42
  <layout>
@@ -82,4 +82,4 @@
82
  </resources>
83
  </acl>
84
  </adminhtml>
85
- </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
+
5
  <Sharemagnet_Social_Rebate>
6
  <version>1.5.0.0</version>
7
  </Sharemagnet_Social_Rebate>
12
  <class>Sharemagnet_Social_Rebate_Block</class>
13
  </social_rebate>
14
  </blocks>
 
 
 
 
 
 
 
 
 
 
15
  <helpers>
16
  <social_rebate>
17
  <class>Sharemagnet_Social_Rebate_Helper</class>
20
  <events>
21
  <sales_order_place_after>
22
  <observers>
23
+ <sharemagnet_social_rebate_model_observer>
24
  <type>singleton</type>
25
  <class>Sharemagnet_Social_Rebate_Model_Observer</class>
26
  <method>prepareService</method>
27
+ </sharemagnet_social_rebate_model_observer>
28
  </observers>
29
  </sales_order_place_after>
30
+ <sales_order_save_after>
31
+ <observers>
32
+ <sharemagnet_social_rebate_model_observer>
33
+ <type>singleton</type>
34
+ <class>Sharemagnet_Social_Rebate_Model_Observer</class>
35
+ <method>verifyOrderToSharemagnet</method>
36
+ </sharemagnet_social_rebate_model_observer>
37
+ </observers>
38
+ </sales_order_save_after>
39
+ </events>
40
  </global>
41
  <frontend>
42
  <layout>
82
  </resources>
83
  </acl>
84
  </adminhtml>
85
+ </config>
app/code/community/Sharemagnet/Social/Rebate/etc/config.xml~ ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+
5
+ <Sharemagnet_Social_Rebate>
6
+ <version>1.5.0.0</version>
7
+ </Sharemagnet_Social_Rebate>
8
+ </modules>
9
+ <global>
10
+ <blocks>
11
+ <social_rebate>
12
+ <class>Sharemagnet_Social_Rebate_Block</class>
13
+ </social_rebate>
14
+ </blocks>
15
+ <helpers>
16
+ <social_rebate>
17
+ <class>Sharemagnet_Social_Rebate_Helper</class>
18
+ </social_rebate>
19
+ </helpers>
20
+ <events>
21
+ <sales_order_place_after>
22
+ <observers>
23
+ <sharemagnet_social_rebate_model_observer>
24
+ <type>singleton</type>
25
+ <class>Sharemagnet_Social_Rebate_Model_Observer</class>
26
+ <method>prepareService</method>
27
+ </sharemagnet_social_rebate_model_observer>
28
+ </observers>
29
+ </sales_order_place_after>
30
+ <sales_order_save_after>
31
+ <observers>
32
+ <sharemagnet_social_rebate_model_observer>
33
+ <type>singleton</type>
34
+ <class>Sharemagnet_Social_Rebate_Model_Observer</class>
35
+ <method>verifyOrderToSharemagnet</method>
36
+ </sharemagnet_social_rebate_model_observer>
37
+ </observers>
38
+ </sales_order_save_after>
39
+ </events>
40
+ </global>
41
+ <frontend>
42
+ <layout>
43
+ <updates>
44
+ <social_rebate>
45
+ <file>sharemagnet/social/rebate.xml</file>
46
+ </social_rebate>
47
+ </updates>
48
+ </layout>
49
+
50
+ </frontend>
51
+
52
+ <admin>
53
+ <routers>
54
+ <adminhtml>
55
+ <args>
56
+ <modules>
57
+ <Sharemagnet_Social_Rebate before="Mage_Adminhtml">Sharemagnet_Social_Rebate_Adminhtml</Sharemagnet_Social_Rebate>
58
+ </modules>
59
+ </args>
60
+ </adminhtml>
61
+ </routers>
62
+ </admin>
63
+
64
+ <adminhtml>
65
+ <acl>
66
+ <resources>
67
+ <admin>
68
+ <children>
69
+ <system>
70
+ <children>
71
+ <config>
72
+ <children>
73
+ <social_rebate_section>
74
+ <title>Social Rebate Section</title>
75
+ </social_rebate_section>
76
+ </children>
77
+ </config>
78
+ </children>
79
+ </system>
80
+ </children>
81
+ </admin>
82
+ </resources>
83
+ </acl>
84
+ </adminhtml>
85
+ </config>
app/code/community/Sharemagnet/Social/Rebate/etc/system.xml CHANGED
@@ -46,21 +46,21 @@
46
  <show_in_website>1</show_in_website>
47
  <show_in_store>1</show_in_store>
48
  <fields>
49
- <social_rebate_apikey translate="label tooltip comment">
50
- <label>Social Rebate API Key</label>
51
  <frontend_type>text</frontend_type>
52
  <show_in_default>1</show_in_default>
53
  <show_in_website>1</show_in_website>
54
  <show_in_store>1</show_in_store>
55
-
56
- </social_rebate_apikey>
57
- <social_rebate_apisecret translate="label tooltip comment">
58
- <label>Social Rebate API Secret</label>
59
  <frontend_type>text</frontend_type>
60
  <show_in_default>1</show_in_default>
61
  <show_in_website>1</show_in_website>
62
  <show_in_store>1</show_in_store>
63
- </social_rebate_apisecret>
 
64
  <social_rebate_magnetkey translate="label tooltip comment">
65
  <label>Social Rebate Store Key</label>
66
  <frontend_type>text</frontend_type>
46
  <show_in_website>1</show_in_website>
47
  <show_in_store>1</show_in_store>
48
  <fields>
49
+ <social_rebate_apisecret translate="label tooltip comment">
50
+ <label>Social Rebate API Secret</label>
51
  <frontend_type>text</frontend_type>
52
  <show_in_default>1</show_in_default>
53
  <show_in_website>1</show_in_website>
54
  <show_in_store>1</show_in_store>
55
+ </social_rebate_apisecret>
56
+ <social_rebate_apikey translate="label tooltip comment">
57
+ <label>Social Rebate API Key</label>
 
58
  <frontend_type>text</frontend_type>
59
  <show_in_default>1</show_in_default>
60
  <show_in_website>1</show_in_website>
61
  <show_in_store>1</show_in_store>
62
+
63
+ </social_rebate_apikey>
64
  <social_rebate_magnetkey translate="label tooltip comment">
65
  <label>Social Rebate Store Key</label>
66
  <frontend_type>text</frontend_type>
app/design/frontend/base/default/template/sharemagnet/social/rebate.phtml CHANGED
@@ -78,12 +78,6 @@
78
  ?>
79
  <!-- add integration code part -->
80
  </div>
81
- <?php
82
- if (Mage::getSingleton('core/session')->getOfferType()=="POPUP")
83
- {
84
- echo "<script type='text/javascript'>iframe = document.getElementById('iframe');iframe.setAttribute('data-fb-options','width:600 height:620 scrolling:no');fb.activateElements();fb.start('#iframe');</script>";
85
- }
86
- ?>
87
  <?php endif; ?>
88
  <!-- End Sharemagnet Rebate Order -->
89
 
78
  ?>
79
  <!-- add integration code part -->
80
  </div>
 
 
 
 
 
 
81
  <?php endif; ?>
82
  <!-- End Sharemagnet Rebate Order -->
83
 
app/design/frontend/base/default/template/sharemagnet/social/rebate.phtml~ ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2010 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
+ <div id="fb-root"></div>
28
+ <script>(function(d, s, id) {
29
+ var js, fjs = d.getElementsByTagName(s)[0];
30
+ if (d.getElementById(id)) return;
31
+ js = d.createElement(s); js.id = id;
32
+ js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
33
+ fjs.parentNode.insertBefore(js, fjs);
34
+ }(document, 'script', 'facebook-jssdk'));</script>
35
+
36
+ <div class="page-title">
37
+ <h1><?php echo $this->__('Your order has been received') ?></h1>
38
+ </div>
39
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
40
+ <p><strong><?php echo $this->__('Thank you for your purchase!') ?></strong></p>
41
+
42
+ <?php if ($this->getOrderId()):?>
43
+ <?php if ($this->getCanViewOrder()) :?>
44
+ <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
45
+ <?php else :?>
46
+ <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?>.</p>
47
+ <?php endif;?>
48
+ <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
49
+ <?php if ($this->getViewOrder() && $this->getCanPrintOrder()) :?>
50
+ <p>
51
+ <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
52
+ <?php echo $this->getChildHtml() ?>
53
+ </p>
54
+ <?php endif;?>
55
+ <?php endif;?>
56
+
57
+ <?php if ($this->getAgreementRefId()): ?>
58
+ <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
59
+ <?php endif;?>
60
+
61
+ <?php if ($profiles = $this->getRecurringProfiles()):?>
62
+ <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
63
+ <ul>
64
+ <?php foreach($profiles as $profile):?>
65
+ <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
66
+ <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
67
+ <?php endforeach;?>
68
+ </ul>
69
+ <?php endif;?>
70
+ <!-- Sharemagnet Rebate Order -->
71
+ <?php if ($this->getOrderId()):?>
72
+ <script type="text/javascript" src="https://sharemagnet.com/site_media/static/lb/floatbox.js"></script>
73
+ <link type="text/css" rel="stylesheet" href="https://sharemagnet.com/site_media/static/lb/floatbox.css" />
74
+ <link rel="stylesheet" href="https://sharemagnet.com/site_media/static/css/social_integration.css" type="text/css" media="screen" />
75
+ <div id="iframe-holder">
76
+ <?php
77
+ echo Mage::getSingleton('core/session')->getIntegrationCode();
78
+ ?>
79
+ <!-- add integration code part -->
80
+ </div>
81
+ <?php endif; ?>
82
+ <!-- End Sharemagnet Rebate Order -->
83
+
84
+ <div class="buttons-set">
85
+ <button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
86
+ </div>
package.xml CHANGED
@@ -1,18 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sharemagnet_Social_Rebate</name>
4
- <version>1.0.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/artistic-license-2.0">Artistic License 2.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Turn customers purchases into highly credible Social Media Marketing for your store with Social Rebate!</summary>
10
  <description>Social Rebate provides a comprehensive Social Commerce platform for online retailers to help increase social sharing and customer referrals from Social Media to their eCommerce stores.</description>
11
- <notes>This is beta version.</notes>
12
  <authors><author><name>Ben Stewart</name><user>SocialRebate</user><email>info@sharemagnet.com</email></author></authors>
13
- <date>2013-04-24</date>
14
- <time>03:31:01</time>
15
- <contents><target name="magecommunity"><dir name="Sharemagnet"><dir name="Social"><dir name="Rebate"><dir name="Block"><file name="Rebateorder.php" hash="894088ccc6bf24d5d3221666b9484c63"/></dir><dir name="Helper"><file name="Data.php" hash="eb8159561687773312ad8b668b4739ee"/></dir><dir name="Model"><file name="Observer.php" hash="d8c96bdae67f28aa08394dac920be678"/><file name="Order.php" hash="49961a5f4997415fb8e3272880ffb0cd"/></dir><dir name="etc"><file name="config.xml" hash="810c87942360b4b1d440657fee091652"/><file name="system.xml" hash="805f09f45dfd5da1e808b80e86a07967"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="sharemagnet"><dir name="social"><file name="rebate.xml" hash="18aeacd2950d493fde5042326944d98e"/></dir></dir></dir><dir name="template"><dir name="sharemagnet"><dir name="social"><file name="rebate.phtml" hash="336dfd41c67b36a038d4e04ec84ed3d0"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sharemagnet_Social_Rebate.xml" hash="ddd29c70265716206160515bc8f980f0"/></dir></target></contents>
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>Sharemagnet_Social_Rebate</name>
4
+ <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/artistic-license-2.0">Artistic License 2.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Turn customers purchases into highly credible Social Media Marketing for your store with Social Rebate!</summary>
10
  <description>Social Rebate provides a comprehensive Social Commerce platform for online retailers to help increase social sharing and customer referrals from Social Media to their eCommerce stores.</description>
11
+ <notes>This is a development version.</notes>
12
  <authors><author><name>Ben Stewart</name><user>SocialRebate</user><email>info@sharemagnet.com</email></author></authors>
13
+ <date>2013-06-12</date>
14
+ <time>12:31:01</time>
15
+ <contents><target name="magecommunity"><dir name="Sharemagnet"><dir name="Social"><dir name="Rebate"><dir name="Block"><file name="Rebateorder.php" hash="894088ccc6bf24d5d3221666b9484c63"/></dir><dir name="Helper"><file name="Data.php" hash="eb8159561687773312ad8b668b4739ee"/></dir><dir name="Model"><file name="Observer.php" hash="d8c96bdae67f28aa08394dac920be678"/></dir><dir name="etc"><file name="config.xml" hash="810c87942360b4b1d440657fee091652"/><file name="system.xml" hash="805f09f45dfd5da1e808b80e86a07967"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="sharemagnet"><dir name="social"><file name="rebate.xml" hash="18aeacd2950d493fde5042326944d98e"/></dir></dir></dir><dir name="template"><dir name="sharemagnet"><dir name="social"><file name="rebate.phtml" hash="336dfd41c67b36a038d4e04ec84ed3d0"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sharemagnet_Social_Rebate.xml" hash="ddd29c70265716206160515bc8f980f0"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
19
+