我正在将 Pwinty 用于一个项目,并且正在尝试使用 API 和 PHP Library PHPPwinty将订单状态更新为 Canceled 。(更新订单状态的功能可以在第218行找到。)
我有以下代码:
<?php
require_once("../config/printer/PHPPwinty.php");
$pwinty = new PHPPwinty();
$order = "7733";
$order_details = $pwinty->getOrder($order);
print_r($order_details);
$pwinty->updateOrderStatus($order, "Cancelled");
?>
库中的函数如下所示:
/**
* Update the status of an order (to submit or cancel it)
*
* @param string $id Order id
* @param string $status Status to which the order should be updated. Valid values are "Cancelled" or "Submitted"
* @return array The order details
* @access public
*/
function updateOrderStatus($id, $status) {
$data = array();
$data["id"] = $id;
$data["status"] = $status;
$data = $this->apiCall("/Orders/Status", $data, "POST");
if (is_array($data)) {
if (isset($data["error"])) {
$this->last_error = $data["error"];
return 0;
} else {
return $data;
}
} else {
return 0;
}
}
虽然当我运行它时,我只是得到订单详细信息,状态仍然是已提交。有什么建议么?