本文整理汇总了PHP中authorizeFromEnv函数的典型用法代码示例。如果您正苦于以下问题:PHP authorizeFromEnv函数的具体用法?PHP authorizeFromEnv怎么用?PHP authorizeFromEnv使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了authorizeFromEnv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreate
public function testCreate()
{
authorizeFromEnv();
$c = Stripe_Coupon::create(array('percent_off' => 25, 'duration' => 'repeating', 'duration_in_months' => 5, 'id' => 'test_coupon'));
$this->assertEqual('test_coupon', $c->id);
$this->assertEqual(25, $c->percent_off);
}
示例2: testRetrieve
public function testRetrieve()
{
authorizeFromEnv();
$c = Stripe_Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015)));
$d = Stripe_Charge::retrieve($c->id);
$this->assertEqual($d->id, $c->id);
}
示例3: testRefund
public function testRefund()
{
authorizeFromEnv();
$c = Conekta_Charge::create(array('amount' => 2000, 'currency' => 'mxn', 'description' => 'Some desc', 'card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015, 'cvc' => 123, 'name' => 'Mario Moreno')));
$c->refund();
$this->assertTrue($c->status == "refunded");
}
示例4: testCreate
public function testCreate()
{
authorizeFromEnv();
$id = 'test_coupon-' . self::randomString();
$c = Conekta_Coupon::create(array('percent_off' => 25, 'duration' => 'repeating', 'duration_in_months' => 5, 'id' => $id));
$this->assertEqual($id, $c->id);
$this->assertEqual(25, $c->percent_off);
}
示例5: testRetrieve
public function testRetrieve()
{
authorizeFromEnv();
$d = Stripe_Balance::retrieve();
$this->assertEqual($d->object, "balance");
$this->assertTrue(Stripe_Util::isList($d->available));
$this->assertTrue(Stripe_Util::isList($d->pending));
}
示例6: testRetrieve
public function testRetrieve()
{
$recipient = self::createTestRecipient();
authorizeFromEnv();
$transfer = Conekta_Transfer::create(array('amount' => 100, 'currency' => 'usd', 'recipient' => $recipient->id));
$reloaded = Conekta_Transfer::retrieve($transfer->id);
$this->assertEqual($reloaded->id, $transfer->id);
}
示例7: testRetrieve
public function testRetrieve()
{
authorizeFromEnv();
$d = Stripe_Account::retrieve();
$this->assertEqual($d->email, "test+bindings@stripe.com");
$this->assertEqual($d->charge_enabled, false);
$this->assertEqual($d->details_submitted, false);
}
示例8: testUpcoming
public function testUpcoming()
{
authorizeFromEnv();
$c = Stripe_Customer::create(array('card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015)));
$invoice = Stripe_Invoice::upcoming(array('customer' => $c->id));
$this->assertEqual($invoice->customer, $c->id);
$this->assertEqual($invoice->attempted, false);
}
示例9: testBadData
public function testBadData()
{
authorizeFromEnv();
try {
CleverDistrict::all(array('asdf' => 25));
} catch (CleverInvalidRequestError $e) {
$this->assertEquals(400, $e->getHttpStatus());
}
}
示例10: testUpdateMetadataAll
public function testUpdateMetadataAll()
{
authorizeFromEnv();
$charge = Stripe_Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015)));
$charge->metadata = array('test' => 'foo bar');
$charge->save();
$updatedCharge = Stripe_Charge::retrieve($charge->id);
$this->assertEqual('foo bar', $updatedCharge->metadata['test']);
}
示例11: retrieveOrCreateCoupon
/**
* Verify that a coupon with a given ID exists, or create a new one if it does
* not.
*/
protected static function retrieveOrCreateCoupon($id)
{
authorizeFromEnv();
try {
$coupon = Stripe_Coupon::retrieve($id);
} catch (Stripe_InvalidRequestError $exception) {
$coupon = Stripe_Coupon::create(array('id' => $id, 'duration' => 'forever', 'percent_off' => 25));
}
}
示例12: testBadData
public function testBadData()
{
authorizeFromEnv();
try {
Stripe_Charge::create();
} catch (Stripe_InvalidRequestError $e) {
$this->assertEqual(400, $e->getHttpStatus());
}
}
示例13: testCount
public function testCount()
{
authorizeFromEnv();
$validQueries = array(array('count' => 'true'), array('count' => true));
foreach ($validQueries as $query) {
$resp = CleverStudent::all($query);
$this->assertEquals($resp['count'] > 0, true);
}
}
示例14: retrieveOrCreatePlan
/**
* Verify that a plan with a given ID exists, or create a new one if it does
* not.
*/
protected static function retrieveOrCreatePlan($id)
{
authorizeFromEnv();
try {
$plan = Plan::retrieve($id);
} catch (InvalidRequestError $exception) {
$plan = Plan::create(array('id' => $id, 'amount' => 0, 'currency' => 'usd', 'interval' => 'month', 'name' => 'Gold Test Plan'));
}
}
示例15: testUpcoming
public function testUpcoming()
{
authorizeFromEnv();
$customer = self::createTestCustomer();
Stripe_InvoiceItem::create(array('customer' => $customer->id, 'amount' => 0, 'currency' => 'usd'));
$invoice = Stripe_Invoice::upcoming(array('customer' => $customer->id));
$this->assertEqual($invoice->customer, $customer->id);
$this->assertEqual($invoice->attempted, false);
}