From 3827ed6a2cac089e95c06aa82035df600e53bce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20B=C3=A9jean?= <nicolas@bejean.eu> Date: Sun, 28 Feb 2021 18:22:00 +0100 Subject: [PATCH] feat: Create Helper --- Helper/SendGeoLocation.php | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 Helper/SendGeoLocation.php diff --git a/Helper/SendGeoLocation.php b/Helper/SendGeoLocation.php new file mode 100755 index 0000000..7cdeb69 --- /dev/null +++ b/Helper/SendGeoLocation.php @@ -0,0 +1,45 @@ +<?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(); + } +} -- GitLab