if (!is_array($parameters)) {
throw new CRM_Core_Exception('Invalid input parameters');
}
+ // some times the essential GET parameters got lost in IPN response,
+ // so fetch those variable from json encoded 'custom' parameter to provide data integritiy
+ elseif (CRM_Utils_Array::value('custom', $parameters)) {
+ $customParams = (array) json_decode($parameters['custom']);
+ $params = array_merge($customParams, $params);
+ }
$this->_inputParameters = $parameters;
}
}
$paymentProcessorID = $this->retrieve('processor_id', 'Integer', FALSE);
- if (!empty($paymentProcessorID)) {
+ if (empty($paymentProcessorID)) {
$processorParams = array(
'user_name' => $this->retrieve('receiver_email', 'String', FALSE),
'payment_processor_type_id' => CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType', 'PayPal_Standard', 'id', 'name'),
TRUE, NULL, FALSE
);
+ $customParams = array_merge($notifyParameters, array(
+ 'accountingCode' => CRM_Utils_Array::value('accountingCode', $params),
+ ));
$paypalParams = array(
'business' => $this->_paymentProcessor['user_name'],
'notify_url' => $notifyURL,
'invoice' => $params['invoiceID'],
'lc' => substr($config->lcMessages, -2),
'charset' => function_exists('mb_internal_encoding') ? mb_internal_encoding() : 'UTF-8',
- 'custom' => CRM_Utils_Array::value('accountingCode', $params),
+ 'custom' => json_encode($customParams),
'bn' => 'CiviCRM_SP',
);