Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
SendGeoLocation.php 1.25 KiB
Newer Older
  • Learn to ignore specific revisions
  • Nicolas's avatar
    Nicolas committed
    <?php
    namespace NicolasBejean\Customer\Helper;
    
    use Magento\Customer\Api\Data\AddressInterface;
    use Magento\Customer\Api\Data\CustomerInterface;
    use Magento\Framework\App\Helper\AbstractHelper;
    use Magento\Framework\App\Helper\Context;
    
    /**
     * Class SendGeoLocation
     *
     * @category PHP
     * @package  NicolasBejean\Customer\Helper
     * @author   Nicolas Béjean <nicolas@bejean.eu>
     * @license  https://lab.frogg.it/bejean-developpement/magento-2/modules/customer/-/blob/master/LICENCE GPL3 Licence
     * @link     https://www.bejean.eu
     */
    class SendGeoLocation extends AbstractHelper
    {
        /**
         * SendGeoLocation constructor.
         * @param Context $context
         */
        public function __construct(
            Context $context
        ) {
            parent::__construct($context);
        }
    
        public function sendDataToApi(CustomerInterface $customer, AddressInterface $address)
        {
            $createdAt = $customer->getCreatedAt();
            $updatedAt = $customer->getUpdatedAt();
    
            $websiteId = $customer->getWebsiteId();
            $storeId = $customer->getStoreId();
    
            $customerId = $customer->getId();
            $groupId = $customer->getGroupId();
    
            $country = $address->getCountryId();
            $city = $address->getCity();
            $postCode = $address->getPostcode();
        }
    }