id = $id; $this->amount = $amount; $this->created = $created; $this->status = $status; $this->client_secret = $client_secret; $this->currency = strtoupper( $currency ); $this->next_action = $next_action; $this->last_payment_error = $last_payment_error; $this->customer_id = $customer_id; $this->payment_method_id = $payment_method_id; $this->charge = $charge; $this->metadata = $metadata; $this->processing = $processing; $this->payment_method_types = $payment_method_types; $this->payment_method_options = $payment_method_options; $this->order = $order; } /** * Gets charge amount * * @return int */ public function get_amount() { return $this->amount; } /** * Returns the currency of this intention * * @return string */ public function get_currency() { return $this->currency; } /** * Returns the last payment error of this intention * * @return array */ public function get_last_payment_error() { return $this->last_payment_error; } /** * Returns the charge associated with this intention * * @return WC_Payments_API_Charge */ public function get_charge() { return $this->charge; } /** * Returns the processing state of this intention * * @return array */ public function get_processing() { return $this->processing; } /** * Defines which data will be serialized to JSON */ public function jsonSerialize(): array { return [ 'id' => $this->get_id(), 'amount' => $this->get_amount(), 'currency' => $this->get_currency(), 'charge' => $this->get_charge(), 'created' => $this->get_created()->getTimestamp(), 'customer' => $this->get_customer_id(), 'metadata' => $this->get_metadata(), 'payment_method' => $this->get_payment_method_id(), 'payment_method_types' => $this->get_payment_method_types(), 'processing' => $this->get_processing(), 'status' => $this->get_status(), 'order' => $this->get_order(), ]; } }