thangnm93/coccoc-shipping-service

该包最新版本(dev-master)没有可用的许可信息。

帮助越南人购买亚马逊网站上的产品。

dev-master 2021-04-13 03:46 UTC

This package is auto-updated.

Last update: 2024-09-05 10:59:22 UTC


README

这是一个用于计算交叉价格的易于使用的包。

可用的物流服务提供商

  • 亚马逊

1. 要求

2. 安装

需要使用 Composer

$ composer install

3. 如何使用

include_once './vendor/autoload.php';

use \Coccoc\ShippingService\Providers\AmazonProvider;
use \Coccoc\ShippingService\Services\OrderService;
use \Coccoc\ShippingService\Product;

$products = array(
    array(
        'price' => 10,
        'weight' => 120, // gram
        'width' => 100, // cm
        'height' => 120, // cm
        'depth' => 10,
    ),
    array(
        'price' => 20,
        'weight' => 150, // gram
        'width' => 110, // cm
        'height' => 120, // cm
        'depth' => 8,
    )
);

$provider = new AmazonProvider();
$order_service = new OrderService($provider);
foreach ($products as $_product) {
    $product = new Product();
    $product->setPrice($_product['price']);
    $product->setWeight($_product['weight']);
    $product->setWidth($_product['width']);
    $product->setHeight($_product['height']);
    $product->setDepth($_product['depth']);
    $order_service->setProduct($product);
}
$order_gross_price = $order_service->handle();

4. 测试

$ ./vendor/bin/phpunit --testdox --coverage-text --coverage-clover=coverage.clover

或者使用以下命令

$ composer test