public function testDeleteMessage() { DonationQueue::instance()->set($this->transaction['correlation-id'], $this->transaction, $this->queue_name); $this->assertEquals($this->expected_message, DonationQueue::instance()->get($this->transaction['correlation-id'], $this->queue_name)); DonationQueue::instance()->delete($this->transaction['correlation-id'], $this->queue_name); $this->assertNull(DonationQueue::instance()->get($this->transaction['correlation-id'], $this->queue_name)); }
/** * Singleton entrypoint * * @return DonationQueue */ public static function instance() { if (!self::$instance) { self::$instance = new DonationQueue(); } return self::$instance; }
/** * Queue a message with the banner history ID sent on the URL, the * contribution tracking ID from DonationData, and some additional data. */ protected function queueAssociationOfIds() { $this->logger->debug('BannerHistoryLogIdProcessor::queueAssociationOfIds(): will ' . 'push to banner-history queue if required info is available.'); $bannerHistoryId = WmfFramework::getRequestValue(self::BANNER_HISTORY_LOG_ID_PARAM, null); // Campaigns may not have banner history enabled. For now, at least, // bow out silently if no banner history ID was sent. if (!$bannerHistoryId) { return; } $contributionTrackingId = $this->gatewayAdapter->getData_Unstaged_Escaped('contribution_tracking_id'); if (!$contributionTrackingId) { $this->logger->info('No contribution tracking ID for ' . 'banner-history queue ' . $bannerHistoryId . '.'); return; } $data = array('freeform' => true, 'banner_history_id' => $bannerHistoryId, 'contribution_tracking_id' => $contributionTrackingId); $this->logger->info('Pushing to banner-history queue.'); DonationQueue::instance()->push($data, 'banner-history'); }
/** * Send a message to the antifraud queue * * @param string $validationAction * @param float $totalScore * @param array $scoreBreakdown */ protected function sendAntifraudMessage($validationAction, $totalScore, $scoreBreakdown) { //add a message to the fraud stats queue, so we can shovel it into the fredge. $stomp_msg = array('validation_action' => $validationAction, 'risk_score' => $totalScore, 'score_breakdown' => $scoreBreakdown, 'php-message-class' => 'SmashPig\\CrmLink\\Messages\\DonationInterfaceAntifraud', 'user_ip' => $this->gateway_adapter->getData_Unstaged_Escaped('user_ip')); //If we need much more here to help combat fraud, we could just //start stuffing the whole maxmind query in the fredge, too. //Legal said ok... but this seems a bit excessive to me at the //moment. $transaction = $this->gateway_adapter->makeFreeformStompTransaction($stomp_msg); // In the rare case that we fraud-fail before we have an order ID, use ct_id if (empty($transaction['order_id'])) { $transaction['order_id'] = $transaction['contribution_tracking_id']; $this->fraud_logger->info("Message had no order id, using ct_id '{$transaction['contribution_tracking_id']}'"); } try { $this->fraud_logger->info('Pushing transaction to payments-antifraud queue.'); DonationQueue::instance()->push($transaction, 'payments-antifraud'); } catch (Exception $e) { $this->fraud_logger->error('Unable to send payments-antifraud message'); } }
protected function sendPendingMessage() { $order_id = $this->getData_Unstaged_Escaped('order_id'); $this->logger->info("Sending donor details for {$order_id} to pending queue"); DonationQueue::instance()->push($this->getStompTransaction(), 'pending'); }