PaymentCaptures.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Responses;
  3. use GuzzleHttp\Utils;
  4. trait PaymentCaptures
  5. {
  6. /**
  7. * @return array
  8. */
  9. private function mockGetCapturedPaymentDetailsResponse(): array
  10. {
  11. return Utils::jsonDecode('{
  12. "id": "2GG279541U471931P",
  13. "status": "COMPLETED",
  14. "status_details": {},
  15. "amount": {
  16. "total": "10.99",
  17. "currency": "USD"
  18. },
  19. "final_capture": true,
  20. "seller_protection": {
  21. "status": "ELIGIBLE",
  22. "dispute_categories": [
  23. "ITEM_NOT_RECEIVED",
  24. "UNAUTHORIZED_TRANSACTION"
  25. ]
  26. },
  27. "seller_receivable_breakdown": {
  28. "gross_amount": {
  29. "total": "10.99",
  30. "currency": "USD"
  31. },
  32. "paypal_fee": {
  33. "value": "0.33",
  34. "currency": "USD"
  35. },
  36. "net_amount": {
  37. "value": "10.66",
  38. "currency": "USD"
  39. }
  40. },
  41. "invoice_id": "INVOICE-123",
  42. "create_time": "2017-09-11T23:24:01Z",
  43. "update_time": "2017-09-11T23:24:01Z",
  44. "links": [
  45. {
  46. "href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P",
  47. "rel": "self",
  48. "method": "GET"
  49. },
  50. {
  51. "href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P/refund",
  52. "rel": "refund",
  53. "method": "POST"
  54. },
  55. {
  56. "href": "https://api.paypal.com/v2/payments/authorizations/0VF52814937998046",
  57. "rel": "up",
  58. "method": "GET"
  59. }
  60. ]
  61. }', true);
  62. }
  63. /**
  64. * @return array
  65. */
  66. private function mockRefundCapturedPaymentResponse(): array
  67. {
  68. return Utils::jsonDecode('{
  69. "id": "1JU08902781691411",
  70. "status": "COMPLETED",
  71. "links": [
  72. {
  73. "rel": "self",
  74. "method": "GET",
  75. "href": "https://api.paypal.com/v2/payments/refunds/1JU08902781691411"
  76. },
  77. {
  78. "rel": "up",
  79. "method": "GET",
  80. "href": "https://api.paypal.com/v2/payments/captures/2GG279541U471931P"
  81. }
  82. ]
  83. }', true);
  84. }
  85. }