PartnerReferrals.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Responses;
  3. use GuzzleHttp\Utils;
  4. trait PartnerReferrals
  5. {
  6. private function mockCreatePartnerReferralsResponse(): array
  7. {
  8. return Utils::jsonDecode('{
  9. "links": [
  10. {
  11. "href": "https://uri.paypal.com/v2/customer/partner-referrals/ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
  12. "rel": "self",
  13. "method": "GET"
  14. },
  15. {
  16. "href": "https://www.paypal.com/merchantsignup/partner/onboardingentry?token=ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
  17. "rel": "action_url",
  18. "method": "GET"
  19. }
  20. ]
  21. }', true);
  22. }
  23. private function mockShowReferralDataResponse(): array
  24. {
  25. return Utils::jsonDecode('{
  26. "partner_referral_id": "ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
  27. "submitter_payer_id": "RFYUH2QQDGUQU",
  28. "referral_data": {
  29. "individual_owners": [
  30. {
  31. "names": [
  32. {
  33. "prefix": "Mr.",
  34. "given_name": "John",
  35. "surname": "Doe",
  36. "middle_name": "Middle",
  37. "suffix": "Jr.",
  38. "full_name": "John Middle Doe Jr.",
  39. "type": "LEGAL"
  40. }
  41. ],
  42. "citizenship": "US",
  43. "addresses": [
  44. {
  45. "address_line_1": "One Washington Square",
  46. "address_line_2": "Apt 123",
  47. "admin_area_2": "San Jose",
  48. "admin_area_1": "CA",
  49. "postal_code": "95112",
  50. "country_code": "US",
  51. "type": "HOME"
  52. }
  53. ],
  54. "phones": [
  55. {
  56. "country_code": "1",
  57. "national_number": "6692468839",
  58. "extension_number": "1234",
  59. "type": "MOBILE"
  60. }
  61. ],
  62. "birth_details": {
  63. "date_of_birth": "1955-12-29"
  64. },
  65. "type": "PRIMARY"
  66. }
  67. ],
  68. "business_entity": {
  69. "business_type": {
  70. "type": "INDIVIDUAL",
  71. "subtype": "ASSO_TYPE_INCORPORATED"
  72. },
  73. "business_industry": {
  74. "category": "1004",
  75. "mcc_code": "2025",
  76. "subcategory": "8931"
  77. },
  78. "business_incorporation": {
  79. "incorporation_country_code": "US",
  80. "incorporation_date": "1986-12-29"
  81. },
  82. "names": [
  83. {
  84. "business_name": "Test Enterprise",
  85. "type": "LEGAL_NAME"
  86. }
  87. ],
  88. "emails": [
  89. {
  90. "type": "CUSTOMER_SERVICE",
  91. "email": "customerservice@example.com"
  92. }
  93. ],
  94. "website": "https://mystore.testenterprises.com",
  95. "addresses": [
  96. {
  97. "address_line_1": "One Washington Square",
  98. "address_line_2": "Apt 123",
  99. "admin_area_2": "San Jose",
  100. "admin_area_1": "CA",
  101. "postal_code": "95112",
  102. "country_code": "US",
  103. "type": "WORK"
  104. }
  105. ],
  106. "phones": [
  107. {
  108. "country_code": "1",
  109. "national_number": "6692478833",
  110. "extension_number": "1234",
  111. "type": "CUSTOMER_SERVICE"
  112. }
  113. ],
  114. "beneficial_owners": {
  115. "individual_beneficial_owners": [
  116. {
  117. "names": [
  118. {
  119. "prefix": "Mr.",
  120. "given_name": "John",
  121. "surname": "Doe",
  122. "middle_name": "Middle",
  123. "suffix": "Jr.",
  124. "full_name": "John Middle Doe Jr.",
  125. "type": "LEGAL"
  126. }
  127. ],
  128. "citizenship": "US",
  129. "addresses": [
  130. {
  131. "address_line_1": "One Washington Square",
  132. "address_line_2": "Apt 123",
  133. "admin_area_2": "San Jose",
  134. "admin_area_1": "CA",
  135. "postal_code": "95112",
  136. "country_code": "US",
  137. "type": "HOME"
  138. }
  139. ],
  140. "phones": [
  141. {
  142. "country_code": "1",
  143. "national_number": "6692468839",
  144. "extension_number": "1234",
  145. "type": "MOBILE"
  146. }
  147. ],
  148. "birth_details": {
  149. "date_of_birth": "1955-12-29"
  150. },
  151. "percentage_of_ownership": "50"
  152. }
  153. ],
  154. "business_beneficial_owners": [
  155. {
  156. "business_type": {
  157. "type": "INDIVIDUAL",
  158. "subtype": "ASSO_TYPE_INCORPORATED"
  159. },
  160. "business_industry": {
  161. "category": "1004",
  162. "mcc_code": "2025",
  163. "subcategory": "8931"
  164. },
  165. "business_incorporation": {
  166. "incorporation_country_code": "US",
  167. "incorporation_date": "1986-12-29"
  168. },
  169. "names": [
  170. {
  171. "business_name": "Test Enterprise",
  172. "type": "LEGAL_NAME"
  173. }
  174. ],
  175. "emails": [
  176. {
  177. "type": "CUSTOMER_SERVICE",
  178. "email": "customerservice@example.com"
  179. }
  180. ],
  181. "website": "https://mystore.testenterprises.com",
  182. "addresses": [
  183. {
  184. "address_line_1": "One Washington Square",
  185. "address_line_2": "Apt 123",
  186. "admin_area_2": "San Jose",
  187. "admin_area_1": "CA",
  188. "postal_code": "95112",
  189. "country_code": "US",
  190. "type": "WORK"
  191. }
  192. ],
  193. "phones": [
  194. {
  195. "country_code": "1",
  196. "national_number": "6692478833",
  197. "extension_number": "1234",
  198. "type": "CUSTOMER_SERVICE"
  199. }
  200. ],
  201. "percentage_of_ownership": "50"
  202. }
  203. ]
  204. },
  205. "office_bearers": [
  206. {
  207. "names": [
  208. {
  209. "prefix": "Mr.",
  210. "given_name": "John",
  211. "surname": "Doe",
  212. "middle_name": "Middle",
  213. "suffix": "Jr.",
  214. "full_name": "John Middle Doe Jr.",
  215. "type": "LEGAL"
  216. }
  217. ],
  218. "citizenship": "US",
  219. "addresses": [
  220. {
  221. "address_line_1": "One Washington Square",
  222. "address_line_2": "Apt 123",
  223. "admin_area_2": "San Jose",
  224. "admin_area_1": "CA",
  225. "postal_code": "95112",
  226. "country_code": "US",
  227. "type": "HOME"
  228. }
  229. ],
  230. "phones": [
  231. {
  232. "country_code": "1",
  233. "national_number": "6692468839",
  234. "extension_number": "1234",
  235. "type": "MOBILE"
  236. }
  237. ],
  238. "birth_details": {
  239. "date_of_birth": "1955-12-29"
  240. },
  241. "role": "DIRECTOR"
  242. }
  243. ],
  244. "annual_sales_volume_range": {
  245. "minimum_amount": {
  246. "currency_code": "USD",
  247. "value": "10000"
  248. },
  249. "maximum_amount": {
  250. "currency_code": "USD",
  251. "value": "50000"
  252. }
  253. },
  254. "average_monthly_volume_range": {
  255. "minimum_amount": {
  256. "currency_code": "USD",
  257. "value": "1000"
  258. },
  259. "maximum_amount": {
  260. "currency_code": "USD",
  261. "value": "50000"
  262. }
  263. },
  264. "purpose_code": "P0104"
  265. },
  266. "email": "accountemail@example.com",
  267. "preferred_language_code": "en-US",
  268. "tracking_id": "testenterprices123122",
  269. "partner_config_override": {
  270. "partner_logo_url": "https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_111x69.jpg",
  271. "return_url": "https://testenterprises.com/merchantonboarded",
  272. "return_url_description": "the url to return the merchant after the paypal onboarding process.",
  273. "action_renewal_url": "https://testenterprises.com/renew-exprired-url",
  274. "show_add_credit_card": true
  275. },
  276. "operations": [
  277. {
  278. "operation": "API_INTEGRATION",
  279. "api_integration_preference": {
  280. "classic_api_integration": {
  281. "integration_type": "THIRD_PARTY",
  282. "third_party_details": {
  283. "permissions": [
  284. "EXPRESS_CHECKOUT",
  285. "REFUND",
  286. "DIRECT_PAYMENT",
  287. "AUTH_CAPTURE",
  288. "BUTTON_MANAGER",
  289. "ACCOUNT_BALANCE",
  290. "TRANSACTION_DETAILS"
  291. ]
  292. },
  293. "first_party_details": "CERTIFICATE"
  294. },
  295. "rest_api_integration": {
  296. "integration_method": "PAYPAL",
  297. "integration_type": "THIRD_PARTY",
  298. "third_party_details": {
  299. "features": [
  300. "PAYMENT",
  301. "REFUND",
  302. "PARTNER_FEE"
  303. ]
  304. }
  305. }
  306. },
  307. "billing_agreement": {
  308. "description": "Billing Agreement Description Field",
  309. "billing_experience_preference": {
  310. "experience_id": "string",
  311. "billing_context_set": true
  312. },
  313. "merchant_custom_data": "PatnerMERCHANT23124",
  314. "approval_url": "wttps://www.paypal.com/agreements/approve?ba_token=BA-67944913LE886121E",
  315. "ec_token": "EC-1S970363DB536864M"
  316. }
  317. }
  318. ],
  319. "products": [
  320. "EXPRESS_CHECKOUT"
  321. ],
  322. "legal_consents": [
  323. {
  324. "type": "SHARE_DATA_CONSENT",
  325. "granted": true
  326. }
  327. ]
  328. },
  329. "links": [
  330. {
  331. "href": "https://uri.paypal.com/v2/customer/partner-referrals/ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
  332. "rel": "self",
  333. "method": "GET"
  334. },
  335. {
  336. "href": "https://www.paypal.com/merchantsignup/partner/onboardingentry?token=ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=",
  337. "rel": "action_url",
  338. "method": "GET"
  339. }
  340. ]
  341. }', true);
  342. }
  343. private function mockListSellerTrackingInformationResponse(): array
  344. {
  345. return Utils::jsonDecode('{
  346. "merchant_id": "8LQLM2ML4ZTYU",
  347. "tracking_id": "merchantref1",
  348. "links": [
  349. {
  350. "href": "v1/customer/partners/6LKMD2ML4NJYU",
  351. "rel": "read",
  352. "method": "GET",
  353. "description": "Main partner resource."
  354. }
  355. ]
  356. }', true);
  357. }
  358. private function mockShowSellerStatusResponse(): array
  359. {
  360. return Utils::jsonDecode('{
  361. "merchant_id": "8LQLM2ML4ZTYU",
  362. "products": [
  363. {
  364. "name": "PAYFLOW_PRO",
  365. "vetting_status": "APPROVED",
  366. "status": "ACTIVE"
  367. },
  368. {
  369. "name": "EXPRESS_CHECKOUT",
  370. "status": "ACTIVE"
  371. },
  372. {
  373. "name": "PPCP_STANDARD",
  374. "vetting_status": "SUBSCRIBED",
  375. "capabilities": [
  376. "CUSTOM_CARD_PROCESSING",
  377. "CARD_PROCESSING_VIRTUAL_TERMINAL",
  378. "FRAUD_TOOL_ACCESS",
  379. "AMEX_OPTBLUE",
  380. "DEBIT_CARD_SWITCH",
  381. "COMMERCIAL_ENTITY"
  382. ]
  383. },
  384. {
  385. "name": "PPCP_CUSTOM",
  386. "vetting_status": "IN_REVIEW",
  387. "capabilities": []
  388. }
  389. ],
  390. "capabilities": [
  391. {
  392. "name": "CUSTOM_CARD_PROCESSING",
  393. "status": "ACTIVE",
  394. "limits": [
  395. {
  396. "type": "GENERAL"
  397. }
  398. ]
  399. },
  400. {
  401. "name": "CARD_PROCESSING_VIRTUAL_TERMINAL",
  402. "status": "ACTIVE"
  403. },
  404. {
  405. "name": "FRAUD_TOOL_ACCESS",
  406. "status": "ACTIVE"
  407. },
  408. {
  409. "name": "AMEX_OPTBLUE",
  410. "status": "ACTIVE"
  411. },
  412. {
  413. "name": "DEBIT_CARD_SWITCH",
  414. "status": "ACTIVE"
  415. },
  416. {
  417. "name": "COMMERCIAL_ENTITY",
  418. "status": "ACTIVE"
  419. }
  420. ],
  421. "payments_receivable": true,
  422. "primary_email": "seller@example.com",
  423. "primary_email_confirmed": true,
  424. "granted_permissions": [
  425. "AIR_TRAVEL",
  426. "INVOICING",
  427. "RECURRING_PAYMENT_REPORT"
  428. ],
  429. "api_credential": {
  430. "signature": {
  431. "api_user_name": "example_api1.gmail.com",
  432. "api_password": "7QPZJL5PX2TT94RX",
  433. "signature": "Ak0kqXY-wqI.w.dfyQrwACtkK4HcMNxGdvADyrIE8QLgZWyIDNJSDlQ1e"
  434. }
  435. },
  436. "oauth_integrations": [
  437. {
  438. "integration_type": "OAUTH_THIRD_PARTY",
  439. "oauth_third_party": [
  440. {
  441. "partner_client_id": "AafBGhBphJ66SHPtbCMTsH1q2HQC2lnf0ER0KWAVSsOqsAtVfnye5Vc8hAOC",
  442. "merchant_client_id": "AafBGhBphJ66SHPtbCMTsH1q2HQC2lnf0ER0KWAVSsOqsAtVfnye5Vc8hAOC",
  443. "scopes": [
  444. "https://uri.paypal.com/services/payments/realtimepayment",
  445. "https://uri.paypal.com/services/payments/payment/authcapture",
  446. "https://uri.paypal.com/services/payments/refund"
  447. ]
  448. },
  449. {
  450. "partner_client_id": "AafBGhBphJ66SHPtbCMTsH1q2HQC2lnf0ER0KWAVSsOqsAtVfnye5Vc8hAOC",
  451. "merchant_client_id": "AafBGhBphJ66SHPtbCMTsH1q2HQC2lnf0ER0KWAVSsOqsAtVfnye5Vc8hAOC",
  452. "scopes": [
  453. "https://uri.paypal.com/services/payments/realtimepayment",
  454. "https://uri.paypal.com/services/payments/payment/authcapture"
  455. ]
  456. }
  457. ]
  458. }
  459. ],
  460. "limitations": [
  461. {
  462. "name": "MRCHT - Pending User Agreement",
  463. "restrictions": [
  464. "ACH IN",
  465. "Withdraw Money",
  466. "Remove Bank",
  467. "Refunds to Buyer",
  468. "Close Account",
  469. "Send Money",
  470. "Remove Card"
  471. ]
  472. },
  473. {
  474. "name": "Seller-linked merchant",
  475. "restrictions": [
  476. "ACH IN",
  477. "Send Money",
  478. "Refunds to Buyer",
  479. "Receive/Request Money",
  480. "Remove Bank",
  481. "Remove Card",
  482. "Withdraw Money",
  483. "Close Account"
  484. ]
  485. }
  486. ]
  487. }', true);
  488. }
  489. private function mockListMerchantCredentialsResponse(): array
  490. {
  491. return Utils::jsonDecode('{
  492. "client_id": "Ab27r3fkrQezHdcPrn2b2SYzPEldXx2dWgv76btVfI-eYF8KRAd2WxXAZyb0ETygSNeHBthzlxjlQ_qw",
  493. "client_secret": "EAcTvpnDHZf4icl_2MPnt2gRpOxHVtaQJChWU3PrRbYR4uyvUXV6h4DWQjm7XOfdnk_OrEEWdxY2eUG3",
  494. "payer_id": "QVG98CUNMS2PY"
  495. }', true);
  496. }
  497. }