本文整理汇总了PHP中Braintree_TransparentRedirect::updateCustomerData方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_TransparentRedirect::updateCustomerData方法的具体用法?PHP Braintree_TransparentRedirect::updateCustomerData怎么用?PHP Braintree_TransparentRedirect::updateCustomerData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_TransparentRedirect
的用法示例。
在下文中一共展示了Braintree_TransparentRedirect::updateCustomerData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateCustomerFromTransparentRedirect
function testUpdateCustomerFromTransparentRedirect()
{
$customer = Braintree_Customer::create(array('firstName' => 'Mike', 'lastName' => 'Jonez'))->customer;
$params = array('customer' => array('first_name' => 'Second'));
$trParams = array('customerId' => $customer->id, 'customer' => array('lastName' => 'Penultimate'));
$trData = Braintree_TransparentRedirect::updateCustomerData(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);
}
示例2: 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);
}
示例3: 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;
}
}