本文整理汇总了PHP中Braintree_TransparentRedirect::createCustomerData方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_TransparentRedirect::createCustomerData方法的具体用法?PHP Braintree_TransparentRedirect::createCustomerData怎么用?PHP Braintree_TransparentRedirect::createCustomerData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_TransparentRedirect
的用法示例。
在下文中一共展示了Braintree_TransparentRedirect::createCustomerData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: testCreateCustomerFromTransparentRedirect
function testCreateCustomerFromTransparentRedirect()
{
$params = array('customer' => array('first_name' => 'Second'));
$trParams = array('customer' => array('lastName' => 'Penultimate'));
$trData = Braintree_TransparentRedirect::createCustomerData(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);
$customer = $result->customer;
$this->assertequals('Second', $customer->firstName);
$this->assertequals('Penultimate', $customer->lastName);
}
示例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)));
}
}
示例4: createForm
function createForm()
{
$form = $this->plugin->createForm(Am_Form_CreditCard::PAYFORM, $this->invoice);
$form->addHidden(Am_Controller::ACTION_KEY)->setValue($this->_request->getActionName());
$form->addHidden('cc_id')->setValue($this->getFiltered('cc_id'));
$user = $this->invoice->getUser();
$form->setDataSources(array($this->_request, new HTML_QuickForm2_DataSource_Array($form->getDefaultValues($user))));
$form->addHidden('tr_data')->setValue(Braintree_TransparentRedirect::createCustomerData(array('redirectUrl' => $this->plugin->getPluginUrl(Am_Paysystem_Braintree::ACTION_CC) . "?cc_id=" . $this->getFiltered('cc_id'), 'customer' => array('firstName' => $this->invoice->getUser()->name_f, 'lastName' => $this->invoice->getUser()->name_l, 'email' => $this->invoice->getUser()->email, 'phone' => $this->invoice->getUser()->phone))));
return $form;
}
示例5: createCustomerViaTr
function createCustomerViaTr($regularParams, $trParams)
{
Braintree_TestHelper::suppressDeprecationWarnings();
$trData = Braintree_TransparentRedirect::createCustomerData(array_merge($trParams, array("redirectUrl" => "http://www.example.com")));
return Braintree_TestHelper::submitTrRequest(Braintree_Customer::createCustomerUrl(), $regularParams, $trData);
}
示例6: htmlentities
<?php
$trData = Braintree_TransparentRedirect::createCustomerData(array('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>Customer Information</h2>
<label for='customer_first_name'>First Name</label>
<input type='text' name='customer[first_name]' id='customer_first_name'></input>
<label for='customer_last_name'>Last Name</label>
<input type='text' name='customer[last_name]' id='customer_last_name'></input>
<label for='customer_email'>Email</label>
<input type='text' name='customer[email]' id='customer_email'></input>
<h2>Billing Address</h2>
<label for='billing_street_address'>Street Address</label>
<input type='text' name='customer[credit_card][billing_address][street_address]' id='billing_street_address'></input>
<label for='billing_extended_address'>Extended Address</label>