Question

If you look at the "Payment Information" Tab of an order, you can see some details if it was paid with paypal like the "Payer Status"(Is the paypal verified?) or the email of the PayPal Account.
Example of PayPal payment information

I'd like to get this informations programatically in an observer(where I have an $order), so I first looked at the fields of the $order: There is the ["additional_information"]["paypal_payer_status"] in the protected _data array, so I could possibly get it by using Reflection(maybe not so good)

I tried also using the PayPal classes: app/code/core/Mage/Paypal/Model/info.php has a Method
public function getPaymentInfo(Mage_Payment_Model_Info $payment, $labelValuesOnly = false) which could probably provide the informations, but I was unable to create an instance of the class Mage_Paypal_Model_Info(has no constructer) containing this method(I guess the class isnt included/required while the code runs)

So I`d like to ask how to fix that or get the informations by a maybe more clean way.


Was it helpful?

Solution

To get the model Mage_Paypal_Model_Info you should be able to call Mage::getModel('paypal/info').

Have a look at Mage_Paypal_Block_Payment_Info::_prepareSpecificInformation(), as this method appears to use the function that you desire:

protected function _prepareSpecificInformation($transport = null)
{
    $transport = parent::_prepareSpecificInformation($transport);
    $payment = $this->getInfo();
    $paypalInfo = Mage::getModel('paypal/info');
    if (!$this->getIsSecureMode()) {
        $info = $paypalInfo->getPaymentInfo($payment, true);
    } else {
        $info = $paypalInfo->getPublicPaymentInfo($payment, true);
    }

    return $transport->addData($info);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top