InvoicesTemplates.php 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Responses;
  3. use GuzzleHttp\Utils;
  4. trait InvoicesTemplates
  5. {
  6. /**
  7. * @return array
  8. */
  9. private function mockCreateInvoiceTemplateResponse(): array
  10. {
  11. return Utils::jsonDecode('{
  12. "id": "TEMP-19V05281TU309413B",
  13. "name": "reference-temp",
  14. "default_template": true,
  15. "template_info": {
  16. "configuration": {
  17. "tax_calculated_after_discount": true,
  18. "tax_inclusive": false,
  19. "allow_tip": true,
  20. "partial_payment": {
  21. "allow_partial_payment": true,
  22. "minimum_amount_due": {
  23. "currency_code": "USD",
  24. "value": "20.00"
  25. }
  26. }
  27. },
  28. "detail": {
  29. "reference": "deal-ref",
  30. "note": "Thank you for your business.",
  31. "currency_code": "USD",
  32. "terms_and_conditions": "No refunds after 30 days.",
  33. "memo": "This is a long contract",
  34. "attachments": [
  35. {
  36. "id": "Screen Shot 2018-11-23 at 16.45.01.png",
  37. "reference_url": "https://api.paypal.com/invoice/payerView/attachments/RkG9ggQbd4Mwm1tYdcF6uuixfFTFq32bBdbE1VbtQLdKSoS2ZOYpfjw9gPp7eTrZmVaFaDWzixHXm-OXWHbmigHigHzURDxJs8IIKqcqP8jawnBEZcraEAPVMULxf5iTyOSpAUc2ugW0PWdwDbM6mg-guFAUyj3Z98H7htWNjQY95jb9heOlcSXUe.sbDUR9smAszzzJoA1NXT6rEEegwQ&version=1&sig=JNODB0xEayW8txMQm6ZsIwDnd4eh3hd6ijiRLi4ipHE"
  38. }
  39. ],
  40. "payment_term": {
  41. "term_type": "NET_10"
  42. },
  43. "metadata": {
  44. "create_time": "2018-12-03T03:38:46z"
  45. }
  46. },
  47. "invoicer": {
  48. "name": {
  49. "given_name": "David",
  50. "surname": "Larusso"
  51. },
  52. "address": {
  53. "address_line_1": "1234 First Street",
  54. "address_line_2": "337673 Hillside Court",
  55. "admin_area_2": "Anytown",
  56. "admin_area_1": "CA",
  57. "postal_code": "98765",
  58. "country_code": "US"
  59. },
  60. "email_address": "merchant@example.com",
  61. "phones": [
  62. {
  63. "country_code": "001",
  64. "national_number": "4085551234",
  65. "phone_type": "MOBILE"
  66. }
  67. ],
  68. "website": "www.test.com",
  69. "tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
  70. "logo_url": "https://example.com/logo.PNG",
  71. "additional_notes": "2-4"
  72. },
  73. "primary_recipients": [
  74. {
  75. "billing_info": {
  76. "name": {
  77. "given_name": "Stephanie",
  78. "surname": "Meyers"
  79. },
  80. "address": {
  81. "address_line_1": "1234 Main Street",
  82. "admin_area_2": "Anytown",
  83. "admin_area_1": "CA",
  84. "postal_code": "98765",
  85. "country_code": "US"
  86. },
  87. "email_address": "bill-me@example.com",
  88. "phones": [
  89. {
  90. "country_code": "001",
  91. "national_number": "4884551234",
  92. "phone_type": "MOBILE"
  93. }
  94. ],
  95. "additional_info": "add-info"
  96. },
  97. "shipping_info": {
  98. "name": {
  99. "given_name": "Stephanie",
  100. "surname": "Meyers"
  101. },
  102. "address": {
  103. "address_line_1": "1234 Main Street",
  104. "admin_area_2": "Anytown",
  105. "admin_area_1": "CA",
  106. "postal_code": "98765",
  107. "country_code": "US"
  108. }
  109. }
  110. }
  111. ],
  112. "additional_recipients": [
  113. "inform-me@example.com"
  114. ],
  115. "items": [
  116. {
  117. "id": "ITEM-9R873787D1610780X",
  118. "name": "Yoga Mat",
  119. "description": "new watch",
  120. "quantity": "1",
  121. "unit_amount": {
  122. "currency_code": "USD",
  123. "value": "50.00"
  124. },
  125. "tax": {
  126. "id": "TAX-9R873787D1610780X",
  127. "name": "Sales Tax",
  128. "percent": "7.25",
  129. "amount": {
  130. "currency_code": "USD",
  131. "value": "3.27"
  132. }
  133. },
  134. "discount": {
  135. "percent": "5",
  136. "amount": {
  137. "currency_code": "USD",
  138. "value": "2.5"
  139. }
  140. },
  141. "unit_of_measure": "QUANTITY"
  142. },
  143. {
  144. "id": "ITEM-4XD34145EH4061035",
  145. "name": "Yoga T Shirt",
  146. "quantity": "1",
  147. "unit_amount": {
  148. "currency_code": "USD",
  149. "value": "10.00"
  150. },
  151. "tax": {
  152. "id": "TAX-4XD34145EH4061035",
  153. "name": "Sales Tax",
  154. "percent": "7.25",
  155. "amount": {
  156. "currency_code": "USD",
  157. "value": "0.34"
  158. }
  159. },
  160. "discount": {
  161. "amount": {
  162. "currency_code": "USD",
  163. "value": "5.00"
  164. }
  165. },
  166. "unit_of_measure": "QUANTITY"
  167. }
  168. ],
  169. "amount": {
  170. "currency_code": "USD",
  171. "value": "74.21",
  172. "breakdown": {
  173. "item_total": {
  174. "currency_code": "USD",
  175. "value": "60.00"
  176. },
  177. "custom": {
  178. "label": "Packing Charges",
  179. "amount": {
  180. "currency_code": "USD",
  181. "value": "10.00"
  182. }
  183. },
  184. "shipping": {
  185. "amount": {
  186. "currency_code": "USD",
  187. "value": "10.00"
  188. },
  189. "tax": {
  190. "name": "Sales Tax",
  191. "percent": "7.25",
  192. "amount": {
  193. "currency_code": "USD",
  194. "value": "0.73"
  195. }
  196. }
  197. },
  198. "discount": {
  199. "item_discount": {
  200. "currency_code": "USD",
  201. "value": "-7.50"
  202. },
  203. "invoice_discount": {
  204. "percent": "5",
  205. "amount": {
  206. "currency_code": "USD",
  207. "value": "-2.63"
  208. }
  209. }
  210. },
  211. "tax_total": {
  212. "currency_code": "USD",
  213. "value": "4.34"
  214. }
  215. }
  216. }
  217. },
  218. "settings": {
  219. "template_item_settings": [
  220. {
  221. "field_name": "items.date",
  222. "display_preference": {
  223. "hidden": true
  224. }
  225. },
  226. {
  227. "field_name": "items.discount",
  228. "display_preference": {
  229. "hidden": false
  230. }
  231. },
  232. {
  233. "field_name": "items.tax",
  234. "display_preference": {
  235. "hidden": false
  236. }
  237. },
  238. {
  239. "field_name": "items.description",
  240. "display_preference": {
  241. "hidden": false
  242. }
  243. },
  244. {
  245. "field_name": "items.quantity",
  246. "display_preference": {
  247. "hidden": true
  248. }
  249. }
  250. ],
  251. "template_subtotal_settings": [
  252. {
  253. "field_name": "custom",
  254. "display_preference": {
  255. "hidden": false
  256. }
  257. },
  258. {
  259. "field_name": "discount",
  260. "display_preference": {
  261. "hidden": false
  262. }
  263. },
  264. {
  265. "field_name": "shipping",
  266. "display_preference": {
  267. "hidden": false
  268. }
  269. }
  270. ]
  271. },
  272. "unit_of_measure": "QUANTITY",
  273. "standard_template": false,
  274. "links": [
  275. {
  276. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  277. "rel": "self",
  278. "method": "GET"
  279. },
  280. {
  281. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  282. "rel": "delete",
  283. "method": "DELETE"
  284. },
  285. {
  286. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  287. "rel": "replace",
  288. "method": "PUT"
  289. }
  290. ]
  291. }', true);
  292. }
  293. /**
  294. * @return array
  295. */
  296. private function mockListInvoiceTemplateResponse()
  297. {
  298. return Utils::jsonDecode('{
  299. "addresses": [
  300. {
  301. "address_line_1": "1234 First Street",
  302. "address_line_2": "337673 Hillside Court",
  303. "admin_area_2": "Anytown",
  304. "admin_area_1": "CA",
  305. "postal_code": "98765",
  306. "country_code": "US"
  307. },
  308. {
  309. "address_line_1": "26303 E 8216 N",
  310. "address_line_2": "045608 Ocean Bay Plaza #02",
  311. "admin_area_2": "Garden City",
  312. "admin_area_1": "NY",
  313. "postal_code": "11530",
  314. "country_code": "US"
  315. }
  316. ],
  317. "emails": "email@example.com, email2@example.com",
  318. "phones": [
  319. {
  320. "country_code": "001",
  321. "national_number": "4085551234",
  322. "phone_type": "HOME"
  323. },
  324. {
  325. "country_code": "1",
  326. "national_number": "3477832250",
  327. "phone_type": "MOBILE"
  328. },
  329. {
  330. "country_code": "1",
  331. "national_number": "3479543267",
  332. "phone_type": "FAX"
  333. },
  334. {
  335. "country_code": "1",
  336. "national_number": "7183514942",
  337. "phone_type": "OTHER"
  338. }
  339. ],
  340. "templates": [
  341. {
  342. "id": "TEMP-19V05281TU309413B",
  343. "name": "reference-temp",
  344. "default_template": true,
  345. "template_info": {
  346. "configuration": {
  347. "tax_calculated_after_discount": true,
  348. "tax_inclusive": false,
  349. "allow_tip": true,
  350. "partial_payment": {
  351. "allow_partial_payment": true,
  352. "minimum_amount_due": {
  353. "currency_code": "USD",
  354. "value": "20.00"
  355. }
  356. }
  357. },
  358. "detail": {
  359. "reference": "deal-ref",
  360. "currency_code": "USD",
  361. "note": "Thank you for your business.",
  362. "terms_and_conditions": "No refunds after 30 days.",
  363. "memo": "This is a long contract",
  364. "attachments": [
  365. {
  366. "id": "Screen Shot 2018-11-23 at 16.45.01.png",
  367. "reference_url": "https://exxample.com/invoice/payerView/attachments/RkG9ggQbd4Mwm1tYdcF6uuixfFTFq32bBdbE1VbtQLdKSoS2ZOYpfjw9gPp7eTrZmVaFaDWzixHXm-OXWHbmigHigHzURDxJs8IIKqcqP8jawnBEZcraEAPVMULxf5iTyOSpAUc2ugW0PWdwDbM6mg-guFAUyj3Z98H7htWNjQY95jb9heOlcSXUe.sbDUR9smAszzzJoA1NXT6rEEegwQ&version=1&sig=JNODB0xEayW8txMQm6ZsIwDnd4eh3hd6ijiRLi4ipHE"
  368. }
  369. ],
  370. "payment_term": {
  371. "term_type": "NET_10"
  372. },
  373. "metadata": {
  374. "create_time": "2018-12-03T03:38:46z"
  375. }
  376. },
  377. "invoicer": {
  378. "name": {
  379. "given_name": "David",
  380. "surname": "Larusso"
  381. },
  382. "address": {
  383. "address_line_1": "1234 First Street",
  384. "address_line_2": "337673 Hillside Court",
  385. "admin_area_2": "Anytown",
  386. "admin_area_1": "CA",
  387. "postal_code": "98765",
  388. "country_code": "US"
  389. },
  390. "email_address": "merchant@example.com",
  391. "phones": [
  392. {
  393. "country_code": "001",
  394. "national_number": "4085551234",
  395. "phone_type": "MOBILE"
  396. }
  397. ],
  398. "website": "www.test.com",
  399. "tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
  400. "logo_url": "https://example.com/logo.PNG",
  401. "additional_notes": "2-4"
  402. },
  403. "primary_recipients": [
  404. {
  405. "billing_info": {
  406. "name": {
  407. "given_name": "Stephanie",
  408. "surname": "Meyers"
  409. },
  410. "address": {
  411. "address_line_1": "1234 Main Street",
  412. "admin_area_2": "Anytown",
  413. "admin_area_1": "CA",
  414. "postal_code": "98765",
  415. "country_code": "US"
  416. },
  417. "email_address": "bill-me@example.com",
  418. "phones": [
  419. {
  420. "country_code": "001",
  421. "national_number": "4884551234",
  422. "phone_type": "MOBILE"
  423. }
  424. ],
  425. "additional_info": "add-info"
  426. },
  427. "shipping_info": {
  428. "name": {
  429. "given_name": "Stephanie",
  430. "surname": "Meyers"
  431. },
  432. "address": {
  433. "address_line_1": "1234 Main Street",
  434. "admin_area_2": "Anytown",
  435. "admin_area_1": "CA",
  436. "postal_code": "98765",
  437. "country_code": "US"
  438. }
  439. }
  440. }
  441. ],
  442. "additional_recipients": [
  443. "inform-me@example.com"
  444. ],
  445. "items": [
  446. {
  447. "id": "ITEM-9R873787D1610780X",
  448. "name": "Yoga Mat",
  449. "description": "new watch",
  450. "quantity": "1",
  451. "unit_amount": {
  452. "currency_code": "USD",
  453. "value": "50.00"
  454. },
  455. "tax": {
  456. "id": "TAX-9R873787D1610780X",
  457. "name": "Sales Tax",
  458. "percent": "7.25",
  459. "amount": {
  460. "currency_code": "USD",
  461. "value": "3.27"
  462. }
  463. },
  464. "discount": {
  465. "percent": "5",
  466. "amount": {
  467. "currency_code": "USD",
  468. "value": "2.5"
  469. }
  470. },
  471. "unit_of_measure": "QUANTITY"
  472. },
  473. {
  474. "id": "ITEM-4XD34145EH4061035",
  475. "name": "Yoga t-shirt",
  476. "quantity": "1",
  477. "unit_amount": {
  478. "currency_code": "USD",
  479. "value": "10.00"
  480. },
  481. "tax": {
  482. "id": "TAX-4XD34145EH4061035",
  483. "name": "Sales Tax",
  484. "percent": "7.25",
  485. "amount": {
  486. "currency_code": "USD",
  487. "value": "0.34"
  488. }
  489. },
  490. "discount": {
  491. "amount": {
  492. "currency_code": "USD",
  493. "value": "5.00"
  494. }
  495. },
  496. "unit_of_measure": "QUANTITY"
  497. }
  498. ],
  499. "amount": {
  500. "currency_code": "USD",
  501. "value": "74.21",
  502. "breakdown": {
  503. "item_total": {
  504. "currency_code": "USD",
  505. "value": "60.00"
  506. },
  507. "custom": {
  508. "label": "Packing Charges",
  509. "amount": {
  510. "currency_code": "USD",
  511. "value": "10.00"
  512. }
  513. },
  514. "shipping": {
  515. "amount": {
  516. "currency_code": "USD",
  517. "value": "10.00"
  518. },
  519. "tax": {
  520. "name": "Sales Tax",
  521. "percent": "7.25",
  522. "amount": {
  523. "currency_code": "USD",
  524. "value": "0.73"
  525. }
  526. }
  527. },
  528. "discount": {
  529. "item_discount": {
  530. "currency_code": "USD",
  531. "value": "-7.50"
  532. },
  533. "invoice_discount": {
  534. "percent": "5",
  535. "amount": {
  536. "currency_code": "USD",
  537. "value": "-2.63"
  538. }
  539. }
  540. },
  541. "tax_total": {
  542. "currency_code": "USD",
  543. "value": "4.34"
  544. }
  545. }
  546. }
  547. },
  548. "settings": {
  549. "template_item_settings": [
  550. {
  551. "field_name": "items.date",
  552. "display_preference": {
  553. "hidden": true
  554. }
  555. },
  556. {
  557. "field_name": "items.discount",
  558. "display_preference": {
  559. "hidden": false
  560. }
  561. },
  562. {
  563. "field_name": "items.tax",
  564. "display_preference": {
  565. "hidden": false
  566. }
  567. },
  568. {
  569. "field_name": "items.description",
  570. "display_preference": {
  571. "hidden": false
  572. }
  573. },
  574. {
  575. "field_name": "items.quantity",
  576. "display_preference": {
  577. "hidden": true
  578. }
  579. }
  580. ],
  581. "template_subtotal_settings": [
  582. {
  583. "field_name": "custom",
  584. "display_preference": {
  585. "hidden": false
  586. }
  587. },
  588. {
  589. "field_name": "discount",
  590. "display_preference": {
  591. "hidden": false
  592. }
  593. },
  594. {
  595. "field_name": "shipping",
  596. "display_preference": {
  597. "hidden": false
  598. }
  599. }
  600. ]
  601. },
  602. "unit_of_measure": "QUANTITY",
  603. "standard_template": false,
  604. "links": [
  605. {
  606. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  607. "rel": "self",
  608. "method": "GET"
  609. }
  610. ]
  611. },
  612. {
  613. "default_template": true,
  614. "id": "TEMP-11E67842VH3080617",
  615. "name": "Quantity",
  616. "template_info": {
  617. "invoicer": {
  618. "name": {
  619. "given_name": "David",
  620. "surname": "Larusso"
  621. },
  622. "email_address": "bill-me@example.com"
  623. },
  624. "detail": {
  625. "currency_code": "USD"
  626. }
  627. },
  628. "standard_template": false,
  629. "links": [
  630. {
  631. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-11E67842VH3080617",
  632. "rel": "self",
  633. "method": "GET"
  634. }
  635. ]
  636. },
  637. {
  638. "default_template": false,
  639. "id": "TEMP-6HC14139B8663074X",
  640. "name": "Hours",
  641. "template_info": {
  642. "invoicer": {
  643. "name": {
  644. "given_name": "David",
  645. "surname": "Larusso"
  646. },
  647. "email_address": "bill-me@example.com"
  648. },
  649. "detail": {
  650. "currency_code": "USD"
  651. }
  652. },
  653. "standard_template": false,
  654. "links": [
  655. {
  656. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-6HC14139B8663074X",
  657. "rel": "self",
  658. "method": "GET"
  659. }
  660. ]
  661. }
  662. ]
  663. }', true);
  664. }
  665. /**
  666. * @return array
  667. */
  668. private function mockUpdateInvoiceTemplateResponse()
  669. {
  670. return Utils::jsonDecode('{
  671. "id": "TEMP-19V05281TU309413B",
  672. "name": "reference-temp",
  673. "default_template": true,
  674. "template_info": {
  675. "configuration": {
  676. "tax_calculated_after_discount": true,
  677. "tax_inclusive": false,
  678. "allow_tip": true,
  679. "partial_payment": {
  680. "allow_partial_payment": true,
  681. "minimum_amount_due": {
  682. "currency_code": "USD",
  683. "value": "20.00"
  684. }
  685. }
  686. },
  687. "detail": {
  688. "reference": "deal-reference-value",
  689. "currency_code": "USD",
  690. "note": "Thank you for your business.",
  691. "terms_and_conditions": "No refunds after 30 days.",
  692. "memo": "This is a long contract",
  693. "attachments": [
  694. {
  695. "id": "Screen Shot 2018-11-23 at 16.45.01.png",
  696. "reference_url": "https://api.paypal.com/invoice/payerView/attachments/RkG9ggQbd4Mwm1tYdcF6uuixfFTFq32bBdbE1VbtQLdKSoS2ZOYpfjw9gPp7eTrZmVaFaDWzixHXm-OXWHbmigHigHzURDxJs8IIKqcqP8jawnBEZcraEAPVMULxf5iTyOSpAUc2ugW0PWdwDbM6mg-guFAUyj3Z98H7htWNjQY95jb9heOlcSXUe.sbDUR9smAszzzJoA1NXT6rEEegwQ&version=1&sig=JNODB0xEayW8txMQm6ZsIwDnd4eh3hd6ijiRLi4ipHE"
  697. }
  698. ],
  699. "payment_term": {
  700. "term_type": "NET_10"
  701. },
  702. "metadata": {
  703. "create_time": "2018-12-03T03:38:46z"
  704. }
  705. },
  706. "invoicer": {
  707. "name": {
  708. "given_name": "David",
  709. "surname": "Larusso"
  710. },
  711. "address": {
  712. "address_line_1": "1234 First Street",
  713. "address_line_2": "337673 Hillside Court",
  714. "admin_area_2": "Anytown",
  715. "admin_area_1": "CA",
  716. "postal_code": "98765",
  717. "country_code": "US"
  718. },
  719. "email_address": "merchant@example.com",
  720. "phones": [
  721. {
  722. "country_code": "001",
  723. "national_number": "4085551234",
  724. "phone_type": "MOBILE"
  725. }
  726. ],
  727. "website": "www.test.com",
  728. "tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
  729. "logo_url": "https://example.com/logo.PNG",
  730. "additional_notes": "2-4"
  731. },
  732. "primary_recipients": [
  733. {
  734. "billing_info": {
  735. "name": {
  736. "given_name": "Stephanie",
  737. "surname": "Meyers"
  738. },
  739. "address": {
  740. "address_line_1": "1234 Main Street",
  741. "admin_area_2": "Anytown",
  742. "admin_area_1": "CA",
  743. "postal_code": "98765",
  744. "country_code": "US"
  745. },
  746. "email_address": "bill-me@example.com",
  747. "phones": [
  748. {
  749. "country_code": "001",
  750. "national_number": "4884551234",
  751. "phone_type": "MOBILE"
  752. }
  753. ],
  754. "additional_info": "add-info"
  755. },
  756. "shipping_info": {
  757. "name": {
  758. "given_name": "Stephanie",
  759. "surname": "Meyers"
  760. },
  761. "address": {
  762. "address_line_1": "1234 Main Street",
  763. "admin_area_2": "Anytown",
  764. "admin_area_1": "CA",
  765. "postal_code": "98765",
  766. "country_code": "US"
  767. }
  768. }
  769. }
  770. ],
  771. "additional_recipients": [
  772. "inform-me@example.com"
  773. ],
  774. "items": [
  775. {
  776. "id": "ITEM-9R873787D1610780X",
  777. "name": "Yoga Mat",
  778. "description": "new watch",
  779. "quantity": "1",
  780. "unit_amount": {
  781. "currency_code": "USD",
  782. "value": "50.00"
  783. },
  784. "tax": {
  785. "id": "TAX-9R873787D1610780X",
  786. "name": "Sales Tax",
  787. "percent": "7.25",
  788. "amount": {
  789. "currency_code": "USD",
  790. "value": "3.27"
  791. }
  792. },
  793. "discount": {
  794. "percent": "5",
  795. "amount": {
  796. "currency_code": "USD",
  797. "value": "2.5"
  798. }
  799. },
  800. "unit_of_measure": "QUANTITY"
  801. },
  802. {
  803. "id": "ITEM-4XD34145EH4061035",
  804. "name": "Yoga T Shirt",
  805. "quantity": "1",
  806. "unit_amount": {
  807. "currency_code": "USD",
  808. "value": "10.00"
  809. },
  810. "tax": {
  811. "id": "TAX-4XD34145EH4061035",
  812. "name": "Sales Tax",
  813. "percent": "7.25",
  814. "amount": {
  815. "currency_code": "USD",
  816. "value": "0.34"
  817. }
  818. },
  819. "discount": {
  820. "amount": {
  821. "currency_code": "USD",
  822. "value": "5.00"
  823. }
  824. },
  825. "unit_of_measure": "QUANTITY"
  826. }
  827. ],
  828. "amount": {
  829. "currency_code": "USD",
  830. "value": "74.21",
  831. "breakdown": {
  832. "item_total": {
  833. "currency_code": "USD",
  834. "value": "60.00"
  835. },
  836. "custom": {
  837. "label": "Packing Charges",
  838. "amount": {
  839. "currency_code": "USD",
  840. "value": "10.00"
  841. }
  842. },
  843. "shipping": {
  844. "amount": {
  845. "currency_code": "USD",
  846. "value": "10.00"
  847. },
  848. "tax": {
  849. "name": "Sales Tax",
  850. "percent": "7.25",
  851. "amount": {
  852. "currency_code": "USD",
  853. "value": "0.73"
  854. }
  855. }
  856. },
  857. "discount": {
  858. "item_discount": {
  859. "currency_code": "USD",
  860. "value": "-7.50"
  861. },
  862. "invoice_discount": {
  863. "percent": "5",
  864. "amount": {
  865. "currency_code": "USD",
  866. "value": "-2.63"
  867. }
  868. }
  869. },
  870. "tax_total": {
  871. "currency_code": "USD",
  872. "value": "4.34"
  873. }
  874. }
  875. }
  876. },
  877. "settings": {
  878. "template_item_settings": [
  879. {
  880. "field_name": "items.date",
  881. "display_preference": {
  882. "hidden": true
  883. }
  884. },
  885. {
  886. "field_name": "items.discount",
  887. "display_preference": {
  888. "hidden": false
  889. }
  890. },
  891. {
  892. "field_name": "items.tax",
  893. "display_preference": {
  894. "hidden": false
  895. }
  896. },
  897. {
  898. "field_name": "items.description",
  899. "display_preference": {
  900. "hidden": false
  901. }
  902. },
  903. {
  904. "field_name": "items.quantity",
  905. "display_preference": {
  906. "hidden": true
  907. }
  908. }
  909. ],
  910. "template_subtotal_settings": [
  911. {
  912. "field_name": "custom",
  913. "display_preference": {
  914. "hidden": false
  915. }
  916. },
  917. {
  918. "field_name": "discount",
  919. "display_preference": {
  920. "hidden": false
  921. }
  922. },
  923. {
  924. "field_name": "shipping",
  925. "display_preference": {
  926. "hidden": false
  927. }
  928. }
  929. ]
  930. },
  931. "unit_of_measure": "QUANTITY",
  932. "standard_template": false,
  933. "links": [
  934. {
  935. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  936. "rel": "self",
  937. "method": "GET"
  938. },
  939. {
  940. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  941. "rel": "delete",
  942. "method": "DELETE"
  943. },
  944. {
  945. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  946. "rel": "replace",
  947. "method": "PUT"
  948. }
  949. ]
  950. }', true);
  951. }
  952. /**
  953. * @return array
  954. */
  955. private function mockGetInvoiceTemplateResponse()
  956. {
  957. return Utils::jsonDecode('{
  958. "id": "TEMP-19V05281TU309413B",
  959. "name": "reference-temp",
  960. "default_template": true,
  961. "template_info": {
  962. "configuration": {
  963. "tax_calculated_after_discount": true,
  964. "tax_inclusive": false,
  965. "allow_tip": true,
  966. "partial_payment": {
  967. "allow_partial_payment": true,
  968. "minimum_amount_due": {
  969. "currency_code": "USD",
  970. "value": "20.00"
  971. }
  972. }
  973. },
  974. "detail": {
  975. "reference": "deal-ref",
  976. "currency_code": "USD",
  977. "note": "Thank you for your business.",
  978. "terms_and_conditions": "No refunds after 30 days.",
  979. "memo": "This is a long contract",
  980. "attachments": [
  981. {
  982. "id": "Screen Shot 2018-11-23 at 16.45.01.png",
  983. "reference_url": "https://api.paypal.com/invoice/payerView/attachments/RkG9ggQbd4Mwm1tYdcF6uuixfFTFq32bBdbE1VbtQLdKSoS2ZOYpfjw9gPp7eTrZmVaFaDWzixHXm-OXWHbmigHigHzURDxJs8IIKqcqP8jawnBEZcraEAPVMULxf5iTyOSpAUc2ugW0PWdwDbM6mg-guFAUyj3Z98H7htWNjQY95jb9heOlcSXUe.sbDUR9smAszzzJoA1NXT6rEEegwQ&version=1&sig=JNODB0xEayW8txMQm6ZsIwDnd4eh3hd6ijiRLi4ipHE"
  984. }
  985. ],
  986. "payment_term": {
  987. "term_type": "NET_10"
  988. },
  989. "metadata": {
  990. "create_time": "2018-12-03T03:38:46z"
  991. }
  992. },
  993. "invoicer": {
  994. "name": {
  995. "given_name": "David",
  996. "surname": "Larusso"
  997. },
  998. "address": {
  999. "address_line_1": "1234 First Street",
  1000. "address_line_2": "337673 Hillside Court",
  1001. "admin_area_2": "Anytown",
  1002. "admin_area_1": "CA",
  1003. "postal_code": "98765",
  1004. "country_code": "US"
  1005. },
  1006. "email_address": "merchant@example.com",
  1007. "phones": [
  1008. {
  1009. "country_code": "001",
  1010. "national_number": "4085551234",
  1011. "phone_type": "MOBILE"
  1012. }
  1013. ],
  1014. "website": "www.test.com",
  1015. "tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
  1016. "logo_url": "https://example.com/logo.PNG",
  1017. "additional_notes": "2-4"
  1018. },
  1019. "primary_recipients": [
  1020. {
  1021. "billing_info": {
  1022. "name": {
  1023. "given_name": "Stephanie",
  1024. "surname": "Meyers"
  1025. },
  1026. "address": {
  1027. "address_line_1": "1234 Main Street",
  1028. "admin_area_2": "Anytown",
  1029. "admin_area_1": "CA",
  1030. "postal_code": "98765",
  1031. "country_code": "US"
  1032. },
  1033. "email_address": "bill-me@example.com",
  1034. "phones": [
  1035. {
  1036. "country_code": "001",
  1037. "national_number": "4884551234",
  1038. "phone_type": "MOBILE"
  1039. }
  1040. ],
  1041. "additional_info": "add-info"
  1042. },
  1043. "shipping_info": {
  1044. "name": {
  1045. "given_name": "Stephanie",
  1046. "surname": "Meyers"
  1047. },
  1048. "address": {
  1049. "address_line_1": "1234 Main Street",
  1050. "admin_area_2": "Anytown",
  1051. "admin_area_1": "CA",
  1052. "postal_code": "98765",
  1053. "country_code": "US"
  1054. }
  1055. }
  1056. }
  1057. ],
  1058. "additional_recipients": [
  1059. "inform-me@example.com"
  1060. ],
  1061. "items": [
  1062. {
  1063. "id": "ITEM-9R873787D1610780X",
  1064. "name": "Yoga Mat",
  1065. "description": "new watch",
  1066. "quantity": "1",
  1067. "unit_amount": {
  1068. "currency_code": "USD",
  1069. "value": "50.00"
  1070. },
  1071. "tax": {
  1072. "id": "TAX-9R873787D1610780X",
  1073. "name": "Sales Tax",
  1074. "percent": "7.25",
  1075. "amount": {
  1076. "currency_code": "USD",
  1077. "value": "3.27"
  1078. }
  1079. },
  1080. "discount": {
  1081. "percent": "5",
  1082. "amount": {
  1083. "currency_code": "USD",
  1084. "value": "2.5"
  1085. }
  1086. },
  1087. "unit_of_measure": "QUANTITY"
  1088. },
  1089. {
  1090. "id": "ITEM-4XD34145EH4061035",
  1091. "name": "Yoga T Shirt",
  1092. "quantity": "1",
  1093. "unit_amount": {
  1094. "currency_code": "USD",
  1095. "value": "10.00"
  1096. },
  1097. "tax": {
  1098. "id": "TAX-4XD34145EH4061035",
  1099. "name": "Sales Tax",
  1100. "percent": "7.25",
  1101. "amount": {
  1102. "currency_code": "USD",
  1103. "value": "0.34"
  1104. }
  1105. },
  1106. "discount": {
  1107. "amount": {
  1108. "currency_code": "USD",
  1109. "value": "5.00"
  1110. }
  1111. },
  1112. "unit_of_measure": "QUANTITY"
  1113. }
  1114. ],
  1115. "amount": {
  1116. "currency_code": "USD",
  1117. "value": "74.21",
  1118. "breakdown": {
  1119. "item_total": {
  1120. "currency_code": "USD",
  1121. "value": "60.00"
  1122. },
  1123. "custom": {
  1124. "label": "Packing Charges",
  1125. "amount": {
  1126. "currency_code": "USD",
  1127. "value": "10.00"
  1128. }
  1129. },
  1130. "shipping": {
  1131. "amount": {
  1132. "currency_code": "USD",
  1133. "value": "10.00"
  1134. },
  1135. "tax": {
  1136. "name": "Sales Tax",
  1137. "percent": "7.25",
  1138. "amount": {
  1139. "currency_code": "USD",
  1140. "value": "0.73"
  1141. }
  1142. }
  1143. },
  1144. "discount": {
  1145. "item_discount": {
  1146. "currency_code": "USD",
  1147. "value": "-7.50"
  1148. },
  1149. "invoice_discount": {
  1150. "percent": "5",
  1151. "amount": {
  1152. "currency_code": "USD",
  1153. "value": "-2.63"
  1154. }
  1155. }
  1156. },
  1157. "tax_total": {
  1158. "currency_code": "USD",
  1159. "value": "4.34"
  1160. }
  1161. }
  1162. }
  1163. },
  1164. "settings": {
  1165. "template_item_settings": [
  1166. {
  1167. "field_name": "items.date",
  1168. "display_preference": {
  1169. "hidden": true
  1170. }
  1171. },
  1172. {
  1173. "field_name": "items.discount",
  1174. "display_preference": {
  1175. "hidden": false
  1176. }
  1177. },
  1178. {
  1179. "field_name": "items.tax",
  1180. "display_preference": {
  1181. "hidden": false
  1182. }
  1183. },
  1184. {
  1185. "field_name": "items.description",
  1186. "display_preference": {
  1187. "hidden": false
  1188. }
  1189. },
  1190. {
  1191. "field_name": "items.quantity",
  1192. "display_preference": {
  1193. "hidden": true
  1194. }
  1195. }
  1196. ],
  1197. "template_subtotal_settings": [
  1198. {
  1199. "field_name": "custom",
  1200. "display_preference": {
  1201. "hidden": false
  1202. }
  1203. },
  1204. {
  1205. "field_name": "discount",
  1206. "display_preference": {
  1207. "hidden": false
  1208. }
  1209. },
  1210. {
  1211. "field_name": "shipping",
  1212. "display_preference": {
  1213. "hidden": false
  1214. }
  1215. }
  1216. ]
  1217. },
  1218. "unit_of_measure": "QUANTITY",
  1219. "standard_template": false,
  1220. "links": [
  1221. {
  1222. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  1223. "rel": "self",
  1224. "method": "GET"
  1225. },
  1226. {
  1227. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  1228. "rel": "delete",
  1229. "method": "DELETE"
  1230. },
  1231. {
  1232. "href": "https://api.paypal.com/v2/invoicing/templates/TEMP-19V05281TU309413B",
  1233. "rel": "replace",
  1234. "method": "PUT"
  1235. }
  1236. ]
  1237. }', true);
  1238. }
  1239. }