本文整理汇总了PHP中Braintree_TransparentRedirect::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_TransparentRedirect::url方法的具体用法?PHP Braintree_TransparentRedirect::url怎么用?PHP Braintree_TransparentRedirect::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_TransparentRedirect
的用法示例。
在下文中一共展示了Braintree_TransparentRedirect::url方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Am_Paysystem_CreditCard $plugin, $formType = self::PAYFORM)
{
$this->plugin = $plugin;
$this->formType = $formType;
$this->payButtons = array(self::PAYFORM => ___('Subscribe And Pay'), self::ADMIN_UPDATE => ___('Update Credit Card Info'), self::USER_UPDATE => ___('Update Credit Card Info'), self::ADMIN_INSERT => ___('Update Credit Card Info'));
Am_Form::__construct('cc', array('action' => Braintree_TransparentRedirect::url()));
}
示例2: 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);
//.........这里部分代码省略.........
示例3: error
$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
braintree_text_field('First Name', 'transaction[customer][first_name]', $result);
?>
<?php
braintree_text_field('Last Name', 'transaction[customer][last_name]', $result);
?>
<?php
braintree_text_field('Email', 'transaction[customer][email]', $result);
?>
</fieldset>
示例4: 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);
}
示例5: url
public function url($url = NULL, $full = false)
{
return Braintree_TransparentRedirect::url();
}
示例6: register_auto_payment_action
function register_auto_payment_action($pack_id, $override_price = false, $return = true)
{
$this->_braintree();
global $current_user;
get_currentuserinfo();
if ($current_user->ID) {
$user_id = $current_user->ID;
} else {
$current_user = get_user_by('login', ym_request('username'));
if ($current_user->ID) {
$user_id = $current_user->ID;
} else {
echo 'bugger';
return;
}
}
$customer_id = get_user_meta($user_id, 'ym_braintree_customer_id', true);
if ($customer_id) {
// validate the customer is still in braintree
try {
$customer = Braintree_Customer::find($customer_id);
} catch (Exception $e) {
$customer_id = false;
}
}
if (!$customer_id) {
// create required
// shunt the customer into braintree
$result = Braintree_Customer::create(array('id' => 'ym_' . $current_user->ID, 'email' => $current_user->user_email));
if ($result->success) {
$customer_id = $result->customer->id;
update_user_meta($user_id, 'ym_braintree_customer_id', $customer_id);
} else {
echo 'bugger';
return;
}
}
$code = 'buy_subscription_' . $pack_id . '_' . $user_id;
// credit card form driver
$trData = Braintree_TransparentRedirect::updateCustomerData(array('redirectUrl' => site_url('?ym_process=' . $this->code . '&action=process&code=' . $code), 'customerId' => $customer_id));
$key = 'customer';
$html = '
<form action="' . Braintree_TransparentRedirect::url() . '" method="post" id="' . $this->code . '_cc_form_pack_' . $pack_id . '" class="' . $this->code . '_cc_form" autocomplete="off">
<input type="hidden" name="tr_data" value="' . htmlentities($trData) . '" />
<input type="hidden" name="code" value="' . $code . '" />
<div>
<label for="braintree_credit_card_number">' . __('Credit Card Number', 'ym') . '</label>
<input type="text" name="' . $key . '[credit_card][number]" id="braintree_credit_card_number" value=""></input>
<label for="braintree_credit_card_ccv">' . __('Credit Card CCV', 'ym') . '</label>
<input type="text" name="' . $key . '[credit_card][cvv]" id="braintree_credit_card_ccv" value=""></input>
<label for="braintree_credit_card_exp">' . __('Credit Card Expiry (mm/yyyy)', 'ym') . '</label>
<input type="text" size="7" maxlength="7" name="' . $key . '[credit_card][expiration_date]" id="braintree_credit_card_exp" value=""></input>
</div>
<input class="submit-button" type="submit" />
</form>
';
if ($return) {
return $html;
} else {
echo $html;
return;
}
}