Class reference - 2Parale/2Performant-php GitHub Wiki

Here is a list of classes and their methods

TPerformant\API\HTTP\User

Abstract superclass for Advertiser and Affiliate classes

User::__construct($email, $password)

Receives and stores authorization credentials for future requests

$user = new TPerformant\API\HTTP\User(email, $password);

TPerformant\API\HTTP\Advertiser (extends User)

Request container for advertiser methods

Advertiser::getPrograms($filter, $sort)

Gets a list of affiliate program for the Advertiser to see. $filter and $sort are both optional params.

$programs = $advertiser->getPrograms();
$fashionPrograms = $advertiser->getPrograms(
    (new AdvertiserProgramFilter)->category('Fashion')->page(2),
    (new AdvertiserProgramSort)->clickCountDesc()
);

Advertiser::getProgram($id)

Gets details about a certain affiliate program. $id is the program ID or slug

$program2 = $advertiser->getProgram(2);
$programX = $advertiser->getProgram('programx-com');

Advertiser::getMyProgram()

Gets details about the advertiser's own affiliate program.

$myProgramInfo = $advertiser->getMyProgram();

Advertiser::getCommissions($filter, $sort)

Gets a list of commissions belonging to the requesting Advertiser. $filter and $sort are both optional params.

$myCommissions = $advertiser->getCommissions();
$myRejectedCommissions = $advertiser->getCommissions(
    (new AdvertiserCommissionFilter)->status('rejected')->page(8),
    (new AdvertiserCommissionSort)->amountDesc()
);

Advertiser::getCommission($id)

Gets details about a certain commission. $id is the commission internal ID

$commission = $advertiser->getCommission(232);
$commission->accept();

Advertiser::getTransaction($id)

Gets details about commissions that containt the given transaction ID. $id is the searched transaction ID Partial search is used in the transaction ID field.

$commissions = $advertiser->getTransaction('order1235');
foreach($commissions as $c) {
    if($c->getStatus() == 'pending' && $c->getTransactionId() == 'order1235')
        $c->reject();
}

Advertiser::createCommission($affiliate, $amount, $description)

Grants a manual commission to an affiliate. The amount is in EUR.

$commission = $advertiser->createCommission(5245, 48.14, 'Performance bonus');

Advertiser::editCommission($id, $reason, $newAmount, $newDescription)

Edits a commission. $id is the commission internal ID. A $reason must be provided. The $newAmount is either the amount in EUR, or an associative array (or object) with the following structure.

$newAmount = array( 'amount' => 12.34, 'currencyCode' => 'USD' );

$newDescription is optional

$commission = $advertiser->editCommission(5489, 'Customer wanted another product`, ['amount' => 14.33, 'currencyCode' => 'RON'], '1 x Playstation 4 Ultimate edition');

Advertiser::acceptCommission($id, $reason)

Accepts a commission. $id is the commission internal ID. $reason is optional.

$commission = $advertiser->acceptCommission(4135);

Advertiser::rejectCommission($id, $reason)

Accepts a commission. $id is the commission internal ID. $reason must be provided.

$commission = $advertiser->rejectCommission(4135, 'Order cancelled');

Advertiser::getQuicklink($url, $affiliate)

Generates a quicklink for the specified $affiliate in the Advertiser's own program. $affiliate can be a string unique code or an TPerformant\API\Model\Affiliate object.

$url = $advertiser->getQuicklink('http://mysuperstore.com/', '1da3e4456');

TPerformant\API\HTTP\Affiliate

Request container for affiliate methods

Affiliate::getPrograms($filter, $sort)

Gets a list of affiliate program for the Affiliate to see. $filter and $sort are both optional params.

$programs = $affiliate->getPrograms();
$fashionPrograms = $affiliate->getPrograms(
    (new AffiliateProgramFilter)->category('Fashion')->page(2),
    (new AffiliateProgramSort)->clickCountDesc()
);

Affiliate::getProgram($id)

Gets details about a certain affiliate program. $id is the program ID or slug

$program2 = $affiliate->getProgram(2);
$programX = $affiliate->getProgram('programx-com');

Affiliate::getRequest($id)

Gets details about a certain affiliate request to promote a program. $id is the program ID or slug

$program2Request = $affiliate->getRequest(2);
$programXRequest = $affiliate->getRequest('programx-com');

Affiliate::getCommissions($filter, $sort)

Gets a list of commissions generated by the requesting Affiliate. $filter and $sort are both optional params.

$myCommissions = $affiliate->getCommissions();
$myRejectedCommissions = $affiliate->getCommissions(
    (new AffiliateCommissionFilter)->status('rejected')->page(8),
    (new AffiliateCommissionSort)->amountDesc()
);

Affiliate::getProductFeeds($filter)

Gets all of the product feeds in the programs that the requesting Affiliate is accepted in. $filter is optional.

$feeds = $affiliate->getProductFeeds();
$feedsInProgramX = $affiliate->getProductFeeds(
    (new AffiliateProductFeedFilter)->programId(14)->page(8)
);

Affiliate::getProducts($feedId, $filter, $sort)

Gets all of the product in a certain advertiser product feed. $filter and $sort are both optional params.

$toys = $affiliate->getProducts(59,
    (new AffiliateProductFilter)->category('Toys')->perpage(100),
    (new AffiliateProductSort)->priceAsc()
);

Affiliate::getBanners($filter, $sort)

Gets all of the banners in programs that the requesting Affiliate has access to. $filter and $sort are both optional params.

$banners = $affiliate->getBanners(
    (new AffiliateBannerFilter)->dimensions('300x250'),
    (new AffiliateBannerSort)->actionsDesc()
);

Affiliate::getPromotions($filter)

Gets advertiser promotions, either from programs that the requesting Affiliate works with, or all of them. $filter and $sort are both optional params.

$promotions = $affiliate->getPromotions(
    (new AffiliateAdvertiserPromotionFilter)->affrequestStatus('accepted'),
    (new AffiliateAdvertiserPromotionSort)->promotionStartDesc()
);

Affiliate::getQuicklink($url, $program)

Generates a quicklink for the requesting Affiliate in the specified $program. The $program can be a string unique code or a TPerformant\API\Model\Program object.

$program = $affiliate->getProgram('superadvertiser-com');
$banners = $affiliate->getBanners('http://superadvertiser.com/', $program);