PaymentTokenManagementInterface.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Vault\Api;
  7. use Magento\Sales\Api\Data\OrderPaymentInterface;
  8. use Magento\Vault\Api\Data\PaymentTokenInterface;
  9. /**
  10. * Gateway vault payment token repository interface.
  11. *
  12. * @api
  13. * @since 100.1.0
  14. */
  15. interface PaymentTokenManagementInterface
  16. {
  17. /**
  18. * Lists payment tokens that match specified search criteria.
  19. *
  20. * @param int $customerId Customer ID.
  21. * @return \Magento\Vault\Api\Data\PaymentTokenSearchResultsInterface Payment token search result interface.
  22. * @since 100.1.0
  23. */
  24. public function getListByCustomerId($customerId);
  25. /**
  26. * Get payment token by token Id.
  27. *
  28. * @param int $paymentId The gateway payment token ID.
  29. * @return \Magento\Vault\Api\Data\PaymentTokenInterface Payment token interface.
  30. * @since 100.1.0
  31. */
  32. public function getByPaymentId($paymentId);
  33. /**
  34. * Get payment token by gateway token.
  35. *
  36. * @param string $token The gateway token.
  37. * @param string $paymentMethodCode
  38. * @param int $customerId Customer ID.
  39. * @return PaymentTokenInterface|null Payment token interface.
  40. * @since 100.1.0
  41. */
  42. public function getByGatewayToken($token, $paymentMethodCode, $customerId);
  43. /**
  44. * Get payment token by public hash.
  45. *
  46. * @param string $hash Public hash.
  47. * @param int $customerId Customer ID.
  48. * @return PaymentTokenInterface|null Payment token interface.
  49. * @since 100.1.0
  50. */
  51. public function getByPublicHash($hash, $customerId);
  52. /**
  53. * @param PaymentTokenInterface $token
  54. * @param OrderPaymentInterface $payment
  55. * @return bool
  56. * @since 100.1.0
  57. */
  58. public function saveTokenWithPaymentLink(PaymentTokenInterface $token, OrderPaymentInterface $payment);
  59. /**
  60. * Add link between payment token and order payment.
  61. *
  62. * @param int $paymentTokenId Payment token ID.
  63. * @param int $orderPaymentId Order payment ID.
  64. * @return bool
  65. * @since 100.1.0
  66. */
  67. public function addLinkToOrderPayment($paymentTokenId, $orderPaymentId);
  68. }