/** * Formats an array in preparation for dispatch to a STOMP queue * * @return array Pass this return array to STOMP :) * * TODO: Stop saying "STOMP". */ protected function getStompTransaction() { $transaction = array('gateway_txn_id' => $this->getTransactionGatewayTxnID(), 'response' => $this->getTransactionMessage(), 'correlation-id' => $this->getCorrelationID(), 'php-message-class' => 'SmashPig\\CrmLink\\Messages\\DonationInterfaceMessage', 'gateway_account' => $this->account_name); // Add the rest of the relevant data // FIXME: This is "normalized" data. We should refer to it as such, // and rename the getData_Unstaged_Escaped function. $stomp_data = array_intersect_key($this->getData_Unstaged_Escaped(), array_flip($this->dataObj->getMessageFields())); // The order here is important, values in $transaction are considered more definitive // in case the transaction already had keys with those values $transaction = array_merge($stomp_data, $transaction); // FIXME: Note that we're not using any existing date or ts fields. Why is that? $transaction['date'] = time(); // Force any incorrect encoding to UTF-8. // FIXME: Move down to the PHP-Queue library $transaction = Encoding::toUTF8($transaction); return $transaction; }