Пример #1
0
 public function deleteCustomer($id)
 {
     $result = Braintree_Customer::delete($id);
     /* 
     echo "<pre>";
     print_r($result);
     echo "</pre>";
     */
     if ($result->success) {
         return $result;
         /*
         	     return(array('success'=>1,
                'customer_id'=>$result->customer->id
         ));
         */
     } else {
         return array('success' => 0, 'validation_errors' => $result->errors->deepAll());
     }
 }
Пример #2
0
 /**
  * Delete a customer within Braintree
  *
  * @param $customerId
  *
  * @return \Braintree_Result_Successful
  */
 public function deleteCustomer($customerId)
 {
     try {
         return Braintree_Customer::delete($customerId);
     } catch (Exception $e) {
         Gene_Braintree_Model_Debug::log($e);
     }
     return false;
 }
Пример #3
0
 function testDelete_deletesTheCustomer()
 {
     $result = Braintree_Customer::create(array());
     $this->assertEquals(true, $result->success);
     Braintree_Customer::find($result->customer->id);
     Braintree_Customer::delete($result->customer->id);
     $this->setExpectedException('Braintree_Exception_NotFound');
     Braintree_Customer::find($result->customer->id);
 }
Пример #4
0
 /**
  * Deletes customer
  * 
  * @param int $customerID
  */
 public function deleteCustomer($customerID)
 {
     try {
         Braintree_Customer::delete($customerID);
     } catch (Braintree_Exception $e) {
         Mage::logException($e);
     }
 }
Пример #5
0
     $updateResult->success;
     print_r($updateResult);
 } else {
     if ($_POST['_act'] == 'findCustomer') {
         //echo $_POST['customer_id'];
         //$_POST['customer_id'] = '57306224';
         $findResult = Braintree_Customer::find((string) $_POST['customer_id']);
         print_r($findResult);
     } else {
         if ($_POST['_act'] == 'deleteCustomer') {
             $search = (string) $_POST['customer_id'];
             $file = './data/customerID.txt';
             $contents = file_get_contents($file);
             echo $contents = str_replace($_POST['customer_id'], trim((string) $_POST['customer_id'] . "_DELETED\r\n"), $contents);
             file_put_contents($file, $contents);
             $deleteResult = Braintree_Customer::delete((string) $_POST['customer_id']);
             print_r($deleteResult);
         } else {
             if ($_POST['_act'] == 'createPaymentMethod') {
                 $para_Arr = array();
                 if (isset($_POST['data'])) {
                     $postData = explode("&", urldecode($_POST['data']));
                     //[SETTING UP POST DATA TO SUPPORT AJAX]
                     foreach ($postData as $key => $value) {
                         $postValue = explode("=", $value);
                         $_POST[$postValue[0]] = $postValue[1];
                     }
                     unset($_POST['data']);
                 }
                 if ($_POST['verify'] == "true") {
                     echo "With Verify </br>";
 /**
  * @param string $customerId
  * @return \Braintree_Result_Successful
  */
 public function delete($customerId)
 {
     return \Braintree_Customer::delete($customerId);
 }
 /**
  * Deletes a record via the API
  *
  * @param   object  $model
  * @param   mixed   $conditions
  * @return  bool
  */
 public function delete(Model $model, $conditions = null)
 {
     $ids = $this->_getIdsToBeDeleted($model, $conditions);
     if ($ids === false) {
         return false;
     }
     $entity = $this->_getModelEntity($model);
     if (!empty($ids)) {
         foreach ($ids as $id) {
             try {
                 switch ($entity) {
                     case 'Customer':
                         Braintree_Customer::delete($id);
                         break;
                     case 'Transaction':
                         $this->showError(__('Transactions cannot be deleted', true));
                         return false;
                         break;
                     case 'CreditCard':
                         Braintree_CreditCard::delete($id);
                         break;
                     case 'Address':
                         $exploded = explode('|', $id);
                         if (count($exploded) != 2) {
                             return false;
                         }
                         list($customer_id, $address_id) = $exploded;
                         Braintree_Address::delete($customer_id, $address_id);
                         break;
                     default:
                         return false;
                         break;
                 }
             } catch (Exception $e) {
                 $this->showError(print_r($e, true));
                 return false;
             }
         }
     }
     return true;
 }
Пример #8
0
         if ($stmt = $mysqli->prepare("UPDATE members SET " . "password='******', " . "salt='" . $random_salt . "'" . " WHERE id = ?")) {
             // Bind "$user_id" to parameter.
             $stmt->bind_param('i', $user_id);
             $stmt->execute();
             echo 'Password updated!<br><br><input type="button" value="Close" onClick="closePopup();">';
             exit;
         } else {
             echo 'Update failed (Error: DB)<br><br><input type="button" value="Submit" onClick="doChangePass();">';
             exit;
         }
         $stmt->close();
     } elseif (@isset($_POST["del"]) && $_POST["del"] == '1') {
         $user_id = sanitize($_SESSION['user_id']);
         $username = sanitize($_SESSION['username']) . "_FITNESS";
         // Delete the user from Braintree
         $result = Braintree_Customer::delete($username);
         // Delete the user from the database
         if ($stmt = $mysqli->prepare("DELETE FROM members WHERE id = ? LIMIT 1")) {
             // Bind "$user_id" to parameter.
             $stmt->bind_param('i', $user_id);
             $stmt->execute();
             echo 'Account deleted :(<br><br><input type="button" value="Close" onClick="closePopup();">';
             exit;
         } else {
             echo 'Account deletion failed (Error: DB) -';
             exit;
         }
         $stmt->close();
     }
 } else {
     echo "You literally can't even.";
 public function deleteCustomerInBT()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $id_user = isset($_POST['id_user']) ? addslashes($_POST['id_user']) : "";
     if (!$id_user) {
         Generic::errorMsg("ID User not found!");
     }
     if (!User::checkUserID($id_user)) {
         Generic::errorMsg("ID User not found!");
     }
     $json = array();
     $json['status_code'] = 1;
     try {
         $customer = Braintree_Customer::find($id_user);
     } catch (Braintree_Exception_NotFound $e) {
         Generic::errorMsg($e->getMessage());
     }
     $result = Braintree_Customer::delete($id_user);
     if (!$result->success) {
         Generic::errorMsg("Failed");
     }
     $objUser = new UserModel();
     $objUser->getByID($id_user);
     $objUser->braintree_id = "";
     $objUser->load = 1;
     $objUser->save();
     $json['results'] = "Success";
     echo json_encode($json);
     die;
 }