関数
OrderEdit::updateOrderDataCompletion( stdClass $new_orderdata, string $old_status, stdClass $old_orderdata )
パラメータ パラメータ
- $new_orderdata
(stdClass) (必須)
- $old_status
(文字列) (必須)
- $old_orderdata
(stdClass) (必須)
ファイル: src/Admin/OrderEdit.php
protected function updateOrderDataCompletion($new_orderdata, $old_status, $old_orderdata) {
(new V1OrderEdit($this->module))->updateOrderDataCompletion($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->getTransactionState()->getState() !== Charge\State::AUTHORIZED) {
return;
}
$result = (new API\Charge\Capture($this->module, $order))->post(
$order->getChargeId(),
$order->getMostRecentTransactionAmount(),
$order->getPaymentCurrency()
);
if ($result instanceof GenericError) {
$this->orderUpdateErrorMessage = $result->message;
}
}