Trackers.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Responses;
  3. use GuzzleHttp\Utils;
  4. trait Trackers
  5. {
  6. /**
  7. * @return array
  8. */
  9. private function mockGetTrackingDetailsResponse(): array
  10. {
  11. return Utils::jsonDecode('{
  12. "transaction_id": "8MC585209K746392H",
  13. "tracking_number": "443844607820",
  14. "status": "SHIPPED",
  15. "carrier": "FEDEX",
  16. "links": [
  17. {
  18. "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",
  19. "rel": "self"
  20. },
  21. {
  22. "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",
  23. "rel": "replace",
  24. "method": "PUT"
  25. },
  26. {
  27. "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch",
  28. "rel": "create",
  29. "method": "POST"
  30. }
  31. ]
  32. }', true);
  33. }
  34. /**
  35. * @return array
  36. */
  37. private function mockCreateTrackinginBatchesResponse(): array
  38. {
  39. return Utils::jsonDecode('{
  40. "tracker_identifiers": [
  41. {
  42. "transaction_id": "8MC585209K746392H",
  43. "tracking_number": "443844607820",
  44. "links": [
  45. {
  46. "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",
  47. "rel": "self",
  48. "method": "GET"
  49. },
  50. {
  51. "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/8MC585209K746392H-443844607820",
  52. "rel": "replace",
  53. "method": "PUT"
  54. }
  55. ]
  56. },
  57. {
  58. "transaction_id": "53Y56775AE587553X",
  59. "tracking_number": "443844607821",
  60. "links": [
  61. {
  62. "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/53Y56775AE587553X-443844607821",
  63. "rel": "self",
  64. "method": "GET"
  65. },
  66. {
  67. "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers/53Y56775AE587553X-443844607821",
  68. "rel": "replace",
  69. "method": "PUT"
  70. }
  71. ]
  72. }
  73. ],
  74. "errors": [
  75. {
  76. "name": "RESOURCE_NOT_FOUND",
  77. "debug_id": "46735c7461f3d",
  78. "message": "The specified resource does not exist.",
  79. "details": [
  80. {
  81. "field": "/trackers/0/transaction_id",
  82. "value": "8MC585309K746392H",
  83. "location": "body",
  84. "issue": "INVALID_TRANSACTION_ID"
  85. }
  86. ]
  87. }
  88. ],
  89. "links": [
  90. {
  91. "href": "https://api-m.sandbox.paypal.com/v1/shipping/trackers-batch",
  92. "rel": "self",
  93. "method": "POST"
  94. }
  95. ]
  96. }', true);
  97. }
  98. }