backwards comp.

This commit is contained in:
Mike Jolley 2012-08-10 14:12:00 +01:00
parent 277c55d596
commit 59e6cf9d51
1 changed files with 9 additions and 2 deletions

View File

@ -521,11 +521,18 @@ class WC_Paypal extends WC_Payment_Gateway {
// Custom holds post ID
if ( !empty($posted['invoice']) && !empty($posted['custom']) ) {
$order_id = (int) str_replace( $this->invoice_prefix, '', $posted['invoice'] );
// Backwards comp for IPN requests
if ( is_numeric( $posted['custom'] ) ) {
$order_id = $posted['custom'];
$order_key = $posted['invoice'];
} else {
$order_id = (int) str_replace( $this->invoice_prefix, '', $posted['invoice'] );
$order_key = $posted['custom'];
}
$order = new WC_Order( $order_id );
if ($order->order_key!==$posted['custom']) :
if ( $order->order_key !== $order_key ) :
if ($this->debug=='yes') $this->log->add( 'paypal', 'Error: Order Key does not match invoice.' );
exit;
endif;