PHP code example of boolxy / trendyol

1. Go to this page and download the library: Download boolxy/trendyol library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

boolxy / trendyol example snippets


use Boolxy\Trendyol\Trendyol;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->getBrands();

use Boolxy\Trendyol\Trendyol;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->getBrandsByName("TRENDYOL");

use Boolxy\Trendyol\Trendyol;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->getCategories();

use Boolxy\Trendyol\Trendyol;

$categoryId = 387;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->getAttributes($categoryId);

use Boolxy\Trendyol\Trendyol;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->getProviders();

use Boolxy\Trendyol\Trendyol;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->getSuppliersAddresses();

use Boolxy\Trendyol\Trendyol;

$batchRequestId = '5631d1a1-ec81-496f-9407-99876554433-1529820717';

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->getBatchRequestResult($batchRequestId);

use Boolxy\Trendyol\Trendyol;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->getProducts();

use Boolxy\Trendyol\Trendyol;                          
use Boolxy\Trendyol\Enums\DateQueryType;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->gettingProducts()
    ->dateQueryType(DateQueryType::create(DateQueryType::LAST_MODIFIED_DATE))
    ->barcode('XXX')
    ->page(1)
    ->size(50)
    // ...
    ->get();

use Boolxy\Trendyol\Trendyol;                      

$items = [
    [
        "barcode" => "8680000000",
        "quantity" => 100,
        "salePrice" => 112.85,
        "listPrice" => 113.85, 
    ],
    // ...
];

$service = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->updatingPriceAndInventory();

foreach($items as $item) {
    $service->addItem(
        $item["barcode"],
        $item["quantity"],
        $item["salePrice"],
        $item["listPrice"]
    );
}

$results = $service->update();

use Boolxy\Trendyol\Trendyol;
use Boolxy\Trendyol\Models\Product;

$attributes = [ /* ... */ ];

$product1 = new Product($attributes);

$items = [
    $product1,
    // ...
];

$service = Trendyol::create($user, $pass, $supplier_id)
    ->productService()
    ->creatingProducts();

foreach($items as $item) {
    $service->addProduct($item);
}

$result = $service->create();

use Boolxy\Trendyol\Trendyol;
use Boolxy\Trendyol\Enums\ShipmentOrderBy;
use Boolxy\Trendyol\Enums\ShipmentStatus;
use Boolxy\Trendyol\Enums\OrderByDirection;

$results = Trendyol::create($user, $pass, $supplier_id)
    ->orderService()
    ->gettingShipmentPackages()
    ->status(ShipmentStatus::create(ShipmentStatus::DELIVERED))
    ->orderByField(ShipmentOrderBy::create(ShipmentOrderBy::PACKAGE_LAST_MODIFIED_DATE))
    ->orderByDirection(OrderByDirection::create(OrderByDirection::DESC))
    ->page(1)
    ->size(10)
    // ...
    ->get();

use Boolxy\Trendyol\Trendyol;

$shipmentPackageId = 11650604;
$trackingNumber = "7340447182689";

$result = Trendyol::create($user, $pass, $supplier_id)
    ->orderService()
    ->updateTrackingNumber($shipmentPackageId, $trackingNumber);

use Boolxy\Trendyol\Trendyol;

$shipmentPackageId = 11650604;
$invoiceLink = "https://extfatura.faturaentegratoru.com/324523-34523-52345-3453245.pdf";

$result = Trendyol::create($user, $pass, $supplier_id)
    ->orderService()
    ->sendInvoiceLink($invoiceLink, $shipmentPackageId);

use Boolxy\Trendyol\Trendyol;

$result = Trendyol::create($user, $pass, $supplier_id)
    ->orderService()
    ->splittingShipmentPackage()
    ->setShipmentPackageId(11650604)
    ->addOrderLineId(2)
    ->addOrderLineId(3)
    ->addOrderLineId(4)
    // ...
    ->split();

use Boolxy\Trendyol\Trendyol;

$result = Trendyol::create($user, $pass, $supplier_id)
    ->orderService()
    ->splittingShipmentPackageMulti()
    ->setShipmentPackageId(11650604)
    ->addGroup([ 3, 5, 6 ])
    ->addGroup([ 7, 8, 9 ])
    // ...
    ->split();

use Boolxy\Trendyol\Trendyol;

$result = Trendyol::create($user, $pass, $supplier_id)
    ->orderService()
    ->splittingShipmentPackageByQuantity()
    ->setShipmentPackageId(11650604)
    ->addQuantitySplit($orderLineId = 0, [ 2, 2 ])
    // ...
    ->split();

use Boolxy\Trendyol\Trendyol;
use Boolxy\Trendyol\Enums\ClaimItemStatus;

$result = Trendyol::create($user, $pass, $supplier_id)
    ->claimService()
    ->gettingClaims()
    ->status(ClaimItemStatus::create(ClaimItemStatus::CREATED))
    // ...
    ->get();

use Boolxy\Trendyol\Trendyol;

$result = Trendyol::create($user, $pass, $supplier_id)
    ->claimService()
    ->approvingClaimLineItems()
    ->addClaimItemId("f9da2317-876b-4b86-b8f7-0535c3b65731")
    // ...
    ->approve();

use Boolxy\Trendyol\Trendyol;

$result = Trendyol::create($user, $pass, $supplier_id)
    ->claimService()
    ->creatingClaimIssue()
    ->setClaimIssueReasonId(1)
    ->setClaimId("f9da2317-876b-4b86-b8f7-0535c3b65731")
    ->setClaimItemIdList("b71461e3-d1a0-4c1d-9a6d-18ecbcb5158c")
    ->addFile(__DIR__ . '/test.png')
    // ...
    ->create();

use Boolxy\Trendyol\Trendyol;

$results = Trendyol::create($user, $pass, $supplierId)
    ->claimService()
    ->getClaimsIssueReasons();

use Boolxy\Trendyol\Trendyol;
use Boolxy\Trendyol\Enums\SettlementDateType;

$results = Trendyol::create($user, $pass, $supplierId)
    ->settlementService()
    ->gettingSettlements()
    ->dateType(SettlementDateType::create(SettlementDateType::ORDER))
    ->startDate(1557469159834)
    ->endDate(1557469159834)
    // ...
    ->get();
bash
    composer fix