From 5e06c5cbb95724faf7676bf2dc0dc8a787a60a27 Mon Sep 17 00:00:00 2001
From: Adam Grohs 
Date: Thu, 24 Sep 2020 07:43:30 -0500
Subject: [PATCH 01/15] Update README.md
---
 README.md | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 13fa609..9b7a1d7 100644
--- a/README.md
+++ b/README.md
@@ -19,8 +19,6 @@ This extension makes Zendesk work seamlessly with Magento to enable stores to de
 - Create support tickets from Contact Us requests
 - Easily add the [Embeddables](https://www.zendesk.com/embeddables) Web Widget to your site
 
-The latest stable version of the extension can be installed via the [Magento Connect](http://www.magentocommerce.com/magento-connect/catalog/product/view/id/15129/) marketplace.
-
 ## API
 
 ### General Notes
@@ -149,12 +147,8 @@ During development you may wish to clear out the configuration for the Magento e
 
 ## Contribution
 
-Improvements to the extension are always welcome. To contribute, please submit detailed Pull Requests.
-
-## Bugs
-
-Please submit bug reports to Zendesk.
+Improvements to the extension are always welcome. To contribute, please submit detailed Pull Requests. To share any Issues or potential Bugs, please submit an Issue.
 
 ## Copyright and License
 
-Copyright 2012-present, Zendesk Inc. Licensed under the Apache License Version 2.0.
+Copyright 2012-present, Zendesk Inc. + Copyright 2020-present, agnoStack, Inc. Licensed under the Apache License Version 2.0.
From db111e7c5b5dd7560fc58bc5e59a928607494c9e Mon Sep 17 00:00:00 2001
From: Adam Grohs 
Date: Thu, 24 Sep 2020 07:44:45 -0500
Subject: [PATCH 02/15] Update LICENSE
---
 LICENSE | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
index e76a0c3..df5c444 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright 2015 Zendesk
+Copyright Zendesk Inc. + agnoStack, Inc.
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
From a89fa87106e5e97a0d2c2d2f498e2b68c2965287 Mon Sep 17 00:00:00 2001
From: Adam Grohs 
Date: Thu, 24 Sep 2020 07:47:06 -0500
Subject: [PATCH 03/15] Update README.md
---
 README.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 9b7a1d7..7508e4c 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,8 @@ The new 3.0 version fixes several core issues (incorrect/missing order address,
 
 # Zendesk Extension for Magento
 
-This extension makes Zendesk work seamlessly with Magento to enable stores to deliver great customer support. **Features include:**
+This Extension makes Zendesk work seamlessly with Magento 1 to enable stores to deliver great customer support. It was originally develop by [Zendesk](https://www.zendesk.com) and is now supported and maintained by [agnoStack](https://agnostack.com).
+**Features include:**
 
 - Enable Single Sign-on with Zendesk
 - Create support tickets without leaving Magento
From e5ad20cdc932b646b29725bcee3e9b9bf9418e95 Mon Sep 17 00:00:00 2001
From: Adam Grohs 
Date: Thu, 24 Sep 2020 07:47:25 -0500
Subject: [PATCH 04/15] Update README.md
---
 README.md | 1 +
 1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 7508e4c..b42322d 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ The new 3.0 version fixes several core issues (incorrect/missing order address,
 # Zendesk Extension for Magento
 
 This Extension makes Zendesk work seamlessly with Magento 1 to enable stores to deliver great customer support. It was originally develop by [Zendesk](https://www.zendesk.com) and is now supported and maintained by [agnoStack](https://agnostack.com).
+
 **Features include:**
 
 - Enable Single Sign-on with Zendesk
From cb147bcb5336524db91b3eebc748de21b7c0d643 Mon Sep 17 00:00:00 2001
From: Adam Grohs 
Date: Wed, 30 Sep 2020 07:37:09 -0500
Subject: [PATCH 05/15] Update README.md
---
 README.md | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index b42322d..f66f769 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,8 @@ The new 3.0 version fixes several core issues (incorrect/missing order address,
 * Enable direct Order Search by ID
 * Access Order Messages and Notes
 
+Dowload the latest version of the extension at: https://github.com/agnostack/magento_extension/releases/tag/v3.0.0. Additional detailed instructions on configuring agnoStack for the new version can be found at: https://agnostack.com/faqs/setup-onboarding/configuring-magento-1.
+
 
 # Zendesk Extension for Magento
 
From 1e5e4d4e4164af35fa02e5db3db2fdf3e3fda817 Mon Sep 17 00:00:00 2001
From: Adam Grohs 
Date: Wed, 30 Sep 2020 07:37:21 -0500
Subject: [PATCH 06/15] Update README.md
---
 README.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f66f769..216d0dc 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,8 @@ The new 3.0 version fixes several core issues (incorrect/missing order address,
 * Enable direct Order Search by ID
 * Access Order Messages and Notes
 
-Dowload the latest version of the extension at: https://github.com/agnostack/magento_extension/releases/tag/v3.0.0. Additional detailed instructions on configuring agnoStack for the new version can be found at: https://agnostack.com/faqs/setup-onboarding/configuring-magento-1.
+Dowload the latest version of the extension at: https://github.com/agnostack/magento_extension/releases/tag/v3.0.0.
+Additional detailed instructions on configuring agnoStack for the new version can be found at: https://agnostack.com/faqs/setup-onboarding/configuring-magento-1.
 
 
 # Zendesk Extension for Magento
From 90c9771c2cb71f1ab5d76113cf2ae9aa7193887b Mon Sep 17 00:00:00 2001
From: Adam Grohs 
Date: Wed, 30 Sep 2020 07:37:33 -0500
Subject: [PATCH 07/15] Update README.md
---
 README.md | 1 +
 1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 216d0dc..825703f 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,7 @@ The new 3.0 version fixes several core issues (incorrect/missing order address,
 * Access Order Messages and Notes
 
 Dowload the latest version of the extension at: https://github.com/agnostack/magento_extension/releases/tag/v3.0.0.
+
 Additional detailed instructions on configuring agnoStack for the new version can be found at: https://agnostack.com/faqs/setup-onboarding/configuring-magento-1.
 
 
From b31ce2e6b527f0cfeae54f9c535aa458ca854520 Mon Sep 17 00:00:00 2001
From: rsbowers 
Date: Tue, 13 Oct 2020 20:18:12 -0500
Subject: [PATCH 08/15] chore: add address only if they exist
---
 .../community/Zendesk/Zendesk/Helper/Data.php | 73 +++++++++++--------
 .../Zendesk/controllers/ApiController.php     |  2 +-
 .../community/Zendesk/Zendesk/etc/config.xml  |  2 +-
 .../default/template/zendesk/left-menu.phtml  |  2 +-
 4 files changed, 47 insertions(+), 32 deletions(-)
diff --git a/src/app/code/community/Zendesk/Zendesk/Helper/Data.php b/src/app/code/community/Zendesk/Zendesk/Helper/Data.php
index c304489..c067b5d 100644
--- a/src/app/code/community/Zendesk/Zendesk/Helper/Data.php
+++ b/src/app/code/community/Zendesk/Zendesk/Helper/Data.php
@@ -479,24 +479,26 @@ protected function formatCustomer($order)
 
     protected function formatAddress($address)
     {
-        $addressData = array(
-            'type' => 'address',
-            'first_name' => $address->getFirstname(),
-            'last_name' => $address->getLastname(),
-            'city' => $address->getCity(),
-            'county' => $address->getRegion(),
-            'postcode' => $address->getPostcode(),
-            'country' => $address->getCountryId(),
-            'phone' => $address->getTelephone()
-        );
-
-        $entityId = $address->getEntityId();
-        $addressId = $address->getCustomerAddressId();
-        $addressData['id'] = $addressId ?: $entityId;
-
-        $street = $address->getStreet();
-        $addressData['line_1'] = $street[0] ?: '';
-        $addressData['line_2'] = $street[1] ?: '';
+        if ($address) {
+            $addressData = array(
+                'type' => 'address',
+                'first_name' => $address->getFirstname(),
+                'last_name' => $address->getLastname(),
+                'city' => $address->getCity(),
+                'county' => $address->getRegion(),
+                'postcode' => $address->getPostcode(),
+                'country' => $address->getCountryId(),
+                'phone' => $address->getTelephone()
+            );
+    
+            $entityId = $address->getEntityId();
+            $addressId = $address->getCustomerAddressId();
+            $addressData['id'] = $addressId ?: $entityId;
+    
+            $street = $address->getStreet();
+            $addressData['line_1'] = $street[0] ?: '';
+            $addressData['line_2'] = $street[1] ?: '';
+        }
 
         return $addressData;
     }
@@ -517,7 +519,7 @@ public function getShipments($order)
             if (count($tracks) > 0) {
                 foreach($tracks as $track) {
                     if ($shipmentId == $track->getParentId()) {
-                        $shipments[] = array(
+                        $shipment = array(
                             'id' => $track->getEntityId(),
                             'carrier' => $track->getTitle(),
                             'carrier_code' => $track->getCarrierCode(),
@@ -526,24 +528,32 @@ public function getShipments($order)
                             'created_at' => $track->getCreatedAt(),
                             'updated_at' => $track->getUpdatedAt(),
                             'tracking_number' => $track->getTrackNumber(),
-                            'shipping_address' => $this->formatAddress($shippingAddress),
                             'order_status' => $orderStatus,
                         );
-                    }
+                        if ($shippingAddress) {
+                            $shipment['shipping_address'] = $this->formatAddress($shippingAddress);
+                        }
+                        $shipments[] = $shipment;
+                     }
                 }
             } else {
-                $shipments[] = array(
+                $shipment = array(
                     'service_code' => $serviceCode,
                     'carrier_code' => $order->getShippingMethod(),
-                    'shipping_address' => $this->formatAddress($shippingAddress),
                     'order_status' => $orderStatus,
                 );
+                if ($shippingAddress) {
+                    $shipment['shipping_address'] = $this->formatAddress($shippingAddress);
+                }
+                $shipments[] = $shipment;
             }
         } else {
             $shippingAddress = $order->getShippingAddress();
-            $shipments[] = array(
-                'shipping_address' => $this->formatAddress($shippingAddress),
-            );
+            if ($shippingAddress) {
+                $shipments[] = array(
+                    'shipping_address' => $this->formatAddress($shippingAddress),
+                );
+            }
         }
 
         return $shipments;
@@ -558,13 +568,13 @@ public function getOrderDetailBasic($order)
         $shippingAddress = $order->getShippingAddress();
         $shippingWithTax = $order->getShippingInclTax();
         $shippingMethod = $order->getShippingMethod();
+        $billingAddress = $order->getBillingAddress();
 
         $orderInfo = array(
             'id' => $order->getIncrementId(),
             'url' => $urlModel->getUrl('adminhtml/sales_order/view', array('order_id' => $order->getId())),
             'transaction_id' => $order->getIncrementId(),
             'status' => $order->getStatus(),
-            'billing_address' => $this->formatAddress($order->getBillingAddress()),
             'meta' => array(
                 'store_info' => array(
                     'type' => 'store_info',
@@ -590,6 +600,9 @@ public function getOrderDetailBasic($order)
             ),
             'shipments' => array(),
         );
+        if ($billingAddress) {
+            $orderInfo['billing_address'] = $this->formatAddress($billingAddress);
+        }
 
         foreach($order->getItemsCollection(array(), true) as $item) {
             $itemWithTax = $item->getRowTotal();
@@ -772,7 +785,9 @@ public function getCustomer($customer)
         );
 
         foreach($customer->getAddressesCollection() as $address) {
-            $info['addresses'][] = $this->formatAddress($address);
+            if ($address) {
+                $info['addresses'][] = $this->formatAddress($address);
+            }
         }
 
         return $info;
@@ -825,7 +840,7 @@ public function getFilteredOrdersByProduct($customerFilters, $productFilters)
             );
         }
 
-        if($email) {
+        if ($email) {
             $filteredOrdersData = array_filter(array_values($ordersData), function ($orderData) use ($email) {
                 return ($orderData['email'] == $email);
             });
diff --git a/src/app/code/community/Zendesk/Zendesk/controllers/ApiController.php b/src/app/code/community/Zendesk/Zendesk/controllers/ApiController.php
index d0a255c..65f861c 100644
--- a/src/app/code/community/Zendesk/Zendesk/controllers/ApiController.php
+++ b/src/app/code/community/Zendesk/Zendesk/controllers/ApiController.php
@@ -23,7 +23,7 @@ public function preDispatch() {
         // TODO!!!!!!!: read version from config.xml
         // $configSettings = Mage::getSingleton('Zendesk_Zendesk/config');
         // Mage::log(json_encode($configSettings), null, 'zendesk.log');
-        $this->getResponse()->setHeader('X-Extension-Version', '3.0.0');
+        $this->getResponse()->setHeader('X-Extension-Version', '3.0.1');
         return $this;
     }
 
diff --git a/src/app/code/community/Zendesk/Zendesk/etc/config.xml b/src/app/code/community/Zendesk/Zendesk/etc/config.xml
index 9f1e211..0795fa7 100644
--- a/src/app/code/community/Zendesk/Zendesk/etc/config.xml
+++ b/src/app/code/community/Zendesk/Zendesk/etc/config.xml
@@ -19,7 +19,7 @@
 
     
         
-            3.0.0
+            3.0.1
         
     
     
diff --git a/src/app/design/adminhtml/default/default/template/zendesk/left-menu.phtml b/src/app/design/adminhtml/default/default/template/zendesk/left-menu.phtml
index 0cc5f14..ee36804 100644
--- a/src/app/design/adminhtml/default/default/template/zendesk/left-menu.phtml
+++ b/src/app/design/adminhtml/default/default/template/zendesk/left-menu.phtml
@@ -55,6 +55,6 @@
 
 
     
-    
Extension Version: 3.0.0
+    
Extension Version: 3.0.1
  
 
From d476ce4a52283cd2443c1150a92dfa5b656fe23e Mon Sep 17 00:00:00 2001
From: rsbowers 
Date: Tue, 13 Oct 2020 20:21:15 -0500
Subject: [PATCH 09/15] chore: update readme
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 825703f..d52e726 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ The new 3.0 version fixes several core issues (incorrect/missing order address,
 * Enable direct Order Search by ID
 * Access Order Messages and Notes
 
-Dowload the latest version of the extension at: https://github.com/agnostack/magento_extension/releases/tag/v3.0.0.
+Dowload the latest version of the extension at: https://github.com/agnostack/magento_extension/releases/tag/v3.0.1.
 
 Additional detailed instructions on configuring agnoStack for the new version can be found at: https://agnostack.com/faqs/setup-onboarding/configuring-magento-1.
 
From f6a63d7dfeb17a508d9193542fd715cdd28e1d71 Mon Sep 17 00:00:00 2001
From: rsbowers 
Date: Wed, 14 Oct 2020 12:24:45 -0500
Subject: [PATCH 10/15] chore: remove signup button front-end post call
---
 .../Block/Adminhtml/Config/Buttons/Signup.php | 39 +------------------
 .../community/Zendesk/Zendesk/Helper/Data.php | 17 --------
 .../community/Zendesk/Zendesk/etc/config.xml  |  3 --
 .../community/Zendesk/Zendesk/etc/system.xml  |  5 ++-
 .../zendesk/config/button-signup.phtml        | 12 +-----
 5 files changed, 5 insertions(+), 71 deletions(-)
diff --git a/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Config/Buttons/Signup.php b/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Config/Buttons/Signup.php
index 95cb36d..6fc3662 100644
--- a/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Config/Buttons/Signup.php
+++ b/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Config/Buttons/Signup.php
@@ -37,48 +37,11 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
         $originalData = $element->getOriginalData();
         $this->addData(array(
             'button_label' => Mage::helper('zendesk')->__($originalData['button_label']),
+            'button_url' => Mage::helper('zendesk')->__($originalData['button_url']),
             'html_id' => $element->getHtmlId(),
             'url' => Mage::getSingleton('adminhtml/url')->getUrl('*/setup/start')
         ));
 
         return $this->_toHtml();
     }
-
-    public function getPostUrl()
-    {
-        return Mage::helper('zendesk')->getProvisionUrl();
-    }
-
-    public function getPostInfo()
-    {
-        $websiteCode = Mage::app()->getRequest()->getParam('website');
-        if ($websiteCode) {
-            $website = Mage::getModel('core/website')->load($websiteCode);
-        } else {
-            $website = Mage::getModel('core/website')->getCollection()
-                     ->addFieldToFilter('is_default', 1)
-                     ->getFirstItem();
-        }
-
-        $storeCode = Mage::app()->getRequest()->getParam('store');
-        if ($storeCode) {
-            $store = Mage::getModel('core/store')->load($storeCode);
-        } else {
-            $store = $website->getDefaultStore();
-        }
-
-        $info = array(
-            'magento_domain' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
-            'magento_current_user_id' => Mage::getSingleton('admin/session')->getUser()->getUserId(),
-            'magento_user_count' => Mage::getModel('admin/user')->getCollection()->getSize(),
-            'magento_auth_token' => Mage::helper('zendesk')->getProvisionToken(true),
-            'magento_callback' => Mage::helper('adminhtml')->getUrl('adminhtml/zendesk/redirect', array('type' => 'settings', 'id' => 'zendesk')),
-            'magento_locale' => Mage::getStoreConfig('general/locale/code'),
-            'magento_timezone' => Mage::getStoreConfig('general/locale/timezone'),
-            'magento_api_url' => Mage::getUrl('zendesk/api', array('_store' => $store->getCode())),
-            'magento_store_name' => $website->getName(),
-        );
-
-        return $info;
-    }
 }
diff --git a/src/app/code/community/Zendesk/Zendesk/Helper/Data.php b/src/app/code/community/Zendesk/Zendesk/Helper/Data.php
index c067b5d..971a4fd 100644
--- a/src/app/code/community/Zendesk/Zendesk/Helper/Data.php
+++ b/src/app/code/community/Zendesk/Zendesk/Helper/Data.php
@@ -154,23 +154,6 @@ public function setApiToken($token = null)
         return $token;
     }
 
-    /**
-     * Returns the provisioning endpoint for new setups.
-     *
-     * This uses the config/zendesk/provision_url XML path to retrieve the setting, with a default value set in
-     * the extension config.xml file. This can be overridden in your website's local.xml file.
-     * @return null|string URL or null on failure
-     */
-    public function getProvisionUrl()
-    {
-        $config = Mage::getConfig();
-        $data = $config->getNode('zendesk/provision_url');
-        if(!$data) {
-            return null;
-        }
-        return (string)$data;
-    }
-
     public function getProvisionToken($generate = false)
     {
         $token = Mage::getStoreConfig('zendesk/hidden/provision_token', 0);
diff --git a/src/app/code/community/Zendesk/Zendesk/etc/config.xml b/src/app/code/community/Zendesk/Zendesk/etc/config.xml
index 0795fa7..46437e9 100644
--- a/src/app/code/community/Zendesk/Zendesk/etc/config.xml
+++ b/src/app/code/community/Zendesk/Zendesk/etc/config.xml
@@ -22,9 +22,6 @@
             3.0.1
         
     
-    
-        https://signup.zendesk.com/provisioning/magento/welcome
-    
     
         
             
diff --git a/src/app/code/community/Zendesk/Zendesk/etc/system.xml b/src/app/code/community/Zendesk/Zendesk/etc/system.xml
index cee95d9..927b6eb 100644
--- a/src/app/code/community/Zendesk/Zendesk/etc/system.xml
+++ b/src/app/code/community/Zendesk/Zendesk/etc/system.xml
@@ -471,11 +471,12 @@
                     1
                     1
                     1
-                    
+                    Need to set up the agnoStack Zendesk plugin?
Learn More at https://agnostack.com/faqs/setup-onboarding/configure-manage-your-account.
Haven't set up Zendesk Support yet? Click below to get started.
]]>
                     
                         
                             
-                            Setup Guide
+                            Get Started
+                            https://agnostack.com/book-a-meeting
                             zendesk/adminhtml_config_buttons_signup
                             1
                             1
diff --git a/src/app/design/adminhtml/default/default/template/zendesk/config/button-signup.phtml b/src/app/design/adminhtml/default/default/template/zendesk/config/button-signup.phtml
index a738194..df2dbf2 100644
--- a/src/app/design/adminhtml/default/default/template/zendesk/config/button-signup.phtml
+++ b/src/app/design/adminhtml/default/default/template/zendesk/config/button-signup.phtml
@@ -15,16 +15,6 @@
  * limitations under the License.
  */
 ?>
-
-