Guest User

Untitled

a guest
Oct 19th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. function createCustomer($fname, $lname, $mname, $dob, $gender, $email, $street, $pobox, $district, $region, $mobile, $createdBy, $language, $sim=NULL, $relmobile=NULL, $acceptreg=null, $idtype=NULL, $idno=NULL) {
  2. # Add user lang, gender, idtype
  3. echo $createdBy;
  4. if ($this->ussd) {
  5. if ($language == 1) {
  6. $language = 'en';
  7. } elseif ($language == 2) {
  8. $language = 'sw';
  9. } else {
  10. $language = 'en';
  11. }
  12.  
  13. if ($gender == 1) {
  14. $gender = 'male';
  15. } elseif ($gender == 2) {
  16. $gender = 'female';
  17. }
  18.  
  19. if ($idtype == 1) {
  20. $idtype = 'National ID ';
  21. } elseif ($idtype == 2) {
  22. $idtype = 'Voters Card';
  23. } elseif ($idtype == 3) {
  24. $idtype = 'WEO/VEO';
  25. } elseif ($idtype == 4) {
  26. $idtype = 'National ID';
  27. } elseif ($idtype == 5) {
  28. $iddtype = 'Passpot';
  29. }
  30. }
  31.  
  32. $staffinfo = $this->getUserDetails($this->username);
  33.  
  34. $custinfo = mysql_query("SELECT * FROM user WHERE mobile='$mobile'");
  35.  
  36. if (mysql_num_rows($custinfo) > 0) {
  37. $data2['lang'] = $staffinfo['lang'];
  38. $data2['recipient'] = $staffinfo['mobile'];
  39. $data2['service'] = $this->getServiceId("CREATE CUSTOMER");
  40. $data2['receiver'] = 5;
  41. $data2['username'] = $mobile;
  42.  
  43.  
  44. if ($this->ussd)
  45. return $this->processUssd($data2);
  46. else
  47. return false;
  48. }
  49.  
  50.  
  51. $ret = $this->addUser($fname, $lname, $mname, $dob, $gender, $email, $street, $pobox, $district, $region, $mobile, $mobile, "CUSTOMER", "CUSTOMER", $createdBy, $language, '', $mobile, $sim, '', $relmobile, $acceptreg, '1', '1', null, $idno, $idtype);
  52.  
  53.  
  54. if ($ret != false) {
  55. # Create an Account
  56.  
  57. $accNumber = $this->addAccount($mobile, 'CUSTOMER');
  58.  
  59. # Assign Certificate
  60.  
  61. $certificate = $this->assignCertificate($mobile, $this->accountNumber);
  62.  
  63. #add to the agent creation list
  64. ##$sysset = $this->getSystemSettings('VENDOR_BONUS');
  65. #if($sysset['on_use'] == 1)
  66. #{
  67. mysql_query("INSERT INTO agent_customers(create_vendor, create_customer, create_transactions, create_deposits)
  68. VALUES('$this->accountNumber','$mobile','0','0')");
  69. #}
  70.  
  71. $this->vendorBonus($this->accountNumber, 0, $mobile);
  72.  
  73. # Send sms
  74. # To customer
  75. # The sms: Welcome to MOBIPAWA. Your login name is 07YYAAAAAA and password is tutututh. Thank you for using mobipawa.
  76.  
  77. $data['lang'] = $language;
  78. $data['recipient'] = $mobile;
  79.  
  80.  
  81. $data['service'] = $this->getServiceId("CREATE CUSTOMER");
  82. $data['receiver'] = 2;
  83. $data['username'] = $mobile;
  84. $data['password'] = $ret['password'];
  85. $data['balance'] = 0;
  86. $data['certificate'] = $certificate;
  87.  
  88. $this->processSms($data);
  89.  
  90. # The sms: You have added a customer 07YYAAAAAA on the mobipawa system.
  91.  
  92.  
  93.  
  94. $data2['lang'] = $staffinfo['lang'];
  95. $data2['recipient'] = $staffinfo['mobile'];
  96. $data2['service'] = $this->getServiceId("CREATE CUSTOMER");
  97. $data2['receiver'] = 1;
  98. $data2['username'] = $mobile;
  99.  
  100.  
  101. if ($this->ussd)
  102. return $this->processUssd($data2);
  103. else {
  104. $this->processSms($data2);
  105. return true;
  106. }
  107. } else {
  108. return false;
  109. }
  110. }
Add Comment
Please, Sign In to add comment