TransactionInterface.php 5.95 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Sales\Api\Data;

/**
 * Transaction interface.
 *
 * A transaction is an interaction between a merchant and a customer such as a purchase, a credit, a refund, and so on.
 * @api
 * @since 100.0.2
 */
interface TransactionInterface extends \Magento\Framework\Api\ExtensibleDataInterface
{
    /**#@+
     * Supported transaction types
     * @var string
     */
    const TYPE_PAYMENT = 'payment';

    const TYPE_ORDER = 'order';

    const TYPE_AUTH = 'authorization';

    const TYPE_CAPTURE = 'capture';

    const TYPE_VOID = 'void';

    const TYPE_REFUND = 'refund';

    /**#@-*/

    /**#@+
     * Constants for keys of data array. Identical to the name of the getter in snake case.
     */
    /*
     * Transaction ID.
     */
    const TRANSACTION_ID = 'transaction_id';
    /*
     * Parent ID.
     */
    const PARENT_ID = 'parent_id';
    /*
     * Order ID.
     */
    const ORDER_ID = 'order_id';
    /*
     * Payment ID.
     */
    const PAYMENT_ID = 'payment_id';
    /*
     * Transaction business ID.
     */
    const TXN_ID = 'txn_id';
    /*
     * Parent transaction ID.
     */
    const PARENT_TXN_ID = 'parent_txn_id';
    /*
     * Transaction type.
     */
    const TXN_TYPE = 'txn_type';
    /*
     * Is closed flag.
     */
    const IS_CLOSED = 'is_closed';
    /*
     * Additional information.
     */
    const ADDITIONAL_INFORMATION = 'additional_information';
    /*
     * Created-at timestamp.
     */
    const CREATED_AT = 'created_at';
    /*
     * Method.
     */
    const METHOD = 'method';
    /*
     * Increment ID.
     */
    const INCREMENT_ID = 'increment_id';
    /*
     * Child transactions.
     */
    const CHILD_TRANSACTIONS = 'child_transactions';

    /**
     * Gets the transaction ID for the transaction.
     *
     * @return int Transaction ID.
     */
    public function getTransactionId();

    /**
     * Sets the transaction ID for the transaction.
     *
     * @param int $id
     * @return $this
     */
    public function setTransactionId($id);

    /**
     * Gets the parent ID for the transaction.
     *
     * @return int|null The parent ID for the transaction. Otherwise, null.
     */
    public function getParentId();

    /**
     * Gets the order ID for the transaction.
     *
     * @return int Order ID.
     */
    public function getOrderId();

    /**
     * Gets the payment ID for the transaction.
     *
     * @return int Payment ID.
     */
    public function getPaymentId();

    /**
     * Gets the transaction business ID for the transaction.
     *
     * @return string Transaction business ID.
     */
    public function getTxnId();

    /**
     * Gets the parent transaction business ID for the transaction.
     *
     * @return string Parent transaction business ID.
     */
    public function getParentTxnId();

    /**
     * Gets the transaction type for the transaction.
     *
     * @return string Transaction type.
     */
    public function getTxnType();

    /**
     * Gets the value of the is-closed flag for the transaction.
     *
     * @return int Is-closed flag value.
     */
    public function getIsClosed();

    /**
     * Gets any additional information for the transaction.
     *
     * @return string[]|null Array of additional information. Otherwise, null.
     */
    public function getAdditionalInformation();

    /**
     * Gets the created-at timestamp for the transaction.
     *
     * @return string Created-at timestamp.
     */
    public function getCreatedAt();

    /**
     * Sets the created-at timestamp for the transaction.
     *
     * @param string $createdAt timestamp
     * @return $this
     */
    public function setCreatedAt($createdAt);

    /**
     * Gets an array of child transactions for the transaction.
     *
     * @return \Magento\Sales\Api\Data\TransactionInterface[] Array of child transactions.
     */
    public function getChildTransactions();

    /**
     * Sets the parent ID for the transaction.
     *
     * @param int $id
     * @return $this
     */
    public function setParentId($id);

    /**
     * Sets the order ID for the transaction.
     *
     * @param int $id
     * @return $this
     */
    public function setOrderId($id);

    /**
     * Sets the payment ID for the transaction.
     *
     * @param int $id
     * @return $this
     */
    public function setPaymentId($id);

    /**
     * Sets the transaction business ID for the transaction.
     *
     * @param string $id
     * @return $this
     */
    public function setTxnId($id);

    /**
     * Sets the parent transaction business ID for the transaction.
     *
     * @param string $id
     * @return $this
     */
    public function setParentTxnId($id);

    /**
     * Sets the transaction type for the transaction.
     *
     * @param string $txnType
     * @return $this
     */
    public function setTxnType($txnType);

    /**
     * Sets the value of the is-closed flag for the transaction.
     *
     * @param int $isClosed
     * @return $this
     */
    public function setIsClosed($isClosed);

    /**
     * Additional information setter
     * Updates data inside the 'additional_information' array
     * Does not allow setting of arrays
     *
     * @param string $key
     * @param mixed $value
     * @return $this
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function setAdditionalInformation($key, $value);

    /**
     * Retrieve existing extension attributes object or create a new one.
     *
     * @return \Magento\Sales\Api\Data\TransactionExtensionInterface|null
     */
    public function getExtensionAttributes();

    /**
     * Set an extension attributes object.
     *
     * @param \Magento\Sales\Api\Data\TransactionExtensionInterface $extensionAttributes
     * @return $this
     */
    public function setExtensionAttributes(\Magento\Sales\Api\Data\TransactionExtensionInterface $extensionAttributes);
}