承接 sch-group/correos 相关项目开发

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

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

sch-group/correos

最新稳定版本:v1.4

Composer 安装命令:

composer require sch-group/correos

包简介

Correos PHP SDK delivery service connector

README 文档

README

CORREOS DELIVERY SYSTEM PHP SDK

Initialization

        $correosConfig = new CorreosConfig(
            $config['login'],
            $config['password'],
            $config['client_code'],
            'dev');

        $senderAddress = new Address(
            $config['sender_city_name'],
            $config['sender_street_name'],
            $config['sender_province_name'],
            $config['sender_street_number']
        );
        $senderIdentification = new Identification(
            $config['sender_name'],
        );
        $senderUnitedIdentity = new SenderUnitedIdentity(
            $senderAddress,
            $senderIdentification,
            $config['sender_postcode'],
            $config['sender_phone'],
            $config['sender_email']
        );

        $this->client = new CorreosConnector($correosConfig, $senderUnitedIdentity);

Create Shipment:

     $receiverAddress = new Address(
            "TEST LAKEPORT",
            "TEST STREET NAME",
            "TEST NAME",
            "20"
        );
        $receiverIdentity = new Identification(
            "TEST TEST",
            null,
            null,
            null,
            null
        );
        $receiverUnitedIdentity = new ReceiverUnitedIdentity(
            $receiverAddress,
            $receiverIdentity,
            "48059", //
            "US",
            null,
            "89274269594",
            "ainur_ahmetgalie@mail.ru"
        );

        $product = new ProductDescription(
            '1',
            '189',
            '200',
            '96000'
        );
        $productList = new ProductList();
        $productList->addProduct($product);

        $sendingInsides = new SendingInsides(
            SendingInsides::GOODS_CONTENT_TYPE, // GOODS,
            SendingInsides::YES_CHOICE, // Y
             SendingInsides::YES_CHOICE,
            $productList,
            SendingInsides::NO_CHOICE
        );
        $packageSize = new PackageSize(
            15,
            15,
            15,
            500
        );

        $sendingContent = new SendingContent(
            SendingContent::PAQ_LIGHT_INTERNATIONAL_TARIFF, // PAQ LIGHT INTERNATIONAL(I)
            SendingContent::POSTAGE_PAID_PAYMENT_TYPE,
            SendingContent::STANDARD_DELIVERY_MODE,
            $packageSize,
            $sendingInsides
        );

        $sendingContent->setCustomerShipmentCode("test order: 123456");

        $shipment = new Shipment($receiverUnitedIdentity, $sendingContent);

        $createdInvoice = $this->client->createShipment($shipment);     

Print labels:

    $trackNumber = $shipment->getClippedTrackNumber();

    $createdShipmentDateTime = $shipment->getDateRequest();

    $labelPdfByteCode = $this->client->printLabel($trackNumber, $createdShipmentDateTime);

Cancel shipment :

    $trackNumber = $invoice->getClippedTrackNumber();

    $isCancelShipment = $this->client->cancelShipment($trackNumber);

Update shipment :

   $receiverAddress = new Address(
            "TEST CITY NAME",
            "TEST STREET NAME",
            "MADRIDO",
            "20"
        );
        $receiverIdentity = new Identification(
            "TEST TEST",
        );
        $receiverUnitedIdentity = new ReceiverUnitedIdentity(
            $receiverAddress,
            $receiverIdentity,
            "480590", // must be less than < 6
            "US", // Zip
        );

        $product = new ProductDescription(
            '1',
            '189',
            '200',
            '96000'
        );
        $productList = new ProductList();
        $productList->addProduct($product);

        $sendingInsides = new SendingInsides(
            SendingInsides::GOODS_CONTENT_TYPE, // GOODS,, // GOODS,
            SendingInsides::YES_CHOICE, // S
            $totalPrice > 50000 ? SendingInsides::YES_CHOICE : null,
            $productList,
            $totalPrice > 50000 ? SendingInsides::NO_CHOICE : null
        );
        $packageSize = new PackageSize(
            15,
            15,
            15,
            500
        );

        $sendingContent = new SendingContent(
            SendingContent::PAQ_LIGHT_INTERNATIONAL_TARIFF, // PAQ LIGHT INTERNATIONAL(I)
            SendingContent::POSTAGE_PAID_PAYMENT_TYPE,
            SendingContent::STANDARD_DELIVERY_MODE,
            $packageSize,
            $sendingInsides
        );

        $shipment = new Shipment($receiverUnitedIdentity, $sendingContent);
        $shipment->setTrackNumber($createdShipment->getTrackNumber());
        $shipment->setDateRequest($createdShipment->getDateRequest());

        $shipment = $this->client->updateShipment($shipment);

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-02