当前位置: 首页>>代码示例>>PHP>>正文


PHP Braintree_CreditCard::delete方法代码示例

本文整理汇总了PHP中Braintree_CreditCard::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_CreditCard::delete方法的具体用法?PHP Braintree_CreditCard::delete怎么用?PHP Braintree_CreditCard::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Braintree_CreditCard的用法示例。


在下文中一共展示了Braintree_CreditCard::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDelete_deletesThePaymentMethod

 function testDelete_deletesThePaymentMethod()
 {
     $customer = Braintree_Customer::createNoValidate(array());
     $creditCard = Braintree_CreditCard::createNoValidate(array('customerId' => $customer->id, 'number' => '5105105105105100', 'expirationDate' => '05/12'));
     Braintree_CreditCard::find($creditCard->token);
     Braintree_CreditCard::delete($creditCard->token);
     $this->setExpectedException('Braintree_Exception_NotFound');
     Braintree_CreditCard::find($creditCard->token);
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:9,代码来源:CreditCardTest.php

示例2: deleteCard

 function deleteCard($token, $token_id)
 {
     $OSCOM_Db = Registry::get('Db');
     Braintree_Configuration::environment(MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER == 'Live' ? 'production' : 'sandbox');
     Braintree_Configuration::merchantId(MODULE_PAYMENT_BRAINTREE_CC_MERCHANT_ID);
     Braintree_Configuration::publicKey(MODULE_PAYMENT_BRAINTREE_CC_PUBLIC_KEY);
     Braintree_Configuration::privateKey(MODULE_PAYMENT_BRAINTREE_CC_PRIVATE_KEY);
     try {
         Braintree_CreditCard::delete($token);
     } catch (Exception $e) {
     }
     return $OSCOM_Db->delete('customers_braintree_tokens', ['id' => $token_id, 'customers_id' => $_SESSION['customer_id'], 'braintree_token' => $token]) === 1;
 }
开发者ID:Akofelaz,项目名称:oscommerce2,代码行数:13,代码来源:braintree_cc.php

示例3: deleteCard

 function deleteCard($token, $token_id)
 {
     global $customer_id;
     Braintree_Configuration::environment(MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER == 'Live' ? 'production' : 'sandbox');
     Braintree_Configuration::merchantId(MODULE_PAYMENT_BRAINTREE_CC_MERCHANT_ID);
     Braintree_Configuration::publicKey(MODULE_PAYMENT_BRAINTREE_CC_PUBLIC_KEY);
     Braintree_Configuration::privateKey(MODULE_PAYMENT_BRAINTREE_CC_PRIVATE_KEY);
     try {
         Braintree_CreditCard::delete($token);
     } catch (Exception $e) {
     }
     tep_db_query("delete from customers_braintree_tokens where id = '" . (int) $token_id . "' and customers_id = '" . (int) $customer_id . "' and braintree_token = '" . tep_db_prepare_input(tep_db_input($token)) . "'");
     return tep_db_affected_rows() === 1;
 }
开发者ID:tapwag,项目名称:oscommerce_deutsch,代码行数:14,代码来源:braintree_cc.php

示例4: delete

 /**
  * 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;
 }
开发者ID:sime,项目名称:cakephp-braintree-plugin,代码行数:48,代码来源:BraintreeSource.php

示例5: deleteCard

 public function deleteCard($token)
 {
     try {
         return Braintree_CreditCard::delete($token);
     } catch (Braintree_Exception $e) {
         Mage::logException($e);
         return false;
     }
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:9,代码来源:Paymentmethod.php

示例6: updateCard

 public function updateCard($config, $data)
 {
     $common = new Common();
     $updateData = array();
     $oldCardExists = false;
     $session = new Container('frontend');
     \Braintree_Configuration::environment($config['payment_gateway']['tree_env']);
     \Braintree_Configuration::merchantId($config['payment_gateway']['merchant_id']);
     \Braintree_Configuration::publicKey($config['payment_gateway']['public_key']);
     \Braintree_Configuration::privateKey($config['payment_gateway']['private_key']);
     $cardDetails = $common->getUserCardDetails($config['api_url']['value'], array('user_id' => $session->userid));
     //print_r($cardDetails); exit;
     $card = isset($cardDetails[0]) ? $cardDetails[0] : '';
     if (!is_array($data)) {
         parse_str($data, $data);
     }
     if (isset($card) && is_array($card)) {
         try {
             $result = \Braintree_CreditCard::find($card['creditCardDetails_token']);
             $oldCardExists = true;
         } catch (\Exception $ex) {
             $oldCardExists = false;
             //echo $ex->getMessage();
         }
         try {
             $delete = \Braintree_CreditCard::delete($card['creditCardDetails_token']);
         } catch (\Exception $ex) {
             //echo $ex->getMessage();
         }
     }
     if (!isset($data['creditCardDetails_token']) && !isset($data['customerDetails_id'])) {
         $result = \Braintree_CreditCard::create(array('customerId' => isset($card['customerDetails_id']) ? $card['customerDetails_id'] : '', 'number' => $data['card_no'], 'cvv' => $data['cvv'], 'expirationDate' => $data['month'] . '/' . $data['year'], 'cardholderName' => $data['name_on_card'], 'options' => array('makeDefault' => true)));
         if ($result->success) {
             $data['creditCardDetails_token'] = $result->creditCard->token;
             $data['customerDetails_id'] = $result->creditCard->customerId;
         } else {
             return array('status' => 0, 'msg' => $result->message, 'errors' => $result->errors->deepAll());
         }
     }
     $updateData['user_id'] = $session->userid;
     $updateData['card_expiration_hash'] = isset($data['card_expiration_hash']) ? $data['card_expiration_hash'] : md5($data['month'] . '-' . $data['Year']);
     $updateData['creditCardDetails_token'] = $data['creditCardDetails_token'];
     $updateData['customerDetails_id'] = $data['customerDetails_id'];
     isset($card['use_for_renew']) ? $updateData['use_for_renew'] = $card['use_for_renew'] : '';
     isset($data['use_for_renew']) ? $updateData['use_for_renew'] = $data['use_for_renew'] : '';
     $res = isset($card['id']) ? $this->api->curl($config['api_url']['value'] . '/api/card_details/' . $card['id'] . '/', $updateData, 'PUT') : $this->api->curl($config['api_url']['value'] . '/api/card_details/', $updateData, 'POST');
     if ($res->getStatusCode() == 200 || $res->getStatusCode() == 201) {
         return array('status' => 1, 'msg' => 'Card details successfully updated..!!');
     } else {
         return array('status' => 1, 'msg' => 'Failed to update card details..!!', 'errors' => json_decode($res->getBody(), true));
     }
 }
开发者ID:riteshkmr33,项目名称:ovessnce,代码行数:52,代码来源:Transactions.php

示例7: delete_saved_card

 /**
  * Delete the saved card in braintree given the credit card token
  *
  * @since 2.0
  * @param string $token the braintree credit card token
  */
 public function delete_saved_card($token)
 {
     try {
         Braintree_CreditCard::delete($token);
     } catch (Exception $e) {
         $this->add_debug_message($e->getMessage());
     }
 }
开发者ID:keshvenderg,项目名称:cloudshop,代码行数:14,代码来源:class-wc-gateway-braintree.php

示例8: delete

 /**
  * @param string $token
  * @return \Braintree_Result_Successful
  */
 public function delete($token)
 {
     return \Braintree_CreditCard::delete($token);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:BraintreeCreditCard.php


注:本文中的Braintree_CreditCard::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。