order = $order; $this->context = $context; } /** * 获取订单信息 */ public function getOrder(): TransferOrder { return $this->order; } /** * 获取上下文信息 */ public function getContext(): array { return $this->context; } /** * 判断是否为转入订单 */ public function isTransferIn(): bool { return $this->order->isTransferIn(); } /** * 判断是否为转出订单 */ public function isTransferOut(): bool { return $this->order->isTransferOut(); } /** * 获取事件数据 */ public function toArray(): array { return [ 'order_id' => $this->order->id, 'transfer_app_id' => $this->order->transfer_app_id, 'user_id' => $this->order->user_id, 'type' => $this->order->type->value, 'amount' => $this->order->amount, 'out_amount' => $this->order->out_amount, 'status' => $this->order->status->value, 'created_at' => $this->order->created_at->toDateTimeString(), 'context' => $this->context, ]; } }