When processing a credit card through paypal ec (sandbox) without a paypal account:
Notice: Undefined index: transaction_id in commerce_paypal_ec_response_to_ipn() (line 466 of /var/www/drupal-7/sites/all/modules/commerce_paypal_ec/commerce_paypal_ec.module).
Notice: Undefined variable: transactions in commerce_paypal_ec_paypal_ipn_process() (line 551 of /var/www/drupal-7/sites/all/modules/commerce_paypal_ec/commerce_paypal_ec.module).

Despite the notices, the following was also logged IPN processed for Order 6 with ID 3S862277AN619383D.

When paying with a paypal account (sandbox):
Notice: Undefined index: PAYMENTINFO_0_RECEIPTID in commerce_paypal_ec_response_to_ipn() (line 461 of /var/www/drupal-7/sites/all/modules/commerce_paypal_ec/commerce_paypal_ec.module).
Notice: Undefined index: transaction_id in commerce_paypal_ec_response_to_ipn() (line 466 of /var/www/drupal-7/sites/all/modules/commerce_paypal_ec/commerce_paypal_ec.module).
Notice: Undefined variable: transactions in commerce_paypal_ec_paypal_ipn_process() (line 551 of /var/www/drupal-7/sites/all/modules/commerce_paypal_ec/commerce_paypal_ec.module).

Similar log enty showing the IPN processed: IPN processed for Order 5 with ID 75979379L13116211.

Both order record that the payment completed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

citlacom’s picture

Status: Active » Needs review

This should be resolved in the commit http://drupalcode.org/project/commerce_paypal_ec.git/commit/e3dd90e

I added more strong validation for the response to ensure it has the keys:

  • 'PAYMENTINFO_0_TRANSACTIONID',
  • 'PAYMENTINFO_0_TRANSACTIONTYPE',
  • 'PAYMENTINFO_0_AMT',
  • 'PAYMENTINFO_0_CURRENCYCODE',
  • 'PAYMENTINFO_0_PAYMENTSTATUS',
  • 'PAYMENTINFO_0_PAYMENTTYPE',
  • 'order_id',

That are essential to store and trace the payment notification. Please confirm if the warnings are gone.

markisatacomputer’s picture

I was having a similar problem and realized that it was because the status of my payments has been pending rather than completed or voided. Here's the error message I was getting:

Notice: Undefined variable: transactions in commerce_paypal_ec_paypal_ipn_process() (line 677 of /var/www/dev/sites/all/modules/commerce_paypal_ec/commerce_paypal_ec.module).

And here's where the problem seemed to be in commerce_paypal_ec_paypal_ipn_process starting on line 673:

if (in_array($ipn['payment_status'], array('Voided', 'Completed')) && !empty($ipn['auth_id'])) {
    $transactions = commerce_payment_transaction_load_multiple(array(), array('remote_id' => $ipn['auth_id']));
  }

My solution was simple. Just make sure $transactions isset directly underneath rather than just if ($transactions)

Worked for me. Attaching a patch but I think it may be a little off due to the fact that I am using 7.x-1.0-alpha3+6-dev and I already patched this file. Hope it's helpful!

citlacom’s picture

Status: Needs review » Closed (fixed)

Thanks @markisatacomputer I applied your patch.