AbstractCarrierInterface.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Shipping\Model\Carrier;
  7. use Magento\Quote\Model\Quote\Address\RateRequest;
  8. /**
  9. * Interface AbstractCarrierInterface
  10. */
  11. interface AbstractCarrierInterface
  12. {
  13. /**
  14. * Retrieve information from carrier configuration
  15. *
  16. * @param string $field
  17. * @return mixed
  18. * @api
  19. */
  20. public function getConfigData($field);
  21. /**
  22. * Collect and get rates
  23. *
  24. * @param RateRequest $request
  25. * @return \Magento\Framework\DataObject|bool|null
  26. * @api
  27. */
  28. public function collectRates(RateRequest $request);
  29. /**
  30. * Do request to shipment
  31. * Implementation must be in overridden method
  32. *
  33. * @param \Magento\Framework\DataObject $request
  34. * @return \Magento\Framework\DataObject
  35. * @api
  36. */
  37. public function requestToShipment($request);
  38. /**
  39. * Do return of shipment
  40. * Implementation must be in overridden method
  41. *
  42. * @param \Magento\Framework\DataObject $request
  43. * @return \Magento\Framework\DataObject
  44. * @api
  45. */
  46. public function returnOfShipment($request);
  47. /**
  48. * Return container types of carrier
  49. *
  50. * @param \Magento\Framework\DataObject|null $params
  51. * @return array
  52. * @api
  53. */
  54. public function getContainerTypes(\Magento\Framework\DataObject $params = null);
  55. /**
  56. * Get Container Types, that could be customized
  57. *
  58. * @return array
  59. * @api
  60. */
  61. public function getCustomizableContainerTypes();
  62. /**
  63. * Return delivery confirmation types of carrier
  64. *
  65. * @param \Magento\Framework\DataObject|null $params
  66. * @return array
  67. * @api
  68. */
  69. public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $params = null);
  70. /**
  71. * @param \Magento\Framework\DataObject $request
  72. * @return $this|bool|false|\Magento\Framework\Model\AbstractModel
  73. * @api
  74. */
  75. public function checkAvailableShipCountries(\Magento\Framework\DataObject $request);
  76. /**
  77. * Processing additional validation to check is carrier applicable.
  78. *
  79. * @param \Magento\Framework\DataObject $request
  80. * @return $this|\Magento\Framework\DataObject|boolean
  81. * @api
  82. */
  83. public function proccessAdditionalValidation(\Magento\Framework\DataObject $request);
  84. /**
  85. * Determine whether current carrier enabled for activity
  86. *
  87. * @return bool
  88. * @api
  89. */
  90. public function isActive();
  91. /**
  92. * Whether this carrier has fixed rates calculation
  93. *
  94. * @return bool
  95. * @api
  96. */
  97. public function isFixed();
  98. /**
  99. * Check if carrier has shipping tracking option available
  100. *
  101. * @return bool
  102. * @api
  103. */
  104. public function isTrackingAvailable();
  105. /**
  106. * Check if carrier has shipping label option available
  107. *
  108. * @return bool
  109. * @api
  110. */
  111. public function isShippingLabelsAvailable();
  112. /**
  113. * Retrieve sort order of current carrier
  114. *
  115. * @return string|null
  116. * @api
  117. */
  118. public function getSortOrder();
  119. /**
  120. * Get the handling fee for the shipping + cost
  121. *
  122. * @param float $cost
  123. * @return float final price for shipping method
  124. * @api
  125. */
  126. public function getFinalPriceWithHandlingFee($cost);
  127. /**
  128. * Set the number of boxes for shipping
  129. *
  130. * @param int|float $weight
  131. * @return int|float weight
  132. * @api
  133. */
  134. public function getTotalNumOfBoxes($weight);
  135. /**
  136. * Is state province required
  137. *
  138. * @return bool
  139. * @api
  140. */
  141. public function isStateProvinceRequired();
  142. /**
  143. * Check if city option required
  144. *
  145. * @return bool
  146. * @api
  147. */
  148. public function isCityRequired();
  149. /**
  150. * Determine whether zip-code is required for the country of destination
  151. *
  152. * @param string|null $countryId
  153. * @return bool
  154. * @api
  155. */
  156. public function isZipCodeRequired($countryId = null);
  157. /**
  158. * Used to call debug method from not Payment Method context
  159. *
  160. * @param mixed $debugData
  161. * @return void
  162. * @api
  163. */
  164. public function debugData($debugData);
  165. /**
  166. * Getter for carrier code
  167. *
  168. * @return string
  169. * @api
  170. */
  171. public function getCarrierCode();
  172. /**
  173. * Return content types of package
  174. *
  175. * @param \Magento\Framework\DataObject $params
  176. * @return array
  177. * @api
  178. */
  179. public function getContentTypes(\Magento\Framework\DataObject $params);
  180. }