Reporting.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Responses;
  3. use GuzzleHttp\Utils;
  4. trait Reporting
  5. {
  6. /**
  7. * @return array
  8. */
  9. private function mockListTransactionsResponse(): array
  10. {
  11. return Utils::jsonDecode('{
  12. "transaction_details": [
  13. {
  14. "transaction_info": {
  15. "paypal_account_id": "6STWC2LSUYYYE",
  16. "transaction_id": "5TY05013RG002845M",
  17. "transaction_event_code": "T0006",
  18. "transaction_initiation_date": "2014-07-11T04:03:52+0000",
  19. "transaction_updated_date": "2014-07-11T04:03:52+0000",
  20. "transaction_amount": {
  21. "currency_code": "USD",
  22. "value": "465.00"
  23. },
  24. "fee_amount": {
  25. "currency_code": "USD",
  26. "value": "-13.79"
  27. },
  28. "insurance_amount": {
  29. "currency_code": "USD",
  30. "value": "15.00"
  31. },
  32. "shipping_amount": {
  33. "currency_code": "USD",
  34. "value": "30.00"
  35. },
  36. "shipping_discount_amount": {
  37. "currency_code": "USD",
  38. "value": "10.00"
  39. },
  40. "transaction_status": "S",
  41. "transaction_subject": "Bill for your purchase",
  42. "transaction_note": "Check out the latest sales",
  43. "invoice_id": "Invoice-005",
  44. "custom_field": "Thank you for your business",
  45. "protection_eligibility": "01"
  46. },
  47. "payer_info": {
  48. "account_id": "6STWC2LSUYYYE",
  49. "email_address": "consumer@example.com",
  50. "address_status": "Y",
  51. "payer_status": "Y",
  52. "payer_name": {
  53. "given_name": "test",
  54. "surname": "consumer",
  55. "alternate_full_name": "test consumer"
  56. },
  57. "country_code": "US"
  58. },
  59. "shipping_info": {
  60. "name": "Sowmith",
  61. "address": {
  62. "line1": "Eco Space, bellandur",
  63. "line2": "OuterRingRoad",
  64. "city": "Bangalore",
  65. "country_code": "IN",
  66. "postal_code": "560103"
  67. }
  68. },
  69. "cart_info": {
  70. "item_details": [
  71. {
  72. "item_code": "ItemCode-1",
  73. "item_name": "Item1 - radio",
  74. "item_description": "Radio",
  75. "item_quantity": "2",
  76. "item_unit_price": {
  77. "currency_code": "USD",
  78. "value": "50.00"
  79. },
  80. "item_amount": {
  81. "currency_code": "USD",
  82. "value": "100.00"
  83. },
  84. "tax_amounts": [
  85. {
  86. "tax_amount": {
  87. "currency_code": "USD",
  88. "value": "20.00"
  89. }
  90. }
  91. ],
  92. "total_item_amount": {
  93. "currency_code": "USD",
  94. "value": "120.00"
  95. },
  96. "invoice_number": "Invoice-005"
  97. },
  98. {
  99. "item_code": "ItemCode-2",
  100. "item_name": "Item2 - Headset",
  101. "item_description": "Headset",
  102. "item_quantity": "3",
  103. "item_unit_price": {
  104. "currency_code": "USD",
  105. "value": "100.00"
  106. },
  107. "item_amount": {
  108. "currency_code": "USD",
  109. "value": "300.00"
  110. },
  111. "tax_amounts": [
  112. {
  113. "tax_amount": {
  114. "currency_code": "USD",
  115. "value": "60.00"
  116. }
  117. }
  118. ],
  119. "total_item_amount": {
  120. "currency_code": "USD",
  121. "value": "360.00"
  122. },
  123. "invoice_number": "Invoice-005"
  124. },
  125. {
  126. "item_name": "3",
  127. "item_quantity": "1",
  128. "item_unit_price": {
  129. "currency_code": "USD",
  130. "value": "-50.00"
  131. },
  132. "item_amount": {
  133. "currency_code": "USD",
  134. "value": "-50.00"
  135. },
  136. "total_item_amount": {
  137. "currency_code": "USD",
  138. "value": "-50.00"
  139. },
  140. "invoice_number": "Invoice-005"
  141. }
  142. ]
  143. },
  144. "store_info": {},
  145. "auction_info": {},
  146. "incentive_info": {}
  147. }
  148. ],
  149. "account_number": "XZXSPECPDZHZU",
  150. "last_refreshed_datetime": "2017-01-02T06:59:59+0000",
  151. "page": 1,
  152. "total_items": 1,
  153. "total_pages": 1,
  154. "links": [
  155. {
  156. "href": "https://api-m.sandbox.paypal.com/v1/reporting/transactions?start_date=2014-07-01T00:00:00-0700&end_date=2014-07-30T23:59:59-0700&transaction_id=5TY05013RG002845M&fields=all&page_size=100&page=1",
  157. "rel": "self",
  158. "method": "GET"
  159. }
  160. ]
  161. }', true);
  162. }
  163. /**
  164. * @return array
  165. */
  166. private function mockListBalancesResponse(): array
  167. {
  168. return Utils::jsonDecode('{
  169. "balance": {
  170. "currency": "USD",
  171. "primary": true,
  172. "total_balance": {
  173. "currency_code": "USD",
  174. "value": "300.00"
  175. },
  176. "available_balance": {
  177. "currency_code": "USD",
  178. "value": "100.00"
  179. },
  180. "withheld_balance": {
  181. "currency_code": "USD",
  182. "value": "200.00"
  183. }
  184. },
  185. "account_id": "QCXKLSS8GWT22",
  186. "as_of_time": "2016-10-15T13:07:00Z",
  187. "last_refresh_time": "2017-02-17T05:59:59Z"
  188. }', true);
  189. }
  190. }