alexanderpoellmann/laravel-post-plc 问题修复 & 功能扩展

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

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

alexanderpoellmann/laravel-post-plc

最新稳定版本:v0.1.2

Composer 安装命令:

composer require alexanderpoellmann/laravel-post-plc

包简介

A laravel integration for the Austrian Post Label Center (Österreichische Post).

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Installation

You can install the package via composer:

composer require alexanderpoellmann/laravel-post-plc

Add the following entry to your config/services.php file:

    'post-plc' => [
        'client-id'     => env('PLC_CLIENT_ID'),
        'org-unit-id'   => env('PLC_ORG_UNIT_ID'),
        'org-unit-guid' => env('PLC_ORG_UNIT_GUID'),
        'sandbox'       => env('PLC_SANDBOX', false),
    ],

Usage

use AlexanderPoellmann\LaravelPostPlc\Classes\Address;
use AlexanderPoellmann\LaravelPostPlc\Classes\Collo;
use AlexanderPoellmann\LaravelPostPlc\Classes\Shipment;
use AlexanderPoellmann\LaravelPostPlc\Facades\LaravelPostPlc;
use AlexanderPoellmann\LaravelPostPlc\Enums\PostProductCodes;
use AlexanderPoellmann\LaravelPostPlc\Enums\Features;
use AlexanderPoellmann\LaravelPostPlc\DataTransferObjects\FeatureRow;
use AlexanderPoellmann\LaravelPostPlc\Enums\ServiceMethods;

$from = (new Address())
    ->id(sprintf('%05d', mt_rand(1, 10000)))
    ->name('Absender GmbH')
    ->route('Rochusmarkt')
    ->street_number('5')
    ->post_code('1030')
    ->city('Wien')
    ->country_code('AT')
    ->get();

$to = (new Address())
    ->id(sprintf('%05d', mt_rand(1, 10000)))
    ->name('Musterfirma GmbH', 'c/o Frau Maria Muster')
    ->route('Landesgerichtsstraße')
    ->street_number('1')
    ->post_code('1010')
    ->city('Wien')
    ->country_code('AT')
    ->get();

$shipment = (new Shipment())
    ->withPrinter()
    ->withNumber(sprintf('%05d', mt_rand(1, 10000)))
    ->using(PostProductCodes::PaketPremiumOesterreichB2B)
    ->from($from)
    ->to($to)
    ->withFeatures([
        FeatureRow::from([
            'ThirdPartyID' => Features::CashOnDelivery,
            'Value1' => '199.99', // Amount (decimal)
            'Value2' => 'EUR',    // Currency (ISO code)
            'Value3' => 'AT99 9999 9999 9999 9999|BICCODE|Muster GmbH', // IBAN|BIC|Account holder
            'Value4' => 'Order #12345', // Payment reference
        ]),
    ])
    ->parcels([
        (new Collo)->weight(0.4)->get(),
        (new Collo)->weight(5.2)->get(),
    ])->get();

LaravelPostPlc::call(ServiceMethods::ImportShipment, $shipment, true);

$object = LaravelPostPlc::toCollection();

ray($object);

The PostProductCodes enum has a few helper methods to make it easier to decide which options you might show to your users, when creating shipments:

use AlexanderPoellmann\LaravelPostPlc\Enums\PostProductCodes;

// check whether the selected product is available for Austrian addresses only
$isDomestic = PostProductCodes::PaketOesterreich->isDomestic();

// check whether the selected product requires you to specify its weight
$requiresWeight = PostProductCodes::PaketPremiumInternational->requiresWeight();

// check whether the selected product is available only for business-to-business shipments
$forBusinessOnly = PostProductCodes::PaketPremiumOesterreichB2B->forBusinessOnly();

The FeatureRow enum has a few helper methods as well, here are some examples:

FeatureRow::cashOnDelivery(
    amount: '199.99',
    currency: 'EUR',
    iban: 'AT99 9999 9999 9999 9999',
    bic: 'ABCDEFFXXX',
    accountHolder: 'Muster GmbH',
    paymentReference: 'Order #12345',
]);

FeatureRow::fragile()

FeatureRow::personalDelivery()

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固