示例#1
0
 /**
  * @param $caseData
  * @return bool
  */
 public function postCaseToSignifyd($caseData, $order)
 {
     $this->_logger->request("Sending: " . json_encode($caseData));
     $id = $this->_api->createCase($caseData);
     if ($id) {
         $this->_logger->debug("Case sent. Id is {$id}");
     } else {
         $this->_logger->error("Case failed to send.");
         return false;
     }
     return $id;
 }
示例#2
0
 /**
  * Main Retry Method to start retry cycle
  */
 public function retry()
 {
     $this->_logger->request("Main retry method called");
     // Getting all the cases that were not submitted to Signifyd
     $waitingCases = $this->caseRetryObj->getRetryCasesByStatus(CaseRetry::WAITING_SUBMISSION_STATUS);
     foreach ($waitingCases as $case) {
         $this->_logger->request("Signifyd: preparing for send case no: {$case['order_increment']}");
         $order = $this->_objectManager->get('Magento\\Sales\\Model\\Order')->loadByIncrementId($case['order_increment']);
         $caseData = $this->_helper->processOrderData($order);
         $result = $this->_helper->postCaseToSignifyd($caseData, $order);
         if ($result) {
             $caseObj = $this->_objectManager->create('Signifyd\\Connect\\Model\\Casedata')->load($case->getOrderIncrement())->setCode($result)->setMagentoStatus(CaseRetry::IN_REVIEW_STATUS)->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
             $caseObj->save();
         }
     }
     // Getting all the cases that are awaiting review from Signifyd
     $inReviewCases = $this->caseRetryObj->getRetryCasesByStatus(CaseRetry::IN_REVIEW_STATUS);
     foreach ($inReviewCases as $case) {
         $this->_logger->request("Signifyd: preparing for review case no: {$case['order_increment']}");
         $order = $this->_objectManager->get('Magento\\Sales\\Model\\Order')->loadByIncrementId($case['order_increment']);
         $result = $this->caseRetryObj->processInReviewCase($case, $order);
         if ($result) {
         }
     }
     // Getting all the cases that need processing after the response was received
     $inProcessingCases = $this->caseRetryObj->getRetryCasesByStatus(CaseRetry::PROCESSING_RESPONSE_STATUS);
     foreach ($inProcessingCases as $case) {
         $this->_logger->request("Signifyd: preparing for review case no: {$case['order_increment']}");
         $order = $this->_objectManager->get('Magento\\Sales\\Model\\Order')->loadByIncrementId($case['order_increment']);
         $this->caseRetryObj->processResponseStatus($case, $order);
     }
     $this->_logger->request("Main retry method ended");
     return;
 }