関数
OrderEdit::updateOrderDataCancel( stdClass $new_orderdata, string $old_status, stdClass $old_orderdata )
Called on cancel status
パラメータ パラメータ
- $new_orderdata
(stdClass) (必須)
- $old_status
(文字列) (必須)
- $old_orderdata
(stdClass) (必須)
ファイル: src/Admin/OrderEdit.php
protected function updateOrderDataCancel($new_orderdata, $old_status, $old_orderdata) { (new V1OrderEdit($this->module))->updateOrderDataCancel($new_orderdata, $old_status, $old_orderdata); $opts = $this->module->getActingOpts(); if ($opts['sync_with_order_status_changes'] !== 'on') { return; } $orderId = (int)$old_orderdata->ID; try { $order = new OrderMeta($orderId); } catch (InvalidArgumentException $e) { // not an Amazon Pay V2 order... return; } if ($order->getRefundState() !== null) { return; } $cstate = $order->getChargeState()->getState(); if ($cstate !== Charge\State::AUTHORIZED && $cstate !== Charge\State::DECLINED) { return; } $result = (new API\Charge\Cancel($this->module, $order))->delete($order->getChargeId(), ''); if ($result instanceof GenericError) { $this->orderUpdateErrorMessage = $result->message; } }