id = $id; $this->amount = $amount; $this->created = $created; $this->payment_method_details = $payment_method_details; $this->payment_method = $payment_method; $this->amount_captured = $amount_captured; $this->amount_refunded = $amount_refunded; $this->application_fee_amount = $application_fee_amount; $this->balance_transaction = $balance_transaction; $this->billing_details = $billing_details; $this->currency = $currency; $this->dispute = $dispute; $this->disputed = $disputed; $this->order = $order; $this->outcome = $outcome; $this->paid = $paid; $this->paydown = $paydown; $this->payment_intent = $payment_intent; $this->refunded = $refunded; $this->refunds = $refunds; $this->status = $status; // Set default properties. $this->captured = false; } /** * Gets charge ID * * @return string */ public function get_id() { return $this->id; } /** * Gets charge amount * * @return int */ public function get_amount() { return $this->amount; } /** * Gets charge created time * * @return DateTime */ public function get_created() { return $this->created; } /** * Is the charge captured? * * @return bool */ public function is_captured() { return $this->captured; } /** * Sets charge captured flag * * @param bool $captured - Flag indicating capture status of charge. */ public function set_captured( $captured ) { $this->captured = $captured; } /** * Returns the payment method details associated with this charge * * @return array */ public function get_payment_method_details() { return $this->payment_method_details; } /** * Returns the payment method id associated with this charge * * @return string|null */ public function get_payment_method() { return $this->payment_method; } /** * Returns the amount captured associated with this charge * * @return int|null */ public function get_amount_captured() { return $this->amount_captured; } /** * Returns the amount refunded associated with this charge * * @return int|null */ public function get_amount_refunded() { return $this->amount_refunded; } /** * Returns the application fee amount associated with this charge * * @return int|null */ public function get_application_fee_amount() { return $this->application_fee_amount; } /** * Returns the balance transaction associated with this charge * * @return array */ public function get_balance_transaction() { return $this->balance_transaction; } /** * Returns the billing details associated with this charge * * @return array */ public function get_billing_details() { return $this->billing_details; } /** * Returns the currency associated with this charge * * @return string|null */ public function get_currency() { return $this->currency; } /** * Returns the dispute object associated with this charge * * @return array */ public function get_dispute() { return $this->dispute; } /** * Returns the disputed flag associated with this charge * * @return bool|null */ public function get_disputed() { return $this->disputed; } /** * Returns the order object associated with this charge * * @return array */ public function get_order() { return $this->order; } /** * Returns the outcome object associated with this charge * * @return array */ public function get_outcome() { return $this->outcome; } /** * Returns the paid flag associated with this charge * * @return bool|null */ public function get_paid() { return $this->paid; } /** * Returns the paydown object associated with this charge * * @return array */ public function get_paydown() { return $this->paydown; } /** * Returns the payment intent id associated with this charge * * @return string|null */ public function get_payment_intent() { return $this->payment_intent; } /** * Returns the refunded flag associated with this charge * * @return bool|null */ public function get_refunded() { return $this->refunded; } /** * Returns the refund object associated with this charge * * @return array */ public function get_refunds() { return $this->refunds; } /** * Returns the status associated with this charge * * @return string|null */ public function get_status() { return $this->status; } /** * Defines which data will be serialized to JSON */ public function jsonSerialize(): array { return [ 'id' => $this->get_id(), 'amount' => $this->get_amount(), 'created' => $this->get_created()->getTimestamp(), 'payment_method_details' => $this->get_payment_method_details(), 'payment_method' => $this->get_payment_method(), 'amount_captured' => $this->get_amount_captured(), 'amount_refunded' => $this->get_amount_refunded(), 'application_fee_amount' => $this->get_application_fee_amount(), 'balance_transaction' => $this->get_balance_transaction(), 'billing_details' => $this->get_billing_details(), 'currency' => $this->get_currency(), 'dispute' => $this->get_dispute(), 'disputed' => $this->get_disputed(), 'order' => $this->get_order(), 'outcome' => $this->get_outcome(), 'paid' => $this->get_paid(), 'paydown' => $this->get_paydown(), 'payment_intent' => $this->get_payment_intent(), 'captured' => $this->is_captured(), 'refunded' => $this->get_refunded(), 'refunds' => $this->get_refunds(), 'status' => $this->get_status(), ]; } }