本文整理汇总了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";
}