tcgunel/omniship-hepsijet 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tcgunel/omniship-hepsijet

Composer 安装命令:

composer require tcgunel/omniship-hepsijet

包简介

HepsiJet carrier for Omniship shipping library

README 文档

README

HepsiJet (Hepsiburada Logistics) carrier driver for Omniship.

Uses HepsiJet's REST/JSON API with token-based authentication.

Installation

composer require tcgunel/omniship-hepsijet

Quick Start

use Omniship\Omniship;
use Omniship\Common\Address;
use Omniship\Common\Package;

$carrier = Omniship::create('HepsiJet');
$carrier->initialize([
    'username' => 'your-username',
    'password' => 'your-password',
    'companyName' => 'YourCompany',
    'abbreviationCode' => 'YRCMPNY',
    'companyAddressId' => 'ADDR-001',
    'currentXDockCode' => 'XD_CENTER',
    'testMode' => true,
]);

Configuration Parameters

Parameter Description Required
username HepsiJet API username Yes
password HepsiJet API password Yes
companyName Company name (provided by HepsiJet during onboarding) Yes
abbreviationCode Company abbreviation code (provided by HepsiJet) Yes
companyAddressId Sender address ID (provided by HepsiJet) Yes
currentXDockCode Cross-dock/sorting center code (provided by HepsiJet) Yes
testMode Use sandbox environment No (default: false)

Operations

Create Shipment

HepsiJet requires the caller to provide a unique barcode/tracking number (customerDeliveryNo). This must be 9-16 characters, prefixed with your company abbreviation code.

$response = $carrier->createShipment([
    'customerDeliveryNo' => 'YRCMPNY123456789',
    'shipFrom' => new Address(
        name: 'Ahmet Yılmaz',
        street1: 'Atatürk Cad. No:42',
        city: 'İstanbul',
        district: 'Kadıköy',
    ),
    'shipTo' => new Address(
        name: 'Mehmet Demir',
        street1: 'Kızılay Mah. 123. Sok. No:5',
        city: 'Ankara',
        district: 'Çankaya',
        postalCode: '06420',
        phone: '05559876543',
        email: 'mehmet@example.com',
    ),
    'packages' => [
        new Package(
            weight: 2.5,
            length: 30,
            width: 20,
            height: 15,
            description: 'Elektronik ürün',
        ),
    ],
    'deliveryType' => 'RETAIL',   // RETAIL, MARKET_PLACE, EXPRESS, RETURNED
    'productCode' => 'HX_STD',   // HX_STD, HX_SD, HX_ND, HX_EX
])->send();

if ($response->isSuccessful()) {
    echo $response->getTrackingNumber();  // "YRCMPNY123456789"
    echo $response->getBarcode();         // Same as tracking number
    echo $response->getShipmentId();      // Same as tracking number
}

Track Shipment

$response = $carrier->getTrackingStatus([
    'trackingNumber' => 'YRCMPNY123456789',
])->send();

if ($response->isSuccessful()) {
    $info = $response->getTrackingInfo();
    echo $info->status->name;         // "DELIVERED"
    echo $info->trackingNumber;       // "YRCMPNY123456789"
    echo $info->signedBy;             // "Mehmet Demir" (if delivered)

    foreach ($info->events as $event) {
        echo $event->description;     // "ACCEPTED", "OUT_FOR_DELIVERY", etc.
        echo $event->occurredAt->format('Y-m-d H:i');
        echo $event->location;        // "Istanbul", "Ankara", etc.
    }
}

Cancel Shipment

Cancels a shipment before it has been picked up by HepsiJet.

$response = $carrier->cancelShipment([
    'trackingNumber' => 'YRCMPNY123456789',
    'deleteReason' => 'IPTAL',       // Optional, defaults to "IPTAL"
])->send();

if ($response->isSuccessful() && $response->isCancelled()) {
    echo 'Shipment cancelled';
}

API Details

Endpoints

Environment URL
Test https://integration-apitest.hepsijet.com
Production https://integration.hepsijet.com

Authentication

Two-step token authentication:

  1. GET /auth/getToken with HTTP Basic Auth (username:password)
  2. All subsequent requests use X-Auth-Token: {token} header

Token expires after 60 minutes.

Key Features

  • REST/JSON API: Modern JSON-based API
  • Caller-provided barcode: You generate the tracking number (customerDeliveryNo), 9-16 chars, prefixed with abbreviation code
  • Nested address format: city.name, town.name, district.name structure
  • Delivery types: RETAIL, MARKET_PLACE, EXPRESS, RETURNED
  • Product codes: HX_STD (Standard), HX_SD (Same Day), HX_ND (Next Day), HX_EX (Express)
  • Delivery slots: 0=Off, 1=Morning(09-13), 2=Noon(13-18), 3=Evening(18-23)
  • Separate label endpoint: Labels are not returned in the create response; use /delivery/barcodes-label separately

API Methods

Operation Method Endpoint
Create Shipment POST /rest/delivery/sendDeliveryOrderEnhanced
Track Shipment POST /rest/delivery/integration/track
Cancel Shipment POST /rest/delivery/deleteDeliveryOrder/{barcode}
Get Label POST /delivery/barcodes-label?format=PDF

Status Mapping

HepsiJet Status ShipmentStatus
NEO PRE_TRANSIT
ACCEPTED PICKED_UP
OUT_FOR_DELIVERY OUT_FOR_DELIVERY
DELIVERED DELIVERED
FAILED_ATTEMPT FAILURE
RETURNED RETURNED
CANCELLED CANCELLED
DELETED CANCELLED

Response Format

All responses follow the envelope:

{
    "status": "OK",
    "data": { ... },
    "message": null
}

Testing

vendor/bin/pest

License

MIT

tcgunel/omniship-hepsijet 适用场景与选型建议

tcgunel/omniship-hepsijet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tcgunel/omniship-hepsijet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tcgunel/omniship-hepsijet 我们能提供哪些服务?
定制开发 / 二次开发

基于 tcgunel/omniship-hepsijet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-13