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


PHP Braintree_Transaction::cloneTransaction方法代码示例

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


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

示例1: testCloneWithValidations

 function testCloneWithValidations()
 {
     $result = Braintree_Transaction::credit(array('amount' => '100.00', 'creditCard' => array('number' => '5105105105105100', 'expirationDate' => '05/2011')));
     $this->assertTrue($result->success);
     $transaction = $result->transaction;
     $cloneResult = Braintree_Transaction::cloneTransaction($transaction->id, array('amount' => '123.45'));
     $this->assertFalse($cloneResult->success);
     $baseErrors = $cloneResult->errors->forKey('transaction')->onAttribute('base');
     $this->assertEquals(Braintree_Error_Codes::TRANSACTION_CANNOT_CLONE_CREDIT, $baseErrors[0]->code);
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:10,代码来源:TransactionTest.php

示例2: cloneTransaction

 /**
  * Clone a transaction
  *
  * @param $transactionId
  * @param $amount
  *
  * @return bool|mixed
  */
 public function cloneTransaction($transactionId, $amount, $submitForSettlement = true)
 {
     // Attempt to clone the transaction
     try {
         $result = Braintree_Transaction::cloneTransaction($transactionId, array('amount' => $amount, 'options' => array('submitForSettlement' => $submitForSettlement)));
         return $result;
     } catch (Exception $e) {
         // Log the issue
         Gene_Braintree_Model_Debug::log(array('cloneTransaction' => $e));
         return false;
     }
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:20,代码来源:Braintree.php

示例3: testCloneTransaction_RaisesErrorOnInvalidProperty

 function testCloneTransaction_RaisesErrorOnInvalidProperty()
 {
     $this->setExpectedException('InvalidArgumentException');
     Braintree_Transaction::cloneTransaction('an id', array('amount' => '123.45', 'invalidProperty' => 'foo'));
 }
开发者ID:beevo,项目名称:disruptivestrong,代码行数:5,代码来源:TransactionTest.php

示例4: cloneTransaction

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

示例5: json_encode

     echo "</form>";
     echo "--------------------------------------------------------------------------------------------------------------------------";
 } else {
     if ($_REQUEST['_act'] == 'refund_process') {
         $result = Braintree_Transaction::refund((string) $_POST['id'], (string) $_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>";
         exit;
     } else {
         if ($_POST['_act'] == 'find') {
             $result = Braintree_Transaction::find($_POST['id']);
             print_r($result);
         } else {
             if ($_POST['_act'] == 'clone') {
                 $result = Braintree_Transaction::cloneTransaction($_POST['id'], array('amount' => '10.00', 'options' => array('submitForSettlement' => true)));
                 print_r($result);
             } else {
                 if ($_POST['_act'] == 'createCustomer') {
                     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']);
                     }
                     $result = Braintree_Customer::create(array('firstName' => $_POST['firstName'], 'lastName' => $_POST['lastName'], 'company' => $_POST['company'], 'email' => $_POST['email'], 'phone' => $_POST['phone'], 'fax' => $_POST['fax'], 'website' => $_POST['website'], 'customFields' => array('custom_field_one' => $_POST['custom1'], 'custom_field_two' => $_POST['custom2']), 'paymentMethodNonce' => $_POST["payment_method_nonce"]));
                     $result->success;
                     # true
开发者ID:KLBombaStick,项目名称:BrainTree,代码行数:31,代码来源:createTrans.php

示例6: _cloneTransaction

 /**
  * Clones existing transaction
  * 
  * @param decimal $amount
  * @param string $transactionId
  */
 protected function _cloneTransaction($amount, $transactionId)
 {
     $this->_debug('clone-' . $transactionId . ' amount=' . $amount);
     try {
         $result = Braintree_Transaction::cloneTransaction($transactionId, array('amount' => $amount, 'options' => array('submitForSettlement' => true)));
     } catch (Exception $e) {
         Mage::logException($e);
         return false;
     }
     $this->_debug($result);
     return $result;
 }
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:18,代码来源:Paymentmethod.php

示例7: cloneTransaction

 public function cloneTransaction($transaction_id, $amount)
 {
     $result = Braintree_Transaction::cloneTransaction($transaction_id, array('amount' => $amount, 'options' => array('submitForSettlement' => true)));
     if ($result->success) {
         return array('success' => 1, 'transaction_id' => $result->transaction->id, 'amount' => $result->transaction->amount, 'currency_code' => $result->transaction->currencyIsoCode, 'type' => $result->transaction->type, 'escrow_status' => $result->transaction->escrowStatus, 'service_fee' => $result->transaction->serviceFeeAmount);
     } else {
         if (count($result->errors->deepAll()) > 0) {
             return array('success' => 0, 'transaction_clone_errors' => $result->errors->deepAll());
         } else {
             return array('success' => 0, 'transaction_clone_errors' => $result->message);
         }
     }
 }
开发者ID:tejrajs,项目名称:yiibraintree,代码行数:13,代码来源:YiiBraintree.php


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