ApiInterface.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. /**
  3. * This file is part of the Klarna Order Management module
  4. *
  5. * (c) Klarna Bank AB (publ)
  6. *
  7. * For the full copyright and license information, please view the NOTICE
  8. * and LICENSE files that were distributed with this source code.
  9. */
  10. namespace Klarna\Ordermanagement\Api;
  11. use Magento\Framework\DataObject;
  12. use Magento\Sales\Api\Data\InvoiceInterface as Invoice;
  13. use Magento\Sales\Api\Data\CreditmemoInterface as CreditMemo;
  14. use Magento\Store\Api\Data\StoreInterface;
  15. /**
  16. * Interface ApiInterface
  17. *
  18. * @package Klarna\Ordermanagement\Api
  19. */
  20. interface ApiInterface
  21. {
  22. /**
  23. * Capture an amount on an order
  24. *
  25. * @param string $orderId
  26. * @param float $amount
  27. * @param Invoice $invoice
  28. *
  29. * @return DataObject
  30. */
  31. public function capture($orderId, $amount, $invoice = null);
  32. /**
  33. * Refund for an order
  34. *
  35. * @param string $orderId
  36. * @param float $amount
  37. * @param Creditmemo $creditMemo
  38. *
  39. * @return DataObject
  40. */
  41. public function refund($orderId, $amount, $creditMemo = null);
  42. /**
  43. * Cancel an order
  44. *
  45. * @param string $orderId
  46. *
  47. * @return DataObject
  48. */
  49. public function cancel($orderId);
  50. /**
  51. * Release the authorization for an order
  52. *
  53. * @param string $orderId
  54. *
  55. * @return DataObject
  56. */
  57. public function release($orderId);
  58. /**
  59. * Acknowledge an order in order management
  60. *
  61. * @param string $orderId
  62. *
  63. * @return DataObject
  64. */
  65. public function acknowledgeOrder($orderId);
  66. /**
  67. * Update merchant references for a Klarna order
  68. *
  69. * @param string $orderId
  70. * @param string $reference1
  71. * @param string $reference2
  72. *
  73. * @return DataObject
  74. */
  75. public function updateMerchantReferences($orderId, $reference1, $reference2 = null);
  76. /**
  77. * Get the fraud status of an order to determine if it should be accepted or denied within Magento
  78. *
  79. * Return value of 1 means accept
  80. * Return value of 0 means still pending
  81. * Return value of -1 means deny
  82. *
  83. * @param string $orderId
  84. *
  85. * @return int
  86. */
  87. public function getFraudStatus($orderId);
  88. /**
  89. * Get order details for a completed Klarna order
  90. *
  91. * @param string $orderId
  92. *
  93. * @return DataObject
  94. */
  95. public function getPlacedKlarnaOrder($orderId);
  96. /**
  97. * Reset connection based on store config
  98. *
  99. * @param StoreInterface $store
  100. * @param string $methodCode
  101. * @return $this
  102. */
  103. public function resetForStore($store, $methodCode);
  104. /**
  105. * Set builder type to use for API requests
  106. *
  107. * @param string $builderType
  108. * @return $this
  109. */
  110. public function setBuilderType($builderType);
  111. }