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
ModelAddress.php 966 B
Newer Older
<?php
namespace NicolasBejean\Customer\Plugin;

use NicolasBejean\Customer\Helper\SendGeoLocation;

/**
 * Class ModelAddress
 *
 * @category PHP
 * @package  NicolasBejean\Customer\Plugin
 * @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 ModelAddress
{
    /**
     * @var SendGeoLocation
     */
    private SendGeoLocation $helper;

    /**
     * ModelAddress constructor.
     *
     * @param SendGeoLocation $helper
     */
    public function __construct(
        SendGeoLocation $helper
    ) {
        $this->helper = $helper;
    }

    /**
     * @param \Magento\Customer\Model\Address $subject
     */
    public function afterSave(\Magento\Customer\Model\Address $subject)
    {
        $customer = $subject->getCustomer();

        $this->helper->sendDataToApi($customer, $subject);
    }
}