クラス
OrderList
Model for all orderlist and order_edit page operations.
ソース ソース
ファイル: src/Admin/OrderList.php
class OrderList extends OrderListDI { /** * Loads CSS * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return OrderList */ public function init() { (new ConditionalAssetsLoader())->loadOrderListPageAssets(function () { SettlementModulesUtils::loadTransactionStatesCss(); }); return $this; } /** * Adds transaction ID and state to transaction ID row column value * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param string $detail * @param string $value * @param string $key * @param int $order_id * @return string */ protected function filterTransactionIdRowColumnValue($detail, $value, $key, $order_id) { try { $order = new OrderMeta($order_id); } catch (InvalidArgumentException $error) { // order is not an Amazon Pay order... return $detail; } $detail = $this->getTransactionIdRowColumnHtml($order->getTransactionState()); return $detail; } /** * Batch updates for completion status. * * @author Evan D Shaw <evandanielshaw@gmail.com> * @see function updateOrderData * @global \usc_e_shop $usces * @param string $msgstr * @param array $order_res * @param array $req $_REQUEST * @param integer $id * @param \WlcOrderList|\dataList $obj {@see use-e-shop/classes/orderList[2].class.php} * @return string */ protected function batchUpdateOrderStatusCompletion($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))->batchUpdateOrderStatusCompletion( $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->getTransactionState()->getState() !== Charge\State::AUTHORIZED) { return $msgstr; } $result = (new API\Charge\Capture($this->module, $order))->post( $order->getChargeId(), $order->getMostRecentTransactionAmount(), $order->getPaymentCurrency() ); if ($result instanceof GenericError) { $msgstr .= !empty($msgstr) ? '<br/><br/>' : ''; $msgstr .= Utils::adminMessageString($id, 'error', $result->message, false); } return $msgstr; } /** * Batch updates for cancel status. * * @author Evan D Shaw <evandanielshaw@gmail.com> * @see function updateOrderData * @global \usc_e_shop $usces * @param string $msgstr * @param array $order_res * @param array $req $_REQUEST * @param integer $id * @param WlcOrderList|dataList $obj {@see use-e-shop/classes/orderList[2].class.php} * @return string */ 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; } }
- batchUpdateOrderStatusCancel — Batch updates for cancel status.
- batchUpdateOrderStatusCompletion — Batch updates for completion status.
- filterTransactionIdRowColumnValue — Adds transaction ID and state to transaction ID row column value
- init — Loads CSS