本文整理汇总了PHP中Braintree_TransparentRedirect::transactionData方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_TransparentRedirect::transactionData方法的具体用法?PHP Braintree_TransparentRedirect::transactionData怎么用?PHP Braintree_TransparentRedirect::transactionData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_TransparentRedirect
的用法示例。
在下文中一共展示了Braintree_TransparentRedirect::transactionData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateTransactionWithServiceFeesFromTransparentRedirect
function testCreateTransactionWithServiceFeesFromTransparentRedirect()
{
$params = array('transaction' => array('customer' => array('first_name' => 'First'), 'credit_card' => array('number' => '5105105105105100', 'expiration_date' => '05/12'), 'service_fee_amount' => '1.00', 'merchant_account_id' => Braintree_TestHelper::nonDefaultSubMerchantAccountId()));
$trParams = array('transaction' => array('type' => Braintree_Transaction::SALE, 'amount' => '100.00'));
$trData = Braintree_TransparentRedirect::transactionData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
$queryString = Braintree_TestHelper::submitTrRequest(Braintree_TransparentRedirect::url(), $params, $trData);
$result = Braintree_TransparentRedirect::confirm($queryString);
$this->assertTrue($result->success);
$this->assertEquals('1.00', $result->transaction->serviceFeeAmount);
}
示例2: testCreateTransactionFromTransparentRedirect
function testCreateTransactionFromTransparentRedirect()
{
$params = array('transaction' => array('customer' => array('first_name' => 'First'), 'credit_card' => array('number' => '5105105105105100', 'expiration_date' => '05/12')));
$trParams = array('transaction' => array('type' => Braintree_Transaction::SALE, 'amount' => '100.00'));
$trData = Braintree_TransparentRedirect::transactionData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
$queryString = Braintree_TestHelper::submitTrRequest(Braintree_TransparentRedirect::url(), $params, $trData);
$result = Braintree_TransparentRedirect::confirm($queryString);
$this->assertTrue($result->success);
$this->assertEquals('100.00', $result->transaction->amount);
$this->assertEquals(Braintree_Transaction::SALE, $result->transaction->type);
$this->assertEquals(Braintree_Transaction::AUTHORIZED, $result->transaction->status);
$creditCard = $result->transaction->creditCardDetails;
$this->assertEquals('510510', $creditCard->bin);
$this->assertEquals('5100', $creditCard->last4);
$this->assertEquals('US', $creditCard->customerLocation);
$this->assertEquals('MasterCard', $creditCard->cardType);
$this->assertEquals('05/2012', $creditCard->expirationDate);
$this->assertEquals('510510******5100', $creditCard->maskedNumber);
$customer = $result->transaction->customerDetails;
$this->assertequals('First', $customer->firstName);
}
示例3: 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);
}
示例4: form
//.........这里部分代码省略.........
<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);
?>
<?php
$this->braintree_text_field('Email', 'transaction[customer][email]', $result);
?>
</fieldset>
<fieldset>
<legend>Payment Information</legend>
<?php
$this->braintree_text_field('Credit Card Number', 'transaction[credit_card][number]', $result);
?>
<?php
$this->braintree_text_field('Expiration Date (MM/YY)', 'transaction[credit_card][expiration_date]', $result);
?>
<?php
$this->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>
<?php
}
示例5: 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>
示例6: createTransactionViaTr
function createTransactionViaTr($regularParams, $trParams)
{
Braintree_TestHelper::suppressDeprecationWarnings();
$trData = Braintree_TransparentRedirect::transactionData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
return Braintree_TestHelper::submitTrRequest(Braintree_Transaction::createTransactionUrl(), $regularParams, $trData);
}
示例7: 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>