Payouts.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Responses;
  3. use GuzzleHttp\Utils;
  4. trait Payouts
  5. {
  6. /**
  7. * @return array
  8. */
  9. private function mockCreateBatchPayoutResponse(): array
  10. {
  11. return Utils::jsonDecode('{
  12. "batch_header": {
  13. "sender_batch_header": {
  14. "sender_batch_id": "Payouts_2018_100008",
  15. "email_subject": "You have a payout!",
  16. "email_message": "You have received a payout! Thanks for using our service!"
  17. },
  18. "payout_batch_id": "5UXD2E8A7EBQJ",
  19. "batch_status": "PENDING"
  20. }
  21. }', true);
  22. }
  23. /**
  24. * @return array
  25. */
  26. private function showBatchPayoutResponse(): array
  27. {
  28. return Utils::jsonDecode('{
  29. "batch_header": {
  30. "payout_batch_id": "FYXMPQTX4JC9N",
  31. "batch_status": "PROCESSING",
  32. "time_created": "2014-01-27T10:17:00Z",
  33. "time_completed": "2014-01-27T11:17:39.00Z",
  34. "sender_batch_header": {
  35. "sender_batch_id": "Payouts_2018_100009",
  36. "email_subject": "You have a payout!"
  37. },
  38. "amount": {
  39. "value": "438.35",
  40. "currency": "USD"
  41. },
  42. "fees": {
  43. "value": "5.84",
  44. "currency": "USD"
  45. }
  46. },
  47. "items": [
  48. {
  49. "payout_item_id": "DUCD8GC3VUKVE",
  50. "transaction_id": "6KA23440H1057442S",
  51. "transaction_status": "SUCCESS",
  52. "payout_batch_id": "FYXMPQTX4JC9N",
  53. "payout_item_fee": {
  54. "currency": "USD",
  55. "value": "1.00"
  56. },
  57. "payout_item": {
  58. "recipient_type": "EMAIL",
  59. "amount": {
  60. "value": "65.24",
  61. "currency": "USD"
  62. },
  63. "note": "Thanks for your patronage!",
  64. "receiver": "receiver@example.com",
  65. "sender_item_id": "14Feb_978"
  66. },
  67. "time_processed": "2014-01-27T10:18:32Z"
  68. },
  69. {
  70. "payout_item_id": "LGMEPRKTK7FQA",
  71. "transaction_id": "8K128187J1102003K",
  72. "transaction_status": "SUCCESS",
  73. "payout_batch_id": "FYXMPQTX4JC9N",
  74. "payout_item_fee": {
  75. "currency": "USD",
  76. "value": "1.00"
  77. },
  78. "payout_item": {
  79. "recipient_type": "EMAIL",
  80. "amount": {
  81. "value": "59.87",
  82. "currency": "USD"
  83. },
  84. "note": "Thanks for your patronage!",
  85. "receiver": "receiver2@example.com",
  86. "sender_item_id": "14Feb_321"
  87. },
  88. "time_processed": "2014-01-27T10:18:15Z"
  89. },
  90. {
  91. "payout_item_id": "BQ8GT9VG64EFS",
  92. "transaction_id": "57382391EC1682714",
  93. "transaction_status": "SUCCESS",
  94. "payout_batch_id": "FYXMPQTX4JC9N",
  95. "payout_item_fee": {
  96. "currency": "USD",
  97. "value": "1.00"
  98. },
  99. "payout_item": {
  100. "recipient_type": "EMAIL",
  101. "amount": {
  102. "value": "59.87",
  103. "currency": "USD"
  104. },
  105. "note": "Thanks for your patronage!",
  106. "receiver": "receiver3@example.com",
  107. "sender_item_id": "14Feb_239"
  108. },
  109. "time_processed": "2014-01-27T10:17:15Z"
  110. },
  111. {
  112. "payout_item_id": "LHKZN4VT93L2Q",
  113. "transaction_id": "1LG71547D1353984N",
  114. "transaction_status": "SUCCESS",
  115. "payout_batch_id": "FYXMPQTX4JC9N",
  116. "payout_item_fee": {
  117. "value": "USD",
  118. "currency": "0.75"
  119. },
  120. "payout_item": {
  121. "recipient_type": "EMAIL",
  122. "amount": {
  123. "value": "19.87",
  124. "currency": "USD"
  125. },
  126. "note": "Thanks for your patronage!",
  127. "receiver": "receiver4@example.com",
  128. "sender_item_id": "14Feb_235"
  129. },
  130. "time_processed": "2014-01-27T10:17:25Z"
  131. },
  132. {
  133. "payout_item_id": "4ZF3VZHHTQJG6",
  134. "transaction_id": "4BD48613EX3256543",
  135. "transaction_status": "SUCCESS",
  136. "payout_batch_id": "FYXMPQTX4JC9N",
  137. "payout_item_fee": {
  138. "currency": "USD",
  139. "value": "0.75"
  140. },
  141. "payout_item": {
  142. "recipient_type": "EMAIL",
  143. "amount": {
  144. "value": "9.87",
  145. "currency": "USD"
  146. },
  147. "note": "Thanks for your patronage!",
  148. "receiver": "receiver@example.com",
  149. "sender_item_id": "14Feb_234"
  150. },
  151. "time_processed": "2014-01-27T10:17:37Z"
  152. },
  153. {
  154. "payout_item_id": "DTCJCQ6LMH8JQ",
  155. "transaction_id": "25F63571CL9929422",
  156. "transaction_status": "SUCCESS",
  157. "payout_item_fee": {
  158. "currency": "USD",
  159. "value": "2.35"
  160. },
  161. "payout_batch_id": "FYXMPQTX4JC9N",
  162. "payout_item": {
  163. "recipient_type": "PHONE",
  164. "amount": {
  165. "value": "112.34",
  166. "currency": "USD"
  167. },
  168. "note": "Thanks for your support!",
  169. "receiver": "91-734-234-1234",
  170. "sender_item_id": "14Feb_235"
  171. },
  172. "time_processed": "2014-01-27T10:17:52Z"
  173. },
  174. {
  175. "payout_item_id": "GSBDQHUAUD44A",
  176. "transaction_id": "53R03517P98080414",
  177. "transaction_status": "SUCCESS",
  178. "payout_batch_id": "FYXMPQTX4JC9N",
  179. "payout_item_fee": {
  180. "currency": "USD",
  181. "value": "2.5"
  182. },
  183. "payout_item": {
  184. "recipient_type": "PHONE",
  185. "amount": {
  186. "value": "5.32",
  187. "currency": "USD"
  188. },
  189. "note": "Thanks for your patronage!",
  190. "receiver": "408X234-1234",
  191. "sender_item_id": "14Feb_235"
  192. },
  193. "time_processed": "2014-01-27T10:17:41Z"
  194. }
  195. ],
  196. "links": [
  197. {
  198. "rel": "self",
  199. "href": "https://api-m.sandbox.paypal.com/v1/payments/payouts/FYXMPQTX4JC9N?page_size=1000&page=1",
  200. "method": "GET"
  201. }
  202. ]
  203. }', true);
  204. }
  205. /**
  206. * @return array
  207. */
  208. private function showBatchPayoutItemResponse(): array
  209. {
  210. return Utils::jsonDecode('{
  211. "payout_item_id": "8AELMXH8UB2P8",
  212. "transaction_id": "0C413693MN970190K",
  213. "activity_id": "0E158638XS0329106",
  214. "transaction_status": "SUCCESS",
  215. "payout_item_fee": {
  216. "currency": "USD",
  217. "value": "0.35"
  218. },
  219. "payout_batch_id": "Q8KVJG9TZTNN4",
  220. "payout_item": {
  221. "amount": {
  222. "value": "9.87",
  223. "currency": "USD"
  224. },
  225. "recipient_type": "EMAIL",
  226. "note": "Thanks for your patronage!",
  227. "receiver": "receiver@example.com",
  228. "sender_item_id": "14Feb_234"
  229. },
  230. "time_processed": "2018-01-27T10:17:41Z",
  231. "links": [
  232. {
  233. "rel": "self",
  234. "href": "https://api-m.sandbox.paypal.com/v1/payments/payouts-item/8AELMXH8UB2P8",
  235. "method": "GET"
  236. },
  237. {
  238. "href": "https://api-m.sandbox.paypal.com/v1/payments/payouts/Q8KVJG9TZTNN4",
  239. "rel": "batch",
  240. "method": "GET"
  241. }
  242. ]
  243. }', true);
  244. }
  245. /**
  246. * @return array
  247. */
  248. private function mockCancelUnclaimedBatchItemResponse(): array
  249. {
  250. return Utils::jsonDecode('{
  251. "payout_item_id": "5KUDKLF8SDC7S",
  252. "transaction_id": "1DG93452WK758815H",
  253. "activity_id": "0E158638XS0329101",
  254. "transaction_status": "RETURNED",
  255. "payout_item_fee": {
  256. "currency": "USD",
  257. "value": "0.35"
  258. },
  259. "payout_batch_id": "CQMWKDQF5GFLL",
  260. "sender_batch_id": "Payouts_2018_100006",
  261. "payout_item": {
  262. "recipient_type": "EMAIL",
  263. "amount": {
  264. "value": "9.87",
  265. "currency": "USD"
  266. },
  267. "note": "Thanks for your patronage!",
  268. "receiver": "receiver@example.com",
  269. "sender_item_id": "14Feb_234"
  270. },
  271. "time_processed": "2018-01-27T10:17:41Z",
  272. "errors": {
  273. "name": "RECEIVER_UNREGISTERED",
  274. "message": "Receiver is unregistered",
  275. "information_link": "https://developer.paypal.com/docs/api/payments.payouts-batch#errors"
  276. },
  277. "links": [
  278. {
  279. "rel": "self",
  280. "href": "https://api-m.sandbox.paypal.com/v1/payments/payouts-item/5KUDKLF8SDC7S",
  281. "method": "GET"
  282. },
  283. {
  284. "rel": "batch",
  285. "href": "https://api-m.sandbox.paypal.com/v1/payments/payouts/CQMWKDQF5GFLL",
  286. "method": "GET"
  287. }
  288. ]
  289. }', true);
  290. }
  291. }