pwinty/php-pwinty

该软件包已被 废弃,不再维护。未建议替代软件包。

PHP API 包装器,用于 Pwinty.com

2.1.1 2016-01-10 16:44 UTC

This package is not auto-updated.

Last update: 2020-01-24 15:24:03 UTC


README

Pwinty HTTP API v2.1 的 PHP 实现

基于 Brad Pineau 的 API v1 实现

安装

使用 Composer

将以下内容添加到 composer.json 文件的 require 部分

"pwinty/php-pwinty": "dev-master"

不使用 Composer

将此行添加到您的应用程序中

require_once("/pwinty/php-pwinty.php");

声明一个新的 php-pwinty 实例

use pwinty\PhpPwinty;

$config = array(
    'api'        => 'sandbox',
    'merchantId' => 'xxxxxxxxxxxxxxxxx',
    'apiKey'     => 'xxxxxxxxxxxxxxxxx'
);
$pwinty = new PhpPwinty($config);

示例用法

目录

$catalogue = $pwinty->getCatalogue(
    "GB",               //country code
    "Pro"               //quality
);

国家

$countries = $pwinty->getCountries();   

订单

//gets all orders
$order = $pwinty->getOrder(); 

//gets one order
$order = $pwinty->getOrderStatus("1234"); 

//creates a new order
$order = $pwinty->createOrder(
    "Chuck Norris",     //name
    "chuck@norris.com", //email address
    "123 Some Road",    //address1
    "Some place",       //address 2
    "Some town",        //town
    "Some state",       //state
    "12345",            //postcode or zip
    "GB",               //country code
    "GB",               //destination code
    true,               //tracked shipping
    "InvoiceMe",        //payment method
    "Pro"               //quality
);

//updates an order
$order = $pwinty->updateOrder(
    "1234",             //order id
    "Chuck Norris",     //name
    "123 Some Road",    //address1
    "Some place",       //address 2
    "Some town",        //town
    "Some state",       //state
    "12345",            //postcode or zip
);

//change order status
$pwinty->updateOrderStatus(
    "1234,              //orderid
    "Cancelled"         //status
);

//get order status
$order = $pwinty->getOrderStatus(
    "1234"              //order id
);

照片

//gets information about photos for an order
$photos = $pwinty->getPhotos(
    "1234"              //order id
);

//gets information about a single photo
$photo = $pwinty->getPhotos(
    "1234",             //order id
    "123456"            //photo id
);

//adds a photo
$pwinty->addPhoto(
    "1234",                             //order id
    "4x6",                              //print size
    "http://www.mysite.com/photo.jpg",  //image url
    "1",                                //print quantity
    "ShrinkToFit",                      //resize method
    "2000",                             //price to user
    "811cc87f4f77d6c33d638f9def39473b", //md5 hash
    "ewhweo42ufh2woed45f2sdf4yt5sdufw"  //file
);                              

//delete a photo
$pwinty->deletePhoto(
    "1234",             //order id
    "123456"            //photo id
);