関数
OrderList::batchUpdateOrderStatusCancel( string $msgstr, array $order_res, array $req, integer $id, Aivec\Welcart\SettlementModules\AmazonPay\Admin\WlcOrderList|\Aivec\Welcart\SettlementModules\AmazonPay\Admin\dataList $obj )
説明 説明
- function: updateOrderData
- $msgstr
(文字列) (必須)
- $order_res
(配列) (必須)
- $req
(配列) (必須) $_REQUEST
- $id
(integer) (必須)
- $obj
(Aivec\Welcart\SettlementModules\AmazonPay\Admin\WlcOrderList) (必須) @see use-e-shop/classes/orderList[2].class.php
ファイル: src/Admin/OrderList.php
protected function batchUpdateOrderStatusCancel($msgstr, $order_res, $req, $id, $obj) {
global $usces;
$amazon_order_state = $usces->get_order_meta_value('amazon_order_state', $id);
if (!empty($amazon_order_state)) {
return (new V1OrderList($this->module))->batchUpdateOrderStatusCancel($msgstr, $order_res, $req, $id, $obj);
}
$opts = $this->module->getActingOpts();
if ($opts['sync_with_order_status_changes'] !== 'on') {
return $msgstr;
}
try {
$order = new OrderMeta($id);
} catch (InvalidArgumentException $e) {
// order is not an Amazon Pay order...
return $msgstr;
}
if ($order->getRefundState() !== null) {
return $msgstr;
}
$cstate = $order->getChargeState()->getState();
if ($cstate !== Charge\State::AUTHORIZED && $cstate !== Charge\State::DECLINED) {
return $msgstr;
}
$result = (new API\Charge\Cancel($this->module, $order))->delete($order->getChargeId(), '');
if ($result instanceof GenericError) {
$msgstr .= !empty($msgstr) ? '<br/><br/>' : '';
$msgstr .= Utils::adminMessageString($id, 'error', $result->message, false);
}
return $msgstr;
}