承接 jubbs/cakephp-star-ship-it 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jubbs/cakephp-star-ship-it

Composer 安装命令:

composer require jubbs/cakephp-star-ship-it

包简介

StarShipIt plugin for CakePHP4

README 文档

README

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require jubbs/star-ship-it

Create the Database log table bin/cake migrations migrate -p StarShipIt

if there is shipping_status field in the order model then it will be updated with the tracking status

Configuration

in app_local.php add the following

    'StarShipIt' => [
        'API_KEY' => '<<>>',
        'SUBSCRIPTION_KEY' => '<<>>',
        'ORDER_TABLE_CLASS' => 'Order', // The class name of the order table blank if not used
        'ORDER_STATUS_FIELD' => 'shipping_status', // The field name of the order status blank if not used
        'LOG' => false, // Log the requests and responses to debug.log
    ],

Event Callbacks

Need to create the database table for the event callbacks

bin/cake migrations migrate -p StarShipIt

To set the location of the callback in you starshipit account go to

https://app2.starshipit.com/settings/SettingsNotifications

Notification Endpoint URL = https://<>/star-ship-it/event

Event Callback processes

You can have functions run when an event is received from StarShipIt

Within the config of the app

Pass and array with the key of the event and the value of the class and function to run and an array of the parameters to pass to the function if the name exists on the order object then that value will be passed to the function otherwise the text. In this example the order id and the text 'StarShipIt' will be passed to the emailInvoice function in the Mail class

'EVENT_PROCESSES' => [
        'Dispatched' => ['\App\Util\Mail', 'emailInvoice', ['id', 'StarShipIt']],
]

Usage

There are two options to create the StarShipIt order

You can instantiate the StarShipIt/ApiModels/Order class and populate the fields and then call the create method


$ssiOrder = new \StarShipIt\ApiModelsOrder();
$ssiOrder->setOrderNumber('1234');
$ssiOrder->setOrderDate('2020-01-01');
$ssiOrder->setOrderStatus('Processing');
$ssiOrder->setOrderTotal('100.00');
..
$result = $this->ShipIt->createShippingOrder($order);

Or you can add a getStarShipItOrder function to your order Entity class and pass that object directly to the createShippingOrder function on the ShipItComponent


class Order extends Entity
{

    public function getStarShipItOrder()
    {

        $result = new stdClass();

        $result->order_number = $this->id;
        $result->items = [];

        $di = json_decode($this->delivery_address);

        $result->destination = (object)[
            "name" => $di->name ?? ($di->attention ?? null),
            "company" => $di->company ?? null,
            "street" => $di->address_1,
            "suburb" => $di->address_2 ?? null,
            "city" => $di->town ?? ($di->city ?? null),
            "state" => $di->region ?? null,
            "post_code" => $di->post_code ?? null,
            "country" => $di->country ?? null,
            "email" => $di->email ?? null,
            "phone" => $di->phone ?? null,
            "delivery_instructions" => $di->courier_instructions ?? null
        ];
        if ($di->country == "New Zealand") {
            $result->currency = "NZD";
        } elseif ($di->country == "Australia") {
            $result->currency = "AUD";
        }

        foreach ($this->order_products as $line_item) {

            $value = 0;
            if ($line_item->qty) {
                $value = $line_item->price / $line_item->qty;
            }


            if (!$line_item->backordered) { // Dont send backordered items
                $result->items[] = (object)[
                    "item_id" => $line_item->id,
                    "description" => $line_item->product->name,
                    "quantity" => $line_item->qty,
                    "value" => $value
                    //  "tarrif_code" => $line_item->product->tarrif_code ?? "00000000",
                ];
            }
        }

        return $result;
    }
}


$order = $this->Orders->get($id);
$result = $this->ShipIt->createShippingOrder($order);

jubbs/cakephp-star-ship-it 适用场景与选型建议

jubbs/cakephp-star-ship-it 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 12 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 jubbs/cakephp-star-ship-it 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-05