Skip to content

Commit

Permalink
Merge pull request #1536 from magento-mpi/PR-Signifyd
Browse files Browse the repository at this point in the history
[MPI] Move Signifyd to CE
  • Loading branch information
viktym authored Oct 5, 2017
2 parents 9db4501 + 2cc8a1c commit 921d5f6
Show file tree
Hide file tree
Showing 196 changed files with 16,525 additions and 119 deletions.
29 changes: 29 additions & 0 deletions app/code/Magento/Signifyd/Api/CaseCreationServiceInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Signifyd\Api;

/**
* Signifyd case creation interface
*
* Interface of service for new Signifyd case creation and registering it on Magento side.
* Implementation should send request to Signifyd API and create new entity in Magento.
*
* @api
* @since 100.2.0
*/
interface CaseCreationServiceInterface
{
/**
* Create new case for order with specified id.
*
* @param int $orderId
* @return bool
* @throws \Magento\Framework\Exception\NotFoundException If order does not exists
* @throws \Magento\Framework\Exception\AlreadyExistsException If case for $orderId already exists
* @since 100.2.0
*/
public function createForOrder($orderId);
}
36 changes: 36 additions & 0 deletions app/code/Magento/Signifyd/Api/CaseManagementInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Signifyd\Api;

/**
* Signifyd management interface
* Allows to performs operations with Signifyd cases.
*
* @api
* @since 100.2.0
*/
interface CaseManagementInterface
{
/**
* Creates new Case entity linked to order id.
*
* @param int $orderId
* @return \Magento\Signifyd\Api\Data\CaseInterface
* @throws \Magento\Framework\Exception\NotFoundException If order does not exists
* @throws \Magento\Framework\Exception\AlreadyExistsException If case for $orderId already exists
* @since 100.2.0
*/
public function create($orderId);

/**
* Gets Case entity associated with order id.
*
* @param int $orderId
* @return \Magento\Signifyd\Api\Data\CaseInterface|null
* @since 100.2.0
*/
public function getByOrderId($orderId);
}
60 changes: 60 additions & 0 deletions app/code/Magento/Signifyd/Api/CaseRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Signifyd\Api;

/**
* Signifyd Case repository interface
*
* @api
* @since 100.2.0
*/
interface CaseRepositoryInterface
{
/**
* Saves case entity.
*
* @param \Magento\Signifyd\Api\Data\CaseInterface $case
* @return \Magento\Signifyd\Api\Data\CaseInterface
* @since 100.2.0
*/
public function save(\Magento\Signifyd\Api\Data\CaseInterface $case);

/**
* Gets case entity by order id.
*
* @param int $id
* @return \Magento\Signifyd\Api\Data\CaseInterface
* @since 100.2.0
*/
public function getById($id);

/**
* Gets entity by Signifyd case id.
*
* @param int $caseId
* @return \Magento\Signifyd\Api\Data\CaseInterface|null
* @since 100.2.0
*/
public function getByCaseId($caseId);

/**
* Deletes case entity.
*
* @param \Magento\Signifyd\Api\Data\CaseInterface $case
* @return bool
* @since 100.2.0
*/
public function delete(\Magento\Signifyd\Api\Data\CaseInterface $case);

/**
* Gets list of case entities.
*
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
* @return \Magento\Signifyd\Api\Data\CaseSearchResultsInterface
* @since 100.2.0
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
}
235 changes: 235 additions & 0 deletions app/code/Magento/Signifyd/Api/Data/CaseInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Signifyd\Api\Data;

use Magento\Signifyd\Model\SignifydGateway\Gateway;

/**
* Signifyd Case entity interface
*
* @api
* @see https://www.signifyd.com/docs/api/#/reference/cases/retrieve-a-case/get-a-case
* @since 100.2.0
*/
interface CaseInterface
{
/**#@+
* Constants for case available statuses
*/
const STATUS_OPEN = Gateway::STATUS_OPEN;
const STATUS_PENDING = 'PENDING';
const STATUS_PROCESSING = Gateway::STATUS_PROCESSING;
const STATUS_FLAGGED = Gateway::STATUS_FLAGGED;
const STATUS_DISMISSED = Gateway::STATUS_DISMISSED;
/**#@-*/

/**#@+
* Constants for guarantee available statuses
*/
const GUARANTEE_APPROVED = Gateway::GUARANTEE_APPROVED;
const GUARANTEE_DECLINED = Gateway::GUARANTEE_DECLINED;
const GUARANTEE_PENDING = Gateway::GUARANTEE_PENDING;
const GUARANTEE_CANCELED = Gateway::GUARANTEE_CANCELED;
const GUARANTEE_IN_REVIEW = Gateway::GUARANTEE_IN_REVIEW;
const GUARANTEE_UNREQUESTED = Gateway::GUARANTEE_UNREQUESTED;
/**#@-*/

/**#@+
* Constants for case available review dispositions
*/
const DISPOSITION_GOOD = Gateway::DISPOSITION_GOOD;
const DISPOSITION_FRAUDULENT = Gateway::DISPOSITION_FRAUDULENT;
const DISPOSITION_UNSET = Gateway::DISPOSITION_UNSET;
/**#@-*/

/**
* Returns local case entity identifier.
*
* @return int
* @since 100.2.0
*/
public function getEntityId();

/**
* Sets local case entity id.
*
* @param int $id
* @return $this
* @since 100.2.0
*/
public function setEntityId($id);

/**
* Returns Signifyd case identifier.
*
* @return int
* @since 100.2.0
*/
public function getCaseId();

/**
* Sets Signifyd case id.
*
* @param int $id
* @return $this
* @since 100.2.0
*/
public function setCaseId($id);

/**
* Returns value, which indicates if a guarantee can be requested for a case.
* Returns null if state of guarantee eligible does not set yet.
*
* @return boolean|null
* @since 100.2.0
*/
public function isGuaranteeEligible();

/**
* Sets value-indicator about guarantee availability for a case.
*
* @param bool $guaranteeEligible
* @return $this
* @since 100.2.0
*/
public function setGuaranteeEligible($guaranteeEligible);

/**
* Returns decision state of the guarantee.
*
* @return string
* @since 100.2.0
*/
public function getGuaranteeDisposition();

/**
* Sets decision state of the guarantee.
*
* @param string $disposition
* @return $this
* @since 100.2.0
*/
public function setGuaranteeDisposition($disposition);

/**
* Returns case status.
*
* @return string
* @since 100.2.0
*/
public function getStatus();

/**
* Sets case status.
*
* @param string $status
* @return $this
* @since 100.2.0
*/
public function setStatus($status);

/**
* Returns value, which indicates the likelihood that the order is fraud.
*
* @return int
* @since 100.2.0
*/
public function getScore();

/**
* Sets risk level value.
*
* @param int $score
* @return $this
* @since 100.2.0
*/
public function setScore($score);

/**
* Get order id for a case.
*
* @return int
* @since 100.2.0
*/
public function getOrderId();

/**
* Sets order id for a case.
*
* @param int $orderId
* @return $this
* @since 100.2.0
*/
public function setOrderId($orderId);

/**
* Returns data about a team associated with a case.
*
* @return array
* @since 100.2.0
*/
public function getAssociatedTeam();

/**
* Sets team data associated with a case.
*
* @param array $team
* @return $this
* @since 100.2.0
*/
public function setAssociatedTeam(array $team);

/**
* Returns disposition of an agent's opinion after reviewing the case.
*
* @return string
* @since 100.2.0
*/
public function getReviewDisposition();

/**
* Sets case disposition.
*
* @param string $disposition
* @return $this
* @since 100.2.0
*/
public function setReviewDisposition($disposition);

/**
* Returns creation datetime for a case.
*
* @return string
* @since 100.2.0
*/
public function getCreatedAt();

/**
* Sets creation datetime for a case.
*
* @param string $datetime in DATE_ATOM format
* @return $this
* @since 100.2.0
*/
public function setCreatedAt($datetime);

/**
* Returns updating datetime for a case.
*
* @return string
* @since 100.2.0
*/
public function getUpdatedAt();

/**
* Sets updating datetime for a case.
*
* @param string $datetime in DATE_ATOM format
* @return $this
* @since 100.2.0
*/
public function setUpdatedAt($datetime);
}
34 changes: 34 additions & 0 deletions app/code/Magento/Signifyd/Api/Data/CaseSearchResultsInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Signifyd\Api\Data;

use Magento\Framework\Api\SearchResultsInterface;

/**
* Retrieve and set list of case entities.
*
* @api
* @since 100.2.0
*/
interface CaseSearchResultsInterface extends SearchResultsInterface
{
/**
* Gets collection of case entities.
*
* @return \Magento\Signifyd\Api\Data\CaseInterface[]
* @since 100.2.0
*/
public function getItems();

/**
* Sets collection of case entities.
*
* @param \Magento\Signifyd\Api\Data\CaseInterface[] $items
* @return $this
* @since 100.2.0
*/
public function setItems(array $items);
}
Loading

0 comments on commit 921d5f6

Please sign in to comment.