PaymentMethodManagementInterface.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Quote\Api;
  7. /**
  8. * Interface PaymentMethodManagementInterface
  9. * @api
  10. * @since 100.0.2
  11. */
  12. interface PaymentMethodManagementInterface
  13. {
  14. /**
  15. * Adds a specified payment method to a specified shopping cart.
  16. *
  17. * @param int $cartId The cart ID.
  18. * @param \Magento\Quote\Api\Data\PaymentInterface $method The payment method.
  19. * @return string redirect url or error message.
  20. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
  21. * @throws \Magento\Framework\Exception\State\InvalidTransitionException The billing or shipping address
  22. * is not set, or the specified payment method is not available.
  23. */
  24. public function set($cartId, \Magento\Quote\Api\Data\PaymentInterface $method);
  25. /**
  26. * Returns the payment method for a specified shopping cart.
  27. *
  28. * @param int $cartId The cart ID.
  29. * @return \Magento\Quote\Api\Data\PaymentInterface Payment method object.
  30. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
  31. */
  32. public function get($cartId);
  33. /**
  34. * Lists available payment methods for a specified shopping cart.
  35. *
  36. * This call returns an array of objects, but detailed information about each object’s attributes might not be
  37. * included. See https://devdocs.magento.com/codelinks/attributes.html#PaymentMethodManagementInterface to
  38. * determine which call to use to get detailed information about all attributes for an object.
  39. *
  40. * @param int $cartId The cart ID.
  41. * @return \Magento\Quote\Api\Data\PaymentMethodInterface[] Array of payment methods.
  42. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
  43. */
  44. public function getList($cartId);
  45. }