InvoicesSearch.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Responses;
  3. use GuzzleHttp\Utils;
  4. trait InvoicesSearch
  5. {
  6. /**
  7. * @return array
  8. */
  9. private function mockSearchInvoicesResponse(): array
  10. {
  11. return Utils::jsonDecode('{
  12. "total_items": 6,
  13. "total_pages": 1,
  14. "items": [
  15. {
  16. "id": "INV2-Z56S-5LLA-Q52L-CPZ5",
  17. "status": "DRAFT",
  18. "detail": {
  19. "invoice_number": "#123",
  20. "reference": "deal-ref",
  21. "invoice_date": "2018-11-12",
  22. "currency_code": "USD",
  23. "note": "Thank you for your business.",
  24. "term": "No refunds after 30 days.",
  25. "memo": "This is a long contract",
  26. "payment_term": {
  27. "term_type": "NET_10",
  28. "due_date": "2018-11-22"
  29. },
  30. "metadata": {
  31. "create_time": "2018-11-12T08:00:20Z",
  32. "recipient_view_url": "https://www.api.paypal.com/invoice/p#Z56S5LLAQ52LCPZ5",
  33. "invoicer_view_url": "https://www.api.paypal.com/invoice/details/INV2-Z56S-5LLA-Q52L-CPZ5"
  34. }
  35. },
  36. "invoicer": {
  37. "email_address": "merchant@example.com"
  38. },
  39. "primary_recipients": [
  40. {
  41. "billing_info": {
  42. "email_address": "bill-me@example.com"
  43. }
  44. }
  45. ],
  46. "amount": {
  47. "currency_code": "USD",
  48. "value": "74.21"
  49. },
  50. "links": [
  51. {
  52. "href": "https://api.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5",
  53. "rel": "self",
  54. "method": "GET"
  55. }
  56. ]
  57. }
  58. ],
  59. "links": [
  60. {
  61. "href": "https://api.paypal.com/v2/invoicing/invoices?page=2&page_size=10&total_required=true",
  62. "rel": "next",
  63. "method": "POST"
  64. }
  65. ]
  66. }', true);
  67. }
  68. }