PaymentMethodsTokens.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Requests;
  3. use GuzzleHttp\Utils;
  4. trait PaymentMethodsTokens
  5. {
  6. /**
  7. * @return array
  8. */
  9. private function mockCreatePaymentSetupTokensParams(): array
  10. {
  11. return Utils::jsonDecode('{
  12. "payment_source": {
  13. "card": {
  14. "number": "4111111111111111",
  15. "expiry": "2027-02",
  16. "name": "John Doe",
  17. "billing_address": {
  18. "address_line_1": "2211 N First Street",
  19. "address_line_2": "17.3.160",
  20. "admin_area_1": "CA",
  21. "admin_area_2": "San Jose",
  22. "postal_code": "95131",
  23. "country_code": "US"
  24. },
  25. "experience_context": {
  26. "brand_name": "YourBrandName",
  27. "locale": "en-US",
  28. "return_url": "https://example.com/returnUrl",
  29. "cancel_url": "https://example.com/cancelUrl"
  30. }
  31. }
  32. }
  33. }', true);
  34. }
  35. /**
  36. * @return array
  37. */
  38. private function mockCreatePaymentSetupPayPalParams(): array
  39. {
  40. return Utils::jsonDecode('{
  41. "payment_source": {
  42. "paypal": {
  43. "description": "Description for PayPal to be shown to PayPal payer",
  44. "shipping": {
  45. "name": {
  46. "full_name": "Firstname Lastname"
  47. },
  48. "address": {
  49. "address_line_1": "2211 N First Street",
  50. "address_line_2": "Building 17",
  51. "admin_area_2": "San Jose",
  52. "admin_area_1": "CA",
  53. "postal_code": "95131",
  54. "country_code": "US"
  55. }
  56. },
  57. "permit_multiple_payment_tokens": false,
  58. "usage_pattern": "IMMEDIATE",
  59. "usage_type": "MERCHANT",
  60. "customer_type": "CONSUMER",
  61. "experience_context": {
  62. "shipping_preference": "SET_PROVIDED_ADDRESS",
  63. "payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
  64. "brand_name": "EXAMPLE INC",
  65. "locale": "en-US",
  66. "return_url": "https://example.com/returnUrl",
  67. "cancel_url": "https://example.com/cancelUrl"
  68. }
  69. }
  70. }
  71. }', true);
  72. }
  73. }