Skip to content

Commit

Permalink
Remove api (#16)
Browse files Browse the repository at this point in the history
* Direct

* Include fortifi-api within sdk, following fortifi-api repo removal

* Specific OAuth Client
  • Loading branch information
bajb authored and TomK committed May 23, 2018
1 parent f29e19c commit 4d0471c
Show file tree
Hide file tree
Showing 171 changed files with 5,825 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
composer.lock
/vendor
index.php
135 changes: 135 additions & 0 deletions api/Affiliate/Endpoints/AffiliateActionEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php
namespace Fortifi\FortifiApi\Affiliate\Endpoints;

use Fortifi\FortifiApi\Affiliate\Payloads\Action\CreateAffiliateActionPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Action\PostActionPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Action\ReversalPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Action\SetKeyAffiliateActionPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Action\SetTypeAffiliateActionPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Action\UpdateAffiliateActionPayload;
use Fortifi\FortifiApi\Affiliate\Responses\Action\AffiliateActionResponse;
use Fortifi\FortifiApi\Affiliate\Responses\Action\AffiliateActionsResponse;
use Fortifi\FortifiApi\Affiliate\Responses\Action\CreateAffiliateActionResponse;
use Fortifi\FortifiApi\Affiliate\Responses\Action\PostActionResponse;
use Fortifi\FortifiApi\Foundation\Endpoints\AbstractFortifiEndpoint;
use Fortifi\FortifiApi\Foundation\Payloads\FidPayload;
use Fortifi\FortifiApi\Foundation\Payloads\GetByEnumPayload;
use Fortifi\FortifiApi\Foundation\Payloads\PaginatedDataNodePayload;
use Fortifi\FortifiApi\Foundation\Requests\FortifiApiRequestInterface;
use Fortifi\FortifiApi\Foundation\Responses\BoolResponse;
use Fortifi\FortifiApi\Foundation\Responses\RawArrayResponse;
use Packaged\Api\HttpVerb;

class AffiliateActionEndpoint extends AbstractFortifiEndpoint
{
protected $_path = '/affiliate/action/';

/**
* @param PaginatedDataNodePayload $payload
*
* @return FortifiApiRequestInterface|AffiliateActionsResponse
*/
public function all(PaginatedDataNodePayload $payload)
{
return self::_createRequest($payload, 'list');
}

/**
* @param string $type //AffiliateActionType
*
* @return FortifiApiRequestInterface|RawArrayResponse
*/
public function unique($type = null)
{
if($type === null)
{
return self::_createRequest(null, 'unique', HttpVerb::GET);
}
else
{
$payload = new GetByEnumPayload();
$payload->value = $type;
return self::_createRequest($payload, 'unique', HttpVerb::POST);
}
}

/**
* @param FidPayload $payload
*
* @return FortifiApiRequestInterface|AffiliateActionResponse
*/
public function retrieve(FidPayload $payload)
{
return self::_createRequest($payload, 'retrieve');
}

/**
* @param CreateAffiliateActionPayload $payload
*
* @return FortifiApiRequestInterface|CreateAffiliateActionResponse
*/
public function create(CreateAffiliateActionPayload $payload)
{
return self::_createRequest($payload, 'create');
}

/**
* @param UpdateAffiliateActionPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
*/
public function update(UpdateAffiliateActionPayload $payload)
{
return self::_createRequest($payload, 'update');
}

/**
* @param FidPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
*/
public function delete(FidPayload $payload)
{
return self::_createRequest($payload, 'delete');
}

/**
* @param SetTypeAffiliateActionPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
*/
public function setType(SetTypeAffiliateActionPayload $payload)
{
return self::_createRequest($payload, 'set-type');
}

/**
* @param SetKeyAffiliateActionPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
*/
public function setKey(SetKeyAffiliateActionPayload $payload)
{
return self::_createRequest($payload, 'set-key');
}

/**
* @param PostActionPayload $payload
*
* @return FortifiApiRequestInterface|PostActionResponse
*/
public function post(PostActionPayload $payload)
{
return self::_createRequest($payload, 'post');
}

/**
* @param ReversalPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
*/
public function reverse(ReversalPayload $payload)
{
return self::_createRequest($payload, 'reverse');
}
}
130 changes: 130 additions & 0 deletions api/Affiliate/Endpoints/AffiliatePixelEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?php
namespace Fortifi\FortifiApi\Affiliate\Endpoints;

use Fortifi\FortifiApi\Affiliate\Payloads\Pixels\CreatePixelPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Pixels\ListPixelPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Pixels\PixelApprovalPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Pixels\RetrievePendingPixelsPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Pixels\UpdatePixelPayload;
use Fortifi\FortifiApi\Affiliate\Responses\Pixels\PixelHistoriesResponse;
use Fortifi\FortifiApi\Affiliate\Responses\Pixels\PixelPoliciesResponse;
use Fortifi\FortifiApi\Affiliate\Responses\Pixels\PixelPolicyResponse;
use Fortifi\FortifiApi\Affiliate\Responses\Pixels\PixelsResponse;
use Fortifi\FortifiApi\Foundation\Endpoints\AbstractFortifiEndpoint;
use Fortifi\FortifiApi\Foundation\Exceptions\NotFoundException;
use Fortifi\FortifiApi\Foundation\Payloads\FidPayload;
use Fortifi\FortifiApi\Foundation\Payloads\ToggleFidPayload;
use Fortifi\FortifiApi\Foundation\Requests\FortifiApiRequestInterface;
use Fortifi\FortifiApi\Foundation\Responses\BoolResponse;

class AffiliatePixelEndpoint extends AbstractFortifiEndpoint
{
protected $_path = '/affiliate/pixels/';

/**
* @param ListPixelPayload $payload
*
* @return FortifiApiRequestInterface|PixelPoliciesResponse
*/
public function all(ListPixelPayload $payload)
{
return self::_createRequest($payload, 'list');
}

/**
* @param CreatePixelPayload $payload
*
* @return FortifiApiRequestInterface|PixelPolicyResponse
*/
public function create(CreatePixelPayload $payload)
{
return self::_createRequest($payload, 'create');
}

/**
* @param UpdatePixelPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
* @throws NotFoundException
*/
public function update(UpdatePixelPayload $payload)
{
return self::_createRequest($payload, 'update');
}

/**
* @param FidPayload $payload
*
* @return FortifiApiRequestInterface|PixelPolicyResponse
* @throws NotFoundException
*/
public function retrieve(FidPayload $payload)
{
return self::_createRequest($payload, 'retrieve');
}

/**
* @param PixelApprovalPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
* @throws NotFoundException
*/
public function approve(PixelApprovalPayload $payload)
{
return self::_createRequest($payload, 'approve');
}

/**
* @param FidPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
* @throws NotFoundException
*/
public function delete(FidPayload $payload)
{
return self::_createRequest($payload, 'delete');
}

/**
* @param FidPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
* @throws NotFoundException
*/
public function restore(FidPayload $payload)
{
return self::_createRequest($payload, 'restore');
}

/**
* @param FidPayload $payload
*
* @return FortifiApiRequestInterface|PixelHistoriesResponse
* @throws NotFoundException
*/
public function history(FidPayload $payload)
{
return self::_createRequest($payload, 'history');
}

/**
* @param ToggleFidPayload $payload
*
* @return FortifiApiRequestInterface|BoolResponse
* @throws NotFoundException
*/
public function setState(ToggleFidPayload $payload)
{
return self::_createRequest($payload, 'set-state');
}

/**
* @param RetrievePendingPixelsPayload $payload
*
* @return FortifiApiRequestInterface|PixelsResponse
*/
public function getPending(RetrievePendingPixelsPayload $payload)
{
return self::_createRequest($payload, 'get-pending');
}
}
35 changes: 35 additions & 0 deletions api/Affiliate/Enums/AffiliateBuiltInAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
namespace Fortifi\FortifiApi\Affiliate\Enums;

use Fortifi\FortifiApi\Foundation\Enums\AbstractFortifiEnum;

class AffiliateBuiltInAction extends AbstractFortifiEnum
{
const CLICK = 'click';
const LEAD = 'lead';
const ACQUISITION = 'acquisition';
const UPSELL = 'upsell';
const RENEWAL = 'renewal';
const REVERSAL = 'reversal';

public static function getDisplayValue($value)
{
switch($value)
{
case self::CLICK:
return 'Click';
case self::LEAD:
return 'Lead';
case self::ACQUISITION:
return 'Acquisition';
case self::UPSELL:
return 'Upsell';
case self::RENEWAL:
return 'Renewal';
case self::REVERSAL:
return 'Reversal';
default:
return $value;
}
}
}
32 changes: 32 additions & 0 deletions api/Affiliate/Enums/PixelType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
namespace Fortifi\FortifiApi\Affiliate\Enums;

use Fortifi\FortifiApi\Foundation\Enums\AbstractFortifiEnum;

final class PixelType extends AbstractFortifiEnum
{
const IFRAME = 'iframe';
const IMAGE = 'img';
const JS = 'js';
const CURL = 'curl';
const HTML = 'html';

public static function getDisplayValue($value)
{
switch($value)
{
case self::IFRAME:
return 'Inline Frame';
case self::IMAGE:
return 'Image';
case self::JS:
return 'Javascript';
case self::CURL:
return 'Curl';
case self::HTML:
return 'HTML';
default:
return $value;
}
}
}
26 changes: 26 additions & 0 deletions api/Affiliate/Enums/ReversalReason.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
namespace Fortifi\FortifiApi\Affiliate\Enums;

use Fortifi\FortifiApi\Foundation\Enums\AbstractFortifiEnum;

final class ReversalReason extends AbstractFortifiEnum
{
const CHARGEBACK = 'chargeback';
const CANCEL = 'cancel';
const FRAUD = 'fraud';

public static function getDisplayValue($value)
{
switch($value)
{
case self::CHARGEBACK:
return 'Chargeback';
case self::CANCEL:
return 'Cancellation';
case self::FRAUD:
return 'Fraud';
default:
return $value;
}
}
}
15 changes: 15 additions & 0 deletions api/Affiliate/Payloads/Action/BaseActionPayload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Fortifi\FortifiApi\Affiliate\Payloads\Action;

use Packaged\Api\Abstracts\AbstractApiPayload;

abstract class BaseActionPayload extends AbstractApiPayload
{
public $visitorId; //Known visitor ID
public $userReference; //Allocate reference to visitor id
public $data; // Random misc data
public $userAgent; //HTTP_USER_AGENT
public $language; //HTTP_ACCEPT_LANGUAGE
public $encoding; //HTTP_ACCEPT_ENCODING
public $clientIp; //REMOTE_ADDR
}
Loading

0 comments on commit 4d0471c

Please sign in to comment.