BillingPlans.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace Srmklive\PayPal\Tests\Mocks\Requests;
  3. use GuzzleHttp\Utils;
  4. trait BillingPlans
  5. {
  6. /**
  7. * @return array
  8. */
  9. private function createPlanParams(): array
  10. {
  11. return Utils::jsonDecode('{
  12. "product_id": "PROD-XXCD1234QWER65782",
  13. "name": "Video Streaming Service Plan",
  14. "description": "Video Streaming Service basic plan",
  15. "status": "ACTIVE",
  16. "billing_cycles": [
  17. {
  18. "frequency": {
  19. "interval_unit": "MONTH",
  20. "interval_count": 1
  21. },
  22. "tenure_type": "TRIAL",
  23. "sequence": 1,
  24. "total_cycles": 2,
  25. "pricing_scheme": {
  26. "fixed_price": {
  27. "value": "3",
  28. "currency_code": "USD"
  29. }
  30. }
  31. },
  32. {
  33. "frequency": {
  34. "interval_unit": "MONTH",
  35. "interval_count": 1
  36. },
  37. "tenure_type": "TRIAL",
  38. "sequence": 2,
  39. "total_cycles": 3,
  40. "pricing_scheme": {
  41. "fixed_price": {
  42. "value": "6",
  43. "currency_code": "USD"
  44. }
  45. }
  46. },
  47. {
  48. "frequency": {
  49. "interval_unit": "MONTH",
  50. "interval_count": 1
  51. },
  52. "tenure_type": "REGULAR",
  53. "sequence": 3,
  54. "total_cycles": 12,
  55. "pricing_scheme": {
  56. "fixed_price": {
  57. "value": "10",
  58. "currency_code": "USD"
  59. }
  60. }
  61. }
  62. ],
  63. "payment_preferences": {
  64. "auto_bill_outstanding": true,
  65. "setup_fee": {
  66. "value": "10",
  67. "currency_code": "USD"
  68. },
  69. "setup_fee_failure_action": "CONTINUE",
  70. "payment_failure_threshold": 3
  71. },
  72. "taxes": {
  73. "percentage": "10",
  74. "inclusive": false
  75. }
  76. }', true);
  77. }
  78. /**
  79. * @return array
  80. */
  81. private function updatePlanParams(): array
  82. {
  83. return Utils::jsonDecode('[
  84. {
  85. "op": "replace",
  86. "path": "/payment_preferences/payment_failure_threshold",
  87. "value": 7
  88. }
  89. ]', true);
  90. }
  91. /**
  92. * @return array
  93. */
  94. private function updatePlanPricingParams(): array
  95. {
  96. return Utils::jsonDecode('{
  97. "pricing_schemes": [
  98. {
  99. "billing_cycle_sequence": 2,
  100. "pricing_scheme": {
  101. "fixed_price": {
  102. "value": "50",
  103. "currency_code": "USD"
  104. }
  105. }
  106. }
  107. ]
  108. }', true);
  109. }
  110. }