TransactionInterface.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Api\Data;
  7. /**
  8. * Transaction interface.
  9. *
  10. * A transaction is an interaction between a merchant and a customer such as a purchase, a credit, a refund, and so on.
  11. * @api
  12. * @since 100.0.2
  13. */
  14. interface TransactionInterface extends \Magento\Framework\Api\ExtensibleDataInterface
  15. {
  16. /**#@+
  17. * Supported transaction types
  18. * @var string
  19. */
  20. const TYPE_PAYMENT = 'payment';
  21. const TYPE_ORDER = 'order';
  22. const TYPE_AUTH = 'authorization';
  23. const TYPE_CAPTURE = 'capture';
  24. const TYPE_VOID = 'void';
  25. const TYPE_REFUND = 'refund';
  26. /**#@-*/
  27. /**#@+
  28. * Constants for keys of data array. Identical to the name of the getter in snake case.
  29. */
  30. /*
  31. * Transaction ID.
  32. */
  33. const TRANSACTION_ID = 'transaction_id';
  34. /*
  35. * Parent ID.
  36. */
  37. const PARENT_ID = 'parent_id';
  38. /*
  39. * Order ID.
  40. */
  41. const ORDER_ID = 'order_id';
  42. /*
  43. * Payment ID.
  44. */
  45. const PAYMENT_ID = 'payment_id';
  46. /*
  47. * Transaction business ID.
  48. */
  49. const TXN_ID = 'txn_id';
  50. /*
  51. * Parent transaction ID.
  52. */
  53. const PARENT_TXN_ID = 'parent_txn_id';
  54. /*
  55. * Transaction type.
  56. */
  57. const TXN_TYPE = 'txn_type';
  58. /*
  59. * Is closed flag.
  60. */
  61. const IS_CLOSED = 'is_closed';
  62. /*
  63. * Additional information.
  64. */
  65. const ADDITIONAL_INFORMATION = 'additional_information';
  66. /*
  67. * Created-at timestamp.
  68. */
  69. const CREATED_AT = 'created_at';
  70. /*
  71. * Method.
  72. */
  73. const METHOD = 'method';
  74. /*
  75. * Increment ID.
  76. */
  77. const INCREMENT_ID = 'increment_id';
  78. /*
  79. * Child transactions.
  80. */
  81. const CHILD_TRANSACTIONS = 'child_transactions';
  82. /**
  83. * Gets the transaction ID for the transaction.
  84. *
  85. * @return int Transaction ID.
  86. */
  87. public function getTransactionId();
  88. /**
  89. * Sets the transaction ID for the transaction.
  90. *
  91. * @param int $id
  92. * @return $this
  93. */
  94. public function setTransactionId($id);
  95. /**
  96. * Gets the parent ID for the transaction.
  97. *
  98. * @return int|null The parent ID for the transaction. Otherwise, null.
  99. */
  100. public function getParentId();
  101. /**
  102. * Gets the order ID for the transaction.
  103. *
  104. * @return int Order ID.
  105. */
  106. public function getOrderId();
  107. /**
  108. * Gets the payment ID for the transaction.
  109. *
  110. * @return int Payment ID.
  111. */
  112. public function getPaymentId();
  113. /**
  114. * Gets the transaction business ID for the transaction.
  115. *
  116. * @return string Transaction business ID.
  117. */
  118. public function getTxnId();
  119. /**
  120. * Gets the parent transaction business ID for the transaction.
  121. *
  122. * @return string Parent transaction business ID.
  123. */
  124. public function getParentTxnId();
  125. /**
  126. * Gets the transaction type for the transaction.
  127. *
  128. * @return string Transaction type.
  129. */
  130. public function getTxnType();
  131. /**
  132. * Gets the value of the is-closed flag for the transaction.
  133. *
  134. * @return int Is-closed flag value.
  135. */
  136. public function getIsClosed();
  137. /**
  138. * Gets any additional information for the transaction.
  139. *
  140. * @return string[]|null Array of additional information. Otherwise, null.
  141. */
  142. public function getAdditionalInformation();
  143. /**
  144. * Gets the created-at timestamp for the transaction.
  145. *
  146. * @return string Created-at timestamp.
  147. */
  148. public function getCreatedAt();
  149. /**
  150. * Sets the created-at timestamp for the transaction.
  151. *
  152. * @param string $createdAt timestamp
  153. * @return $this
  154. */
  155. public function setCreatedAt($createdAt);
  156. /**
  157. * Gets an array of child transactions for the transaction.
  158. *
  159. * @return \Magento\Sales\Api\Data\TransactionInterface[] Array of child transactions.
  160. */
  161. public function getChildTransactions();
  162. /**
  163. * Sets the parent ID for the transaction.
  164. *
  165. * @param int $id
  166. * @return $this
  167. */
  168. public function setParentId($id);
  169. /**
  170. * Sets the order ID for the transaction.
  171. *
  172. * @param int $id
  173. * @return $this
  174. */
  175. public function setOrderId($id);
  176. /**
  177. * Sets the payment ID for the transaction.
  178. *
  179. * @param int $id
  180. * @return $this
  181. */
  182. public function setPaymentId($id);
  183. /**
  184. * Sets the transaction business ID for the transaction.
  185. *
  186. * @param string $id
  187. * @return $this
  188. */
  189. public function setTxnId($id);
  190. /**
  191. * Sets the parent transaction business ID for the transaction.
  192. *
  193. * @param string $id
  194. * @return $this
  195. */
  196. public function setParentTxnId($id);
  197. /**
  198. * Sets the transaction type for the transaction.
  199. *
  200. * @param string $txnType
  201. * @return $this
  202. */
  203. public function setTxnType($txnType);
  204. /**
  205. * Sets the value of the is-closed flag for the transaction.
  206. *
  207. * @param int $isClosed
  208. * @return $this
  209. */
  210. public function setIsClosed($isClosed);
  211. /**
  212. * Additional information setter
  213. * Updates data inside the 'additional_information' array
  214. * Does not allow setting of arrays
  215. *
  216. * @param string $key
  217. * @param mixed $value
  218. * @return $this
  219. * @throws \Magento\Framework\Exception\LocalizedException
  220. */
  221. public function setAdditionalInformation($key, $value);
  222. /**
  223. * Retrieve existing extension attributes object or create a new one.
  224. *
  225. * @return \Magento\Sales\Api\Data\TransactionExtensionInterface|null
  226. */
  227. public function getExtensionAttributes();
  228. /**
  229. * Set an extension attributes object.
  230. *
  231. * @param \Magento\Sales\Api\Data\TransactionExtensionInterface $extensionAttributes
  232. * @return $this
  233. */
  234. public function setExtensionAttributes(\Magento\Sales\Api\Data\TransactionExtensionInterface $extensionAttributes);
  235. }