You are here

class Mollie_API_Object_Payment in Commerce Mollie 7

Copyright (c) 2013, Mollie B.V. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@license Berkeley Software Distribution License (BSD-License 2) http://www.opensource.org/licenses/bsd-license.php @author Mollie B.V. <info@mollie.nl> @copyright Mollie B.V. @link https://www.mollie.nl

Hierarchy

Expanded class hierarchy of Mollie_API_Object_Payment

File

Mollie/API/Object/Payment.php, line 33

View source
class Mollie_API_Object_Payment {

  /**
   * The payment has just been created, no action has happened on it yet.
   */
  const STATUS_OPEN = "open";

  /**
   * The customer has cancelled the payment.
   */
  const STATUS_CANCELLED = "cancelled";

  /**
   * The payment has expired due to inaction of the customer.
   */
  const STATUS_EXPIRED = "expired";

  /**
   * The payment has been paid.
   */
  const STATUS_PAID = "paid";

  /**
   * The payment has been paidout and the money has been transferred to the bank account of the merchant.
   */
  const STATUS_PAIDOUT = "paidout";

  /**
   * The payment has been refunded, either through Mollie or through the payment provider (in the case of PayPal).
   */
  const STATUS_REFUNDED = "refunded";

  /**
   * Id of the payment (on the Mollie platform).
   *
   * @var string
   */
  public $id;

  /**
   * Mode of the payment, either "live" or "test" depending on the API Key that was used.
   *
   * @var string
   */
  public $mode;

  /**
   * The amount of the payment in EURO with 2 decimals.
   *
   * @var float
   */
  public $amount;

  /**
   * Description of the payment that is shown to the customer during the payment, and
   * possibly on the bank or credit card statement.
   *
   * @var string
   */
  public $description;

  /**
   * If method is empty/null, the customer can pick his/her preferred payment method.
   *
   * @see Mollie_API_Object_Method
   * @var string|null
   */
  public $method;

  /**
   * The status of the payment.
   *
   * @var string
   */
  public $status = self::STATUS_OPEN;

  /**
   * Date and time the payment was created in ISO-8601 format.
   *
   * @example "2013-12-25T10:30:54.0Z"
   * @var string|null
   */
  public $createdDatetime;

  /**
   * Date and time the payment was paid in ISO-8601 format.
   *
   * @var string|null
   */
  public $paidDatetime;

  /**
   * Date and time the payment was cancelled in ISO-8601 format.
   *
   * @var string|null
   */
  public $cancelledDatetime;

  /**
   * Date and time the payment was cancelled in ISO-8601 format.
   *
   * @var string|null
   */
  public $expiredDatetime;

  /**
   * During creation of the payment you can set custom metadata that is stored with
   * the payment, and given back whenever you retrieve that payment.
   *
   * @var object|mixed|null
   */
  public $metadata;

  /**
   * Details of a successfully paid payment are set here. For example, the iDEAL
   * payment method will set $details->consumerName and $details->consumerAccount.
   *
   * @var object
   */
  public $details;

  /**
   * @var object
   */
  public $links;

  /**
   * Is this payment still open / ongoing?
   *
   * @return bool
   */
  public function isOpen() {
    return $this->status == self::STATUS_OPEN;
  }

  /**
   * Is this payment paid for?
   *
   * @return bool
   */
  public function isPaid() {
    return !empty($this->paidDatetime);
  }

  /**
   * Get the payment URL where the customer can complete the payment.
   *
   * @return string|null
   */
  public function getPaymentUrl() {
    if (empty($this->links->paymentUrl)) {
      return NULL;
    }
    return $this->links->paymentUrl;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Mollie_API_Object_Payment::$amount public property The amount of the payment in EURO with 2 decimals.
Mollie_API_Object_Payment::$cancelledDatetime public property Date and time the payment was cancelled in ISO-8601 format.
Mollie_API_Object_Payment::$createdDatetime public property Date and time the payment was created in ISO-8601 format.
Mollie_API_Object_Payment::$description public property Description of the payment that is shown to the customer during the payment, and possibly on the bank or credit card statement.
Mollie_API_Object_Payment::$details public property Details of a successfully paid payment are set here. For example, the iDEAL payment method will set $details->consumerName and $details->consumerAccount.
Mollie_API_Object_Payment::$expiredDatetime public property Date and time the payment was cancelled in ISO-8601 format.
Mollie_API_Object_Payment::$id public property Id of the payment (on the Mollie platform).
Mollie_API_Object_Payment::$links public property
Mollie_API_Object_Payment::$metadata public property During creation of the payment you can set custom metadata that is stored with the payment, and given back whenever you retrieve that payment.
Mollie_API_Object_Payment::$method public property If method is empty/null, the customer can pick his/her preferred payment method.
Mollie_API_Object_Payment::$mode public property Mode of the payment, either "live" or "test" depending on the API Key that was used.
Mollie_API_Object_Payment::$paidDatetime public property Date and time the payment was paid in ISO-8601 format.
Mollie_API_Object_Payment::$status public property The status of the payment.
Mollie_API_Object_Payment::getPaymentUrl public function Get the payment URL where the customer can complete the payment.
Mollie_API_Object_Payment::isOpen public function Is this payment still open / ongoing?
Mollie_API_Object_Payment::isPaid public function Is this payment paid for?
Mollie_API_Object_Payment::STATUS_CANCELLED constant The customer has cancelled the payment.
Mollie_API_Object_Payment::STATUS_EXPIRED constant The payment has expired due to inaction of the customer.
Mollie_API_Object_Payment::STATUS_OPEN constant The payment has just been created, no action has happened on it yet.
Mollie_API_Object_Payment::STATUS_PAID constant The payment has been paid.
Mollie_API_Object_Payment::STATUS_PAIDOUT constant The payment has been paidout and the money has been transferred to the bank account of the merchant.
Mollie_API_Object_Payment::STATUS_REFUNDED constant The payment has been refunded, either through Mollie or through the payment provider (in the case of PayPal).