1

I have created a custom Magento module to check banned customers coming from Paypal and I overridden returnfromPaypal function:

    public function returnFromPaypal($token)
{
    $this->_getApi();
    $this->_api->setToken($token)->callGetExpressCheckoutDetails();

    // import billing address
    $billingAddress = $this->_quote->getBillingAddress();
    $exportedBillingAddress = $this->_api->getExportedShippingAddress();

        foreach ($exportedBillingAddress->getExportedKeys() as $key) {

            if (array_key_exists($key, $dataOrg))
            {                   
                $billingAddress->setData($key, $dataOrg[$key]);

            }
        }
        $this->_quote->setBillingAddress($billingAddress);

    if( $this->isCustomerBanned( $this->_quote->getBillingAddress()->getEmail() ) )
        {
             Mage::throwException(Mage::helper('paypal')->__('Sorry!, We cant process you order this time.'));
        }
        else
        {
            parent::returnFromPaypal($token);

        }

}

But the problem is when the $billingAddress is saved for the first time in the quote $this->_quote->getBillingAddress()->getEmail() will be blank.

I want to know if there is another way to get customer email directly from $exportedBillingAddress I searched for documentation for it but nothing found. Thanks in advance

1

How about using the customer email address set against the quote.

$this->_quote->getCustomerEmail()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.