BuilderInterface.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Model\Order\Payment\Transaction;
  7. use Magento\Sales\Api\Data\OrderInterface;
  8. use Magento\Sales\Api\Data\OrderPaymentInterface;
  9. use Magento\Sales\Api\Data\TransactionInterface;
  10. /**
  11. * Interface BuilderInterface
  12. * Create transaction,
  13. * prepare its insertion into hierarchy and add its information to payment and comments
  14. */
  15. interface BuilderInterface
  16. {
  17. /**
  18. * Sets payment data for creating transaction
  19. *
  20. * @param OrderPaymentInterface $payment
  21. * @return $this
  22. */
  23. public function setPayment(OrderPaymentInterface $payment);
  24. /**
  25. * Sets order for creating transaction
  26. *
  27. * @param OrderInterface $order
  28. * @return $this
  29. */
  30. public function setOrder(OrderInterface $order);
  31. /**
  32. * Sets sales entity for creating transaction
  33. * If the sales document is specified, it will be linked to the transaction as related for future usage.
  34. * Currently transaction ID is set into the sales object
  35. * This method writes the added transaction ID into last_trans_id field of the payment object
  36. *
  37. * @param \Magento\Sales\Model\AbstractModel $document
  38. * @return $this
  39. */
  40. public function setSalesDocument(\Magento\Sales\Model\AbstractModel $document);
  41. /**
  42. * Sets failSafe flag
  43. * To make sure transaction object won't cause trouble before saving, use $failsafe = true
  44. *
  45. * @param bool $failSafe
  46. * @return $this
  47. */
  48. public function setFailSafe($failSafe);
  49. /**
  50. * Sets message
  51. *
  52. * @param string $message
  53. * @return $this
  54. */
  55. public function setMessage($message);
  56. /**
  57. * Sets transaction id
  58. * For getting rid of TransactionId in Payment model in future
  59. *
  60. * @param string|null $transactionId
  61. * @return $this
  62. */
  63. public function setTransactionId($transactionId);
  64. /**
  65. * Sets an array to additional information
  66. *
  67. * @param array $value
  68. * @return $this
  69. */
  70. public function setAdditionalInformation(array $value);
  71. /**
  72. * Add element to additional information
  73. *
  74. * @param string $key
  75. * @param string $value
  76. * @return $this
  77. */
  78. public function addAdditionalInformation($key, $value);
  79. /**
  80. * Resets state
  81. *
  82. * @return $this
  83. */
  84. public function reset();
  85. /**
  86. * Build transaction.
  87. * Transaction type is required
  88. *
  89. * @param string $type
  90. * @return TransactionInterface
  91. */
  92. public function build($type);
  93. }