• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Braintree_TransparentRedirect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: confirm

 public function confirm($queryString)
 {
     $params = Braintree_TransparentRedirect::parseAndValidateQueryString($queryString);
     $confirmationKlasses = array(Braintree_TransparentRedirect::CREATE_TRANSACTION => 'Braintree_TransactionGateway', Braintree_TransparentRedirect::CREATE_CUSTOMER => 'Braintree_CustomerGateway', Braintree_TransparentRedirect::UPDATE_CUSTOMER => 'Braintree_CustomerGateway', Braintree_TransparentRedirect::CREATE_PAYMENT_METHOD => 'Braintree_CreditCardGateway', Braintree_TransparentRedirect::UPDATE_PAYMENT_METHOD => 'Braintree_CreditCardGateway');
     $confirmationGateway = new $confirmationKlasses[$params["kind"]]($this->_gateway);
     return $confirmationGateway->_doCreate('/transparent_redirect_requests/' . $params['id'] . '/confirm', array());
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:7,代码来源:TransparentRedirectGateway.php


示例2: testData_doesNotClobberDefaultTimezone

 function testData_doesNotClobberDefaultTimezone()
 {
     $originalZone = date_default_timezone_get();
     date_default_timezone_set('Europe/London');
     $trData = Braintree_TransparentRedirect::createCustomerData(array('redirectUrl' => 'http://www.example.com'));
     $zoneAfterCall = date_default_timezone_get();
     date_default_timezone_set($originalZone);
     $this->assertEquals('Europe/London', $zoneAfterCall);
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:9,代码来源:TransparentRedirectTest.php


示例3: buildTrData

 function buildTrData($redirectUrl)
 {
     $customer = Mage::getSingleton('customer/session')->getCustomer();
     if ($this->braintree->exists($customer->getId())) {
         return Braintree_TransparentRedirect::createCreditCardData(array('redirectUrl' => $redirectUrl, 'creditCard' => array('customerId' => $customer->getId())));
     } else {
         $credit_card_billing = array();
         $billing = $customer->getDefaultBilling();
         if ($billing) {
             $address = Mage::getModel('customer/address')->load($billing);
             $credit_card_billing['billingAddress'] = $this->braintree->toBraintreeAddress($address);
         }
         return Braintree_TransparentRedirect::createCustomerData(array('redirectUrl' => $redirectUrl, 'customer' => array('id' => $customer->getId(), 'firstName' => $customer->getFirstname(), 'lastName' => $customer->getLastname(), 'company' => $customer->getCompany(), 'phone' => $customer->getTelephone(), 'fax' => $customer->getFax(), 'email' => $customer->getEmail(), 'creditCard' => $credit_card_billing)));
     }
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:15,代码来源:Management.php


示例4:

<?php

$queryString = $_SERVER['QUERY_STRING'];
$result = Braintree_TransparentRedirect::confirm($queryString);
if ($result->success) {
    $message = "Customer Created with ID: " . $result->customer->email;
} else {
    $message = print_r($result->errors->deepAll(), True);
}
?>

<html>
  <body>
    <h1>Transaction Response</h1>
    <ul>
      <li>Status - <?php 
echo $message;
?>
</li>
    </ul>
  </body>
</html>
开发者ID:Justin-Leung,项目名称:braintree_php_guide,代码行数:22,代码来源:response.php


示例5: updateCustomerViaTr

 function updateCustomerViaTr($regularParams, $trParams)
 {
     Braintree_TestHelper::suppressDeprecationWarnings();
     $trData = Braintree_TransparentRedirect::updateCustomerData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
     return Braintree_TestHelper::submitTrRequest(Braintree_Customer::updateCustomerUrl(), $regularParams, $trData);
 }
开发者ID:beevo,项目名称:disruptivestrong,代码行数:6,代码来源:CustomerTest.php


示例6: updateFromTransparentRedirect

 /**
  * update a customer from a TransparentRedirect operation
  *
  * @access public
  * @param array $attribs
  * @return object
  */
 public function updateFromTransparentRedirect($queryString)
 {
     trigger_error("DEPRECATED: Please use Braintree_TransparentRedirectRequest::confirm", E_USER_NOTICE);
     $params = Braintree_TransparentRedirect::parseAndValidateQueryString($queryString);
     return $this->_doUpdate('post', '/customers/all/confirm_transparent_redirect_request', array('id' => $params['id']));
 }
开发者ID:beevo,项目名称:disruptivestrong,代码行数:13,代码来源:CustomerGateway.php


示例7: form

    public function form()
    {
        $result = Braintree_Transaction::sale(array("amount" => "1000.00", "creditCard" => array("number" => $_POST["number"], "cvv" => $_POST["cvv"], "expirationMonth" => $_POST["month"], "expirationYear" => $_POST["year"]), "options" => array("submitForSettlement" => true)));
        if ($result->success) {
            echo "Success! Transaction ID: " . $result->transaction->id;
        } else {
            if ($result->transaction) {
                echo "Error: " . $result->message;
                echo "<br/>";
                echo "Code: " . $result->transaction->processorResponseCode;
            } else {
                echo "Validation errors:<br/>";
                foreach ($result->errors->deepAll() as $error) {
                    echo "- " . $error->message . "<br/>";
                }
            }
        }
        pr($result);
        die;
        ?>
        <html>
            <head>
                <title>Braintree Transparent Redirect</title>
            </head>
            <body>
                <?php 
        if (isset($_GET["id"])) {
            echo "id: " . $_GET["id"];
            $result = Braintree_TransparentRedirect::confirm($_SERVER['QUERY_STRING']);
            pr($result);
        }
        if (isset($result) && $result->success) {
            ?>
                    <h1>Braintree Transparent Redirect Response</h1>
                    <?php 
            $transaction = $result->transaction;
            ?>
                    <table>
                        <tr><td>transaction id</td><td><?php 
            echo htmlentities($transaction->id);
            ?>
</td></tr>
                        <tr><td>transaction status</td><td><?php 
            echo htmlentities($transaction->status);
            ?>
</td></tr>
                        <tr><td>transaction amount</td><td><?php 
            echo htmlentities($transaction->amount);
            ?>
</td></tr>
                        <tr><td>customer first name</td><td><?php 
            echo htmlentities($transaction->customerDetails->firstName);
            ?>
</td></tr>
                        <tr><td>customer last name</td><td><?php 
            echo htmlentities($transaction->customerDetails->lastName);
            ?>
</td></tr>
                        <tr><td>customer email</td><td><?php 
            echo htmlentities($transaction->customerDetails->email);
            ?>
</td></tr>
                        <tr><td>credit card number</td><td><?php 
            echo htmlentities($transaction->creditCardDetails->maskedNumber);
            ?>
</td></tr>
                        <tr><td>expiration date</td><td><?php 
            echo htmlentities($transaction->creditCardDetails->expirationDate);
            ?>
</td></tr>
                    </table>
                    <?php 
        } else {
            if (!isset($result)) {
                echo "gagal";
                $result = null;
            }
            ?>
                    <h1>Braintree Transparent Redirect Example</h1>
                    <?php 
            if (isset($result)) {
                ?>
                        <div style="color: red;"><?php 
                echo $result->errors->deepSize();
                ?>
 error(s)</div>
                    <?php 
            }
            ?>
                    <form method="POST" action="<?php 
            echo Braintree_TransparentRedirect::url();
            ?>
" autocomplete="off">
                        <fieldset>
                            <legend>Customer</legend>
                            <?php 
            $this->braintree_text_field('First Name', 'transaction[customer][first_name]', $result);
            ?>
                            <?php 
            $this->braintree_text_field('Last Name', 'transaction[customer][last_name]', $result);
//.........这里部分代码省略.........
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:101,代码来源:single_transactions.php


示例8: braintree_text_field

    <fieldset>
        <legend>Payment Information</legend>

        <?php 
    braintree_text_field('Credit Card Number', 'transaction[credit_card][number]', $result);
    ?>
        <?php 
    braintree_text_field('Expiration Date (MM/YY)', 'transaction[credit_card][expiration_date]', $result);
    ?>
        <?php 
    braintree_text_field('CVV', 'transaction[credit_card][cvv]', $result);
    ?>
    </fieldset>

    <?php 
    $tr_data = Braintree_TransparentRedirect::transactionData(array('redirectUrl' => "http://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH), 'transaction' => array('amount' => '10.00', 'type' => 'sale')));
    ?>
    <input type="hidden" name="tr_data" value="<?php 
    echo $tr_data;
    ?>
" />

    <br />
    <input type="submit" value="Submit" />
</form>
    <?php 
}
?>
</body>
</html>
开发者ID:nstungxd,项目名称:F2CA5,代码行数:30,代码来源:index.php


示例9: createCreditCardData

 public function createCreditCardData($params)
 {
     return Braintree_TransparentRedirect::createCreditCardData($params);
 }
开发者ID:sime,项目名称:cakephp-braintree-plugin,代码行数:4,代码来源:BraintreeTransparentRedirectHelper.php


示例10: updateCreditCardViaTr

 function updateCreditCardViaTr($regularParams, $trParams)
 {
     $trData = Braintree_TransparentRedirect::updateCreditCardData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
     return Braintree_TestHelper::submitTrRequest(Braintree_CreditCard::updateCreditCardUrl(), $regularParams, $trData);
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:5,代码来源:CreditCardTest.php


示例11: confirm

 public static function confirm($queryString)
 {
     $params = Braintree_TransparentRedirect::parseAndValidateQueryString($queryString);
     $confirmationKlasses = array(Braintree_TransparentRedirect::CREATE_TRANSACTION => 'Braintree_Transaction', Braintree_TransparentRedirect::CREATE_CUSTOMER => 'Braintree_Customer', Braintree_TransparentRedirect::UPDATE_CUSTOMER => 'Braintree_Customer', Braintree_TransparentRedirect::CREATE_PAYMENT_METHOD => 'Braintree_CreditCard', Braintree_TransparentRedirect::UPDATE_PAYMENT_METHOD => 'Braintree_CreditCard');
     return call_user_func(array($confirmationKlasses[$params["kind"]], '_doCreate'), '/transparent_redirect_requests/' . $params['id'] . '/confirm', array());
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:6,代码来源:TransparentRedirect.php


示例12: array

<?php

$trData = Braintree_TransparentRedirect::transactionData(array('transaction' => array('type' => Braintree_Transaction::SALE, 'amount' => '1000.00', 'options' => array('submitForSettlement' => true)), 'redirectUrl' => 'http://localhost:8080/braintree'));
?>

<html>
  <head>
    <style type='text/css'>label {display: block;} input {margin-bottom: 10px;}</style>
  </head>
  <body>
    <h1>Braintree Credit Card Transaction Form</h1>
    <form id='payment-form' action='<?php 
echo Braintree_TransparentRedirect::url();
?>
' method='POST'>
      <input type='hidden' name='tr_data' value='<?php 
echo htmlentities($trData);
?>
' />
      <div>
        <h2>Credit Card</h2>
        <label for='braintree_credit_card_number'>Credit Card Number</label>
        <input type='text' name='transaction[credit_card][number]' id='braintree_credit_card_number' value='4111111111111111'></input>
        <label for='braintree_credit_card_exp'>Credit Card Expiry (mm/yyyy)</label>
        <input type='text' name='transaction[credit_card][expiration_date]' id='braintree_credit_card_exp' value='12/2015'></input>
      </div>
      <input class='submit-button' type='submit' />
    </form>
  </body>
</html>
开发者ID:Justin-Leung,项目名称:braintree_php_guide,代码行数:30,代码来源:form.php


示例13: confirm

 public function confirm()
 {
     try {
         return Braintree_TransparentRedirect::confirm($_SERVER['QUERY_STRING']);
     } catch (Braintree_Exception $e) {
         Mage::logException($e);
         $result = stdClass;
         $result->success = false;
         return $result;
     }
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:11,代码来源:Paymentmethod.php


示例14: startup

 /**
  * Startup
  *
  * @param   object  $controller
  * @return  void
  */
 public function startup(Controller $controller)
 {
     if (in_array($this->controller->params['action'], $this->_callback_actions) || array_key_exists($this->controller->params['action'], $this->_callback_actions)) {
         $this->action_settings = array();
         if (!empty($this->_callback_actions[$this->controller->params['action']]) && is_array($this->_callback_actions[$this->controller->params['action']])) {
             $this->action_settings = $this->_callback_actions[$this->controller->params['action']];
         }
         $continue = true;
         $parameters = array();
         foreach ($this->_callback_parameters as $parameter) {
             if (empty($this->controller->params['url'][$parameter])) {
                 $continue = false;
                 break;
             } else {
                 $parameters[$parameter] = $this->controller->params['url'][$parameter];
             }
         }
         if ($continue) {
             App::import('Vendor', 'Braintree.Braintree');
             $query_string = http_build_query($parameters, '', '&');
             foreach (array('BraintreeAddress', 'BraintreeCreditCard', 'BraintreeCreditCardRelation') as $model_name) {
                 if (!isset($this->{$model_name})) {
                     $this->{$model_name} = ClassRegistry::init('Braintree.' . $model_name);
                 }
             }
             if (!$this->beforeConfirmation()) {
                 return false;
             }
             try {
                 $result = Braintree_TransparentRedirect::confirm($query_string);
             } catch (Exception $e) {
                 $result = false;
             }
             if (empty($result) || !$result->success) {
                 $this->onFailure($result);
                 return true;
             } else {
                 if (!$this->onSuccess($result)) {
                     return true;
                 }
             }
             if (!$this->afterProcessing()) {
                 return false;
             }
         }
     }
 }
开发者ID:sime,项目名称:cakephp-braintree-plugin,代码行数:53,代码来源:BraintreeCallbackComponent.php


示例15: updateAction

 public function updateAction()
 {
     $this->form = $this->createUpdateForm();
     if ($this->getParam('http_status') && $this->getParam('hash')) {
         $res = Braintree_TransparentRedirect::confirm($_SERVER['QUERY_STRING']);
         if ($res instanceof Braintree_Result_Error) {
             $this->form->getElementById('credit_card__number-0')->setError($res->message);
         } else {
             return $this->redirectLocation(REL_ROOT_URL . '/member');
         }
     }
     $this->view->form = $this->form;
     $this->view->invoice = null;
     $this->view->display_receipt = false;
     $this->view->display('cc/info.phtml');
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:16,代码来源:braintree.php


示例16: createViaTr

 public static function createViaTr($regularParams, $trParams)
 {
     $trData = Braintree_TransparentRedirect::transactionData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
     return Braintree_TestHelper::submitTrRequest(TransparentRedirect::url(), $regularParams, $trData);
 }
开发者ID:oscarsmartwave,项目名称:l45fbl45t,代码行数:5,代码来源:TestHelper.php


示例17: testUrl

 function testUrl()
 {
     $url = Braintree_TransparentRedirect::url();
     $developmentPort = getenv("GATEWAY_PORT") ? getenv("GATEWAY_PORT") : 3000;
     $this->assertEquals("http://localhost:" . $developmentPort . "/merchants/integration_merchant_id/transparent_redirect_requests", $url);
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:6,代码来源:TransparentRedirectTest.php


示例18: createFromTransparentRedirect

 /**
  *
  * @access public
  * @param array $attribs
  * @return object
  */
 public static function createFromTransparentRedirect($queryString)
 {
     trigger_error("DEPRECATED: Please use Braintree_TransparentRedirectRequest::confirm", E_USER_NOTICE);
     $params = Braintree_TransparentRedirect::parseAndValidateQueryString($queryString);
     return self::_doCreate('/transactions/all/confirm_transparent_redirect_request', array('id' => $params['id']));
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:12,代码来源:Transaction.php


示例19: do_process


//.........这里部分代码省略.........
                    } else {
                        if ($what == 'bundle' || $what == 'post') {
                            // post or bundle purchase
                            if ($what == 'post') {
                                $cost = get_post_meta($pack_id, '_ym_post_purchasable_cost', true);
                            } else {
                                $bundle = ym_get_bundle($pack_id);
                                if (!$bundle) {
                                    $r = array('ok' => false, 'message' => __('Bundle Error', 'ym'));
                                } else {
                                    $cost = $bundle->cost;
                                }
                            }
                            if ($cost) {
                                $result = Braintree_Transaction::sale(array('amount' => $cost, 'options' => array('submitForSettlement' => true), 'customerId' => $result->customer->id, 'paymentMethodToken' => $result->customer->creditCards[0]->token));
                                $amount = $result->transaction->amount;
                                if ($result->success) {
                                    // common
                                    $this->common_process($code, $amount, true, false);
                                    // thanks
                                    if ($what == 'subscription') {
                                        $url = $this->redirectlogic($pack);
                                    } else {
                                        if ($what == 'post') {
                                            $url = $this->redirectlogic(array('ppp' => true, 'post_id' => $pack_id));
                                        } else {
                                            $url = $this->redirectlogic(array('ppp' => true, 'ppp_pack_id' => $pack_id));
                                        }
                                    }
                                    $r = array('ok' => true, 'url' => $url, 'message' => __('Payment Complete', 'ym'));
                                } else {
                                    $r = $this->_failedBraintree($result, true);
                                }
                            }
                        } else {
                            // unhandled purchase
                            $r = $this->_failedBraintree($result, true);
                        }
                    }
                } else {
                    $r = $this->_failedBraintree($result, true);
                }
                ob_clean();
                echo json_encode($r);
                // bugger
                exit;
                // non ajax/primary js failed
                // transparent redirect handlers
            } else {
                if ($action == 'process') {
                    $this->_braintree();
                    $queryString = $_SERVER['QUERY_STRING'];
                    try {
                        $result = Braintree_TransparentRedirect::confirm($queryString);
                    } catch (Exception $e) {
                        if (get_class($e) == 'Braintree_Exception_NotFound') {
                            echo 'not found';
                        } else {
                            echo '<pre>';
                            print_r($e);
                            echo $e->getMessage();
                        }
                        exit;
                    }
                    if ($result->success) {
                        $code = ym_request('code');
                        // grab token and subscribe
                        list($buy, $what, $pack_id, $user_id) = explode('_', $code);
                        $pack = ym_get_pack_by_id($pack_id);
                        $planId = isset($pack['braintree_plan_id']) ? $pack['braintree_plan_id'] : false;
                        if ($pack['num_cycles'] == 1 || $planId) {
                            // initiate charge against just added credit card
                            if ($planId) {
                                $result = Braintree_Subscription::create(array('planId' => $planId, 'paymentMethodToken' => $result->customer->creditCards[0]->token));
                                $amount = $result->subscription->transactions[0]->amount;
                            } else {
                                $result = Braintree_Transaction::sale(array('amount' => $pack['cost'], 'options' => array('submitForSettlement' => true), 'customerId' => $result->customer->id, 'paymentMethodToken' => $result->customer->creditCards[0]->token));
                                $amount = $result->transaction->amount;
                            }
                            if ($result->success) {
                                // common
                                $this->common_process($code, $amount, true, false);
                                // thanks
                                $this->redirectlogic($pack, true);
                                exit;
                            } else {
                                $this->_failedBraintree($result);
                            }
                        } else {
                            $this->_failedBraintree($result);
                        }
                        exit;
                    }
                    $this->_failedBraintree($result);
                } else {
                    $this->_failedBraintree();
                }
            }
        }
    }
开发者ID:AdultStack,项目名称:ap-members,代码行数:101,代码来源:ym_braintree.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Braintree_Util类代码示例发布时间:2022-05-23
下一篇:
PHP Braintree_Transaction类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap