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


PHP Braintree_Transaction::submitForSettlement方法代码示例

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


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

示例1: getTransaction

 public function getTransaction($transaction_id)
 {
     $transaction = Braintree_Transaction::submitForSettlement($transaction_id, $amount);
     if ($transaction) {
         return $transaction;
     } else {
         return false;
     }
 }
开发者ID:pmward,项目名称:Codeigniter-Braintree-v.zero-test-harness,代码行数:9,代码来源:braintree_model.php

示例2: getTransaction

 public function getTransaction($transaction_id)
 {
     Braintree_Configuration::environment($this->session->userdata('environment'));
     Braintree_Configuration::merchantId($this->session->userdata('merchantId'));
     Braintree_Configuration::publicKey($this->session->userdata('publicKey'));
     Braintree_Configuration::privateKey($this->session->userdata('privateKey'));
     $transaction = Braintree_Transaction::submitForSettlement($transaction_id);
     if ($transaction) {
         return $transaction;
     } else {
         return false;
     }
 }
开发者ID:pmward,项目名称:vzero-test-harness,代码行数:13,代码来源:braintree_model.php

示例3: charge

 function charge(&$order)
 {
     //create a code for the order
     if (empty($order->code)) {
         $order->code = $order->getRandomCode();
     }
     //what amount to charge?
     $amount = $order->InitialPayment;
     //tax
     $order->subtotal = $amount;
     $tax = $order->getTax(true);
     $amount = round((double) $order->subtotal + (double) $tax, 2);
     //create a customer
     $this->getCustomer($order);
     if (empty($this->customer)) {
         //failed to create customer
         return false;
     }
     //charge
     try {
         $response = Braintree_Transaction::sale(array('amount' => $amount, 'customerId' => $this->customer->id));
     } catch (Exception $e) {
         //$order->status = "error";
         $order->errorcode = true;
         $order->error = "Error: " . $e->getMessage();
         $order->shorterror = $order->error;
         return false;
     }
     if ($response->success) {
         //successful charge
         $transaction_id = $response->transaction->id;
         $response = Braintree_Transaction::submitForSettlement($transaction_id);
         if ($response->success) {
             $order->payment_transaction_id = $transaction_id;
             $order->updateStatus("success");
             return true;
         } else {
             $order->errorcode = true;
             $order->error = __("Error during settlement:", "pmpro") . " " . $response->message;
             $order->shorterror = $response->message;
             return false;
         }
     } else {
         //$order->status = "error";
         $order->errorcode = true;
         $order->error = __("Error during charge:", "pmpro") . " " . $response->message;
         $order->shorterror = $response->message;
         return false;
     }
 }
开发者ID:Seravo,项目名称:wp-paid-subscriptions,代码行数:50,代码来源:class.pmprogateway_braintree.php

示例4: submitForSettlement

 /**
  * Submit a payment for settlement using the Braintree PHP SDK
  *
  * @param $transactionId
  * @param $amount
  *
  * @return object
  */
 public function submitForSettlement($transactionId, $amount)
 {
     // Attempt to submit for settlement
     $result = Braintree_Transaction::submitForSettlement($transactionId, $amount);
     return $result;
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:14,代码来源:Braintree.php

示例5: switch

<?php

require 'template/header.php';
?>

<?php 
require 'credentials.php';
$id = $_GET['id'];
$method = $_GET['method'];
switch ($method) {
    case 'capture':
        $result = Braintree_Transaction::submitForSettlement($id);
        break;
    case 'void':
        $result = Braintree_Transaction::void($id);
        break;
    case 'refund':
        $result = Braintree_Transaction::refund($id);
        break;
    default:
        die('invalid request');
        break;
}
?>

<div class="page-header">
  <h1><?php 
echo $method . " " . $id;
?>
</h1>
</div>
开发者ID:joseph-peng,项目名称:braintree-chicago,代码行数:31,代码来源:action.php

示例6: submitForSettlement

 /**
  * @param string $transactionId
  * @param null|float $amount
  * @return \Braintree_Result_Successful|\Braintree_Result_Error
  */
 public function submitForSettlement($transactionId, $amount = null)
 {
     return \Braintree_Transaction::submitForSettlement($transactionId, $amount);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:BraintreeTransaction.php

示例7: testSubmitForSettlement_withAmount

 function testSubmitForSettlement_withAmount()
 {
     $transaction = Braintree_Transaction::saleNoValidate(array('amount' => '100.00', 'creditCard' => array('number' => '5105105105105100', 'expirationDate' => '05/12')));
     $this->assertEquals(Braintree_Transaction::AUTHORIZED, $transaction->status);
     $submitResult = Braintree_Transaction::submitForSettlement($transaction->id, '50.00');
     $this->assertEquals(true, $submitResult->success);
     $this->assertEquals(Braintree_Transaction::SUBMITTED_FOR_SETTLEMENT, $submitResult->transaction->status);
     $this->assertEquals('50.00', $submitResult->transaction->amount);
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:9,代码来源:TransactionTest.php

示例8:

    echo '<input type="hidden" name="_act" value="find" />';
    echo '</br>Transaction ID: <input type="text" name="id" value="' . $result->transaction->_attributes['id'] . '" />';
    echo '</br><input type="submit" name="" value="Proceed to Find ID " />';
    echo "</form>";
    echo "--------------------------------------------------------------------------------------------------------------------------";
    echo "</br></br><form method='POST' action='createTrans.php'><h3>Proceed to clone for " . $result->transaction->_attributes['id'] . "</h3></br>";
    //echo "<a href='?_act=settlement&id=".$result -> transaction -> _attributes['id']."'>Do the settlement</a>";
    echo '<input type="hidden" name="_act" value="clone" />';
    echo '</br>Transaction ID: <input type="text" name="id" value="' . $result->transaction->_attributes['id'] . '" />';
    echo '</br><input type="submit" name="" value="Proceed to clone transaction " />';
    echo "</form>";
    echo "--------------------------------------------------------------------------------------------------------------------------";
    exit;
} else {
    if ($_POST['_act'] == 'settlement') {
        $result = Braintree_Transaction::submitForSettlement($_POST['id'], $_POST['amt']);
        echo "<div style='height:300px; overflow-y:scroll; background-color:#fff;'> <h3>API response</h3>";
        echo json_encode($result, JSON_PRETTY_PRINT);
        echo "</div>";
    } else {
        if ($_POST['_act'] == 'void') {
            $result = Braintree_Transaction::void($_POST['id']);
            print_r($result);
        } else {
            if ($_REQUEST['_act'] == 'refund') {
                echo "</br></br><form method='POST' action=''><h2>Proceed to refund</h2></br>";
                echo '<input type="hidden" name="_act" value="refund_process" />';
                echo '</br>Transaction ID: <input type="text" name="id" value="" />';
                echo '</br>Amount: <input type="text" name="amt" value="" />';
                echo '</br><input type="submit" name="" value="Proceed to Refund " />';
                echo "</form>";
开发者ID:KLBombaStick,项目名称:BrainTree,代码行数:31,代码来源:createTrans.php

示例9: capture

 /**
  * Captures specified amount
  * 
  * @param Varien_Object $payment
  * @param decimal $amount
  * @return Braintree_Payments_Model_Paymentmethod
  */
 public function capture(Varien_Object $payment, $amount)
 {
     try {
         if ($payment->getCcTransId()) {
             $collection = Mage::getModel('sales/order_payment_transaction')->getCollection()->addFieldToFilter('payment_id', $payment->getId())->addFieldToFilter('txn_type', Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
             if ($collection->getSize() > 0) {
                 $collection = Mage::getModel('sales/order_payment_transaction')->getCollection()->addPaymentIdFilter($payment->getId())->addTxnTypeFilter(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH)->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC)->setOrder('transaction_id', Varien_Data_Collection::SORT_ORDER_DESC)->setPageSize(1)->setCurPage(1);
                 $authTransaction = $collection->getFirstItem();
                 if (!$authTransaction->getId()) {
                     Mage::throwException(Mage::helper('braintree_payments')->__('Please try again later'));
                 }
                 if ($token = $authTransaction->getAdditionalInformation('token')) {
                     //order was placed using saved card or card was saved during checkout token
                     $found = true;
                     try {
                         Braintree_PaymentMethod::find($token);
                     } catch (Exception $e) {
                         $found = false;
                     }
                     if ($found) {
                         $this->_initEnvironment($payment->getOrder()->getStoreId());
                         $this->_authorize($payment, $amount, true, $token);
                     } else {
                         // case if payment token is no more applicable. attempt to clone transaction
                         $result = $this->_cloneTransaction($amount, $authTransaction->getTxnId());
                         if ($result && $result->success) {
                             $payment = $this->_processSuccessResult($payment, $result, $amount);
                         } else {
                             if ($result === false) {
                                 Mage::throwException(Mage::helper('braintree_payments')->__('Please try again later'));
                             } else {
                                 Mage::throwException(Mage::helper('braintree_payments/error')->parseBraintreeError($result));
                             }
                         }
                     }
                 } else {
                     // order was placed without saved card and card wasn't saved during checkout
                     $result = $this->_cloneTransaction($amount, $authTransaction->getTxnId());
                     if ($result && $result->success) {
                         $payment = $this->_processSuccessResult($payment, $result, $amount);
                     } else {
                         if ($result === false) {
                             Mage::throwException(Mage::helper('braintree_payments')->__('Please try again later'));
                         } else {
                             Mage::throwException(Mage::helper('braintree_payments/error')->parseBraintreeError($result));
                         }
                     }
                 }
             } else {
                 $result = Braintree_Transaction::submitForSettlement($payment->getCcTransId(), $amount);
                 $this->_debug($payment->getCcTransId() . ' - ' . $amount);
                 $this->_debug($result);
                 if ($result->success) {
                     $payment->setIsTransactionClosed(0)->setAmountPaid($result->transaction->amount)->setShouldCloseParentTransaction(false);
                 } else {
                     Mage::throwException(Mage::helper('braintree_payments/error')->parseBraintreeError($result));
                 }
             }
         } else {
             $this->_authorize($payment, $amount, true);
         }
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('braintree_payments')->__('There was an error capturing the transaction.') . ' ' . $e->getMessage());
     }
     return $this;
 }
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:73,代码来源:Paymentmethod.php

示例10: update

 /**
  * Updates an existing record via the API
  *
  * @param   object  $model
  * @param   array   $fields
  * @param   array   $values
  * @return  bool
  */
 public function update(Model $model, $fields = null, $values = null, $conditions = null)
 {
     $to_save = $this->_createSaveArray($fields, $values);
     if (!empty($to_save['id'])) {
         $model->id = $to_save['id'];
         unset($to_save['id']);
     }
     if (empty($model->id)) {
         false;
     }
     $entity = $this->_getModelEntity($model);
     try {
         switch ($entity) {
             case 'Customer':
                 $result = Braintree_Customer::update($model->id, $to_save);
                 break;
             case 'Transaction':
                 $transaction = $this->read($model, array('conditions' => array($model->alias . '.' . $model->primaryKey => $model->id)));
                 if (empty($transaction)) {
                     return false;
                 }
                 $exploded = explode('|', $model->id);
                 $braintree_transaction_id = isset($exploded[1]) ? $exploded[1] : $model->id;
                 if (!empty($to_save['status']) && $to_save['status'] == 'voided') {
                     if ($transaction[0][$model->alias]['status'] != 'authorized' && $transaction[0][$model->alias]['status'] != 'submitted_for_settlement') {
                         $this->showError(__('A transaction can only be VOIDED when the status is AUTHORIZED or SUBMITTED FOR SETTLEMENT.', true));
                         return false;
                     }
                     $result = Braintree_Transaction::void($braintree_transaction_id);
                     if (!$result->success) {
                         $this->showError($result->message);
                         return false;
                     }
                 } elseif (!empty($to_save['status']) && $to_save['status'] == 'submitted_for_settlement') {
                     if ($transaction[0][$model->alias]['status'] != 'authorized') {
                         $this->showError(__('A transaction can only be SUBMITTED FOR SETTLEMENT when the status is AUTHORIZED.', true));
                         return false;
                     }
                     if (!empty($to_save['amount'])) {
                         $result = Braintree_Transaction::submitForSettlement($braintree_transaction_id, $to_save['amount']);
                     } else {
                         $result = Braintree_Transaction::submitForSettlement($braintree_transaction_id);
                     }
                     if (!$result->success) {
                         $this->showError($result->message);
                         return false;
                     }
                 } else {
                     $this->showError(__('The only update that can be made to a transaction is a VOID.', true));
                     return false;
                 }
                 break;
             case 'CreditCard':
                 return false;
                 break;
             case 'Address':
                 return false;
                 break;
             default:
                 $result = false;
                 break;
         }
     } catch (Exception $e) {
         $this->showError(print_r($e, true));
         return false;
     }
     $success = $result->success;
     if (!$success) {
         return false;
     }
     return $success;
 }
开发者ID:sime,项目名称:cakephp-braintree-plugin,代码行数:80,代码来源:BraintreeSource.php

示例11: capture

 public function capture(Varien_Object $payment, $amount)
 {
     try {
         if ($payment->getCcTransId()) {
             $result = Braintree_Transaction::submitForSettlement($payment->getCcTransId(), $amount);
             if ($result->success) {
                 $payment->setIsTransactionClosed(0)->setAmountPaid($result->transaction->amount);
             } else {
                 Mage::throwException($result->message);
             }
         } else {
             $this->_authorize($payment, $amount, true);
         }
     } catch (Exception $e) {
         Mage::throwException(sprintf('There was an error capturing the transaction. (%s)', $e->getMessage()));
     }
     return $this;
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:18,代码来源:Paymentmethod.php


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