本文整理匯總了PHP中Braintree_Subscription::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Braintree_Subscription::find方法的具體用法?PHP Braintree_Subscription::find怎麽用?PHP Braintree_Subscription::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Braintree_Subscription
的用法示例。
在下文中一共展示了Braintree_Subscription::find方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFind_throwsIfNotFound
function testFind_throwsIfNotFound()
{
$this->setExpectedException('Braintree_Exception_NotFound', 'subscription with id does-not-exist not found');
Braintree_Subscription::find('does-not-exist');
}
示例2: getSubscriptions
/**
* wrapper for getting subscriptions from braintree
* @param object - user
* @param string - id of the subscription (default null)
*
* @return object - the searched subscriptions OR null if not found OR collection of subscriptions
*/
private static function getSubscriptions($user, $subscriptionId = null)
{
self::setBraintreeCredentials($user);
$returnVariable = null;
if ($subscriptionId) {
try {
$returnVariable = Braintree_Subscription::find($subscriptionId);
} catch (Exception $e) {
return null;
}
} else {
$returnVariable = Braintree_Subscription::search(array(Braintree_SubscriptionSearch::status()->in(array(Braintree_Subscription::ACTIVE, Braintree_Subscription::PAST_DUE, Braintree_Subscription::PENDING))));
}
return $returnVariable;
}
示例3: testErrorsOnFindWithWhitespaceArgument
function testErrorsOnFindWithWhitespaceArgument()
{
$this->setExpectedException('InvalidArgumentException');
Braintree_Subscription::find('\\t');
}
示例4: catch
<?php
include '../brainTreePhp/lib/Braintree.php';
if (isset($_GET['subscription'])) {
$subscription = $_GET['subscription'];
} else {
//echo 'Missing subscription ID!';
echo "0";
die;
}
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('zn8d4c74dbnp5ntw');
Braintree_Configuration::publicKey('ttwrprnsj83thjjz');
Braintree_Configuration::privateKey('a818cb5f3164585f31f4f03066f308c8');
try {
$subscription = Braintree_Subscription::find($subscription);
} catch (Braintree_Exception_NotFound $e) {
//header('Location: ../response.html');
echo "0";
die;
}
if ($subscription->status == Braintree_Subscription::ACTIVE) {
//header('Location: ../app.html');
echo "1";
} else {
//header('Location: ../response.html');
echo "0";
}