Skip to content

Commit

Permalink
Merge branch '3.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ébano Penha Andrello Lopes committed Apr 5, 2019
2 parents a8f52c1 + 1cfeac3 commit b4020b2
Show file tree
Hide file tree
Showing 43 changed files with 434 additions and 340 deletions.
12 changes: 6 additions & 6 deletions Api/PaymentVerificationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ interface PaymentVerificationInterface
* Must return desired data. This is the event that is called from outside
* Throws an exception if provided payment method is different to verification implementation.
*
* @param OrderPaymentInterface $orderPayment
* @param \Magento\Sales\Model\Order $order
* @return string
* @throws \InvalidArgumentException
*/
public function getData(\Magento\Sales\Api\Data\OrderPaymentInterface $orderPayment);
public function getData(\Magento\Sales\Model\Order $order);

/**
* Actually gets data from payment method
* Throws an exception if provided payment method is different to verification implementation.
*
* @param OrderPaymentInterface $orderPayment
* @param \Magento\Sales\Model\Order $order
* @return string
* @throws \InvalidArgumentException
*/
public function getPaymentData(\Magento\Sales\Api\Data\OrderPaymentInterface $orderPayment);
public function getPaymentData(\Magento\Sales\Model\Order $order);

/**
* Compatibility with Magento built in PaymentVerificationInterface
*
* @param OrderPaymentInterface $orderPayment
* @param \Magento\Sales\Model\Order $order
* @return string
* @throws \InvalidArgumentException
*/
public function getCode(\Magento\Sales\Api\Data\OrderPaymentInterface $orderPayment);
public function getCode(\Magento\Sales\Model\Order $order);
}
29 changes: 10 additions & 19 deletions Cron/RetryCaseJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Signifyd\Connect\Logger\Logger;
use Signifyd\Connect\Helper\PurchaseHelper;
use Signifyd\Connect\Helper\Retry;
use Signifyd\Connect\Model\CaseRetry;
use Signifyd\Connect\Model\Casedata;

class RetryCaseJob
{
Expand Down Expand Up @@ -51,26 +51,17 @@ public function __construct(
* Entry point to Cron job
* @return $this
*/
public function execute() {
$this->logger->debug("Starting retry job");
$this->retry();
return $this;
}

/**
* Main Retry Method to start retry cycle
*/
public function retry()
public function execute()
{
$this->logger->debug("Main retry method called");

/**
* Getting all the cases that were not submitted to Signifyd
*/
$waitingCases = $this->caseRetryObj->getRetryCasesByStatus(CaseRetry::WAITING_SUBMISSION_STATUS);
$waitingCases = $this->caseRetryObj->getRetryCasesByStatus(Casedata::WAITING_SUBMISSION_STATUS);

foreach ($waitingCases as $case) {
$this->logger->debug("Signifyd: preparing for send case no: {$case['order_increment']}");
$this->logger->debug("Signifyd: preparing for send case no: {$case['order_increment']}", array('entity' => $case));

$order = $this->getOrder($case['order_increment']);

Expand All @@ -82,7 +73,7 @@ public function retry()
$caseObj = $this->_objectManager->create('Signifyd\Connect\Model\Casedata')
->load($case->getOrderIncrement())
->setCode($result)
->setMagentoStatus(CaseRetry::IN_REVIEW_STATUS)
->setMagentoStatus(Casedata::IN_REVIEW_STATUS)
->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
$caseObj->save();
}
Expand All @@ -91,28 +82,28 @@ public function retry()
/**
* Getting all the cases that are awaiting review from Signifyd
*/
$inReviewCases = $this->caseRetryObj->getRetryCasesByStatus(CaseRetry::IN_REVIEW_STATUS);
$inReviewCases = $this->caseRetryObj->getRetryCasesByStatus(Casedata::IN_REVIEW_STATUS);

foreach ($inReviewCases as $case) {
$this->logger->debug("Signifyd: preparing for review case no: {$case['order_increment']}");
$this->logger->debug("Signifyd: preparing for review case no: {$case['order_increment']}", array('entity' => $case));

$this->caseRetryObj->processInReviewCase($case, $this->getOrder($case['order_increment']));
}

/**
* Getting all the cases that need processing after the response was received
*/
$inProcessingCases = $this->caseRetryObj->getRetryCasesByStatus(CaseRetry::PROCESSING_RESPONSE_STATUS);
$inProcessingCases = $this->caseRetryObj->getRetryCasesByStatus(Casedata::PROCESSING_RESPONSE_STATUS);

foreach ($inProcessingCases as $case) {
$this->logger->debug("Signifyd: preparing for review case no: {$case['order_increment']}");
$this->logger->debug("Signifyd: preparing for review case no: {$case['order_increment']}", array('entity' => $case));

$this->caseRetryObj->processResponseStatus($case, $this->getOrder($case['order_increment']));
}

$this->logger->debug("Main retry method ended");

return;
return $this;
}

public function getOrder($incrementId)
Expand Down
Loading

0 comments on commit b4020b2

Please sign in to comment.