ServiceInterface.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * This file is part of the Klarna Core 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\Core\Api;
  11. /**
  12. * Interface ServiceInterface
  13. *
  14. * @package Klarna\Core\Api
  15. */
  16. interface ServiceInterface
  17. {
  18. /**
  19. * post
  20. */
  21. const POST = 'post';
  22. /**
  23. * get
  24. */
  25. const GET = 'get';
  26. /**
  27. * put
  28. */
  29. const PUT = 'put';
  30. /**
  31. * patch
  32. */
  33. const PATCH = 'patch';
  34. /**
  35. * delete
  36. */
  37. const DELETE = 'delete';
  38. /**
  39. * Make API call
  40. *
  41. * @param string $url
  42. * @param string $body
  43. * @param string $method HTTP request type
  44. * @param string $klarnaId
  45. * @return array Response body from API call
  46. */
  47. public function makeRequest($url, $body = '', $method = self::POST, $klarnaId = null);
  48. /**
  49. * Connect to API
  50. *
  51. * @param string $username
  52. * @param string $password
  53. * @param string $connectUrl
  54. * @return bool Whether connect succeeded or not
  55. */
  56. public function connect($username, $password, $connectUrl = null);
  57. /**
  58. * @param string $product
  59. * @param string $version
  60. * @param string $mageInfo
  61. * @return mixed
  62. */
  63. public function setUserAgent($product, $version, $mageInfo);
  64. /**
  65. * @param string $header
  66. * @param string|null $value
  67. * @return mixed
  68. */
  69. public function setHeader($header, $value = null);
  70. }