Guest User

Untitled

a guest
Sep 9th, 2020
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.42 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function paypal_config()
  15. {
  16. return [
  17. 'FriendlyName' => ['Type' => 'System', 'Value' => 'PayPal Basic'],
  18. 'UsageNotes' => ['Type' => 'System', 'Value' => 'Please ensure Instant Payment Notification (IPN) is enabled under Selling Preferences within your PayPal account. Paypal requires the Notification URL to be set to a valid URL, we recommend setting it to: ' . App::getSystemUrl()],
  19. 'email' => ['FriendlyName' => 'PayPal Email', 'Type' => 'text', 'Size' => '40'],
  20. 'forceonetime' => ['FriendlyName' => 'Force One Time Payments', 'Type' => 'yesno', 'Description' => 'Never show the subscription payment button'],
  21. 'forcesubscriptions' => ['FriendlyName' => 'Force Subscriptions', 'Type' => 'yesno', 'Description' => 'Hide the one time payment button when a subscription can be created'],
  22. 'requireshipping' => ['FriendlyName' => 'Require Shipping Address', 'Type' => 'yesno', 'Description' => 'Tick this box to request a shipping address from a user on PayPal\'s site'],
  23. 'overrideaddress' => ['FriendlyName' => 'Client Address Matching', 'Type' => 'yesno', 'Description' => 'Tick this box to force using client profile information entered into WHMCS at PayPal'],
  24. 'apiusername' => ['FriendlyName' => 'API Username', 'Type' => 'text', 'Size' => '40', 'Description' => 'API Details are required for Refunds and Subscription cancellations'],
  25. 'apipassword' => ['FriendlyName' => 'API Password', 'Type' => 'text', 'Size' => '40'],
  26. 'apisignature' => ['FriendlyName' => 'API Signature', 'Type' => 'text', 'Size' => '70'],
  27. 'sandbox' => ['FriendlyName' => 'Sandbox Mode', 'Type' => 'yesno', 'Description' => 'Tick to use PayPal’s Virtual Sandbox Test Environment - requires a separate Sandbox Test Account']
  28. ];
  29. }
  30.  
  31. function paypal_link($params)
  32. {
  33. if (isset($params['sandbox']) && $params['sandbox']) {
  34. $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
  35. }
  36. else {
  37. $url = 'https://www.paypal.com/cgi-bin/webscr';
  38. }
  39.  
  40. $invoiceid = $params['invoiceid'];
  41. $paypalemails = $params['email'];
  42. $paypalemails = explode(',', $paypalemails);
  43. $paypalemail = trim($paypalemails[0]);
  44. $upgrade = false;
  45. $recurrings = getRecurringBillingValues($invoiceid);
  46.  
  47. if (!$recurrings) {
  48. try {
  49. $recurrings = getUpgradeRecurringValues($invoiceid);
  50.  
  51. if ($recurrings) {
  52. $upgrade = true;
  53. }
  54. }
  55. catch (Exception $e) {
  56. }
  57. }
  58.  
  59. $primaryserviceid = $recurrings['primaryserviceid'];
  60.  
  61. if ($upgrade) {
  62. $primaryserviceid = 'U' . $primaryserviceid;
  63. }
  64.  
  65. $firstpaymentamount = $recurrings['firstpaymentamount'];
  66. $firstcycleperiod = $recurrings['firstcycleperiod'];
  67. $firstcycleunits = strtoupper(substr($recurrings['firstcycleunits'], 0, 1));
  68. $recurringamount = $recurrings['recurringamount'];
  69. $recurringcycleperiod = $recurrings['recurringcycleperiod'];
  70. $recurringcycleunits = strtoupper(substr($recurrings['recurringcycleunits'], 0, 1));
  71. $firstpaymentamount = WHMCS\View\Formatter\Price::adjustDecimals($firstpaymentamount, $params['currency']);
  72. $recurringamount = WHMCS\View\Formatter\Price::adjustDecimals($recurringamount, $params['currency']);
  73. $params['amount'] = WHMCS\View\Formatter\Price::adjustDecimals($params['amount'], $params['currency']);
  74. if (($params['clientdetails']['country'] == 'US') || ($params['clientdetails']['country'] == 'CA')) {
  75. $phonenumber = preg_replace('/[^0-9]/', '', $params['clientdetails']['phonenumber']);
  76. $phone1 = substr($phonenumber, 0, 3);
  77. $phone2 = substr($phonenumber, 3, 3);
  78. $phone3 = substr($phonenumber, 6);
  79. }
  80. else {
  81. $phone1 = $params['clientdetails']['phonecc'];
  82. $phone2 = $params['clientdetails']['phonenumber'];
  83. }
  84.  
  85. $subnotpossible = false;
  86.  
  87. if (!$recurrings) {
  88. $subnotpossible = true;
  89. }
  90.  
  91. if ($recurrings['overdue']) {
  92. $subnotpossible = true;
  93. }
  94. if (isset($params['forceonetime']) && $params['forceonetime']) {
  95. $subnotpossible = true;
  96. }
  97.  
  98. if ($recurringamount <= 0) {
  99. $subnotpossible = true;
  100. }
  101. if ((90 < $firstcycleperiod) && ($firstcycleunits == 'D')) {
  102. $subnotpossible = true;
  103. .............................................................................
  104. ............................................
  105. .................
Add Comment
Please, Sign In to add comment