本文整理汇总了PHP中Customer::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::retrieve方法的具体用法?PHP Customer::retrieve怎么用?PHP Customer::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::retrieve方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCustomerRetrieve
/**
* @depends testCustomerCreate
* @group ecommerce
*/
public function testCustomerRetrieve($customer_existing)
{
$this->mockResponse($this->success_customer_retrieve_response());
$customer = Customer::retrieve($customer_existing->token);
$this->assertTrue($customer->is_active);
$this->assertNotNull($customer->token);
}
示例2: testCustomerRetrieve
public function testCustomerRetrieve()
{
$token = 'cus_zDdjHBuNW3do8G3jaTqApzsI';
$this->mockResponse($this->success_customer_retrieve_response());
$customer = Customer::retrieve($token);
$this->assertTrue($customer->is_active);
$this->assertNotNull($customer->token);
}
示例3: testInvalidObject
public function testInvalidObject()
{
self::authorizeFromEnv();
try {
Customer::retrieve('invalid');
} catch (Error\InvalidRequest $e) {
$this->assertSame(404, $e->getHttpStatus());
}
}
示例4: testDeletion
public function testDeletion()
{
self::authorizeFromEnv();
$id = 'test-coupon-' . self::randomString();
$coupon = Coupon::create(array('percent_off' => 25, 'duration' => 'repeating', 'duration_in_months' => 5, 'id' => $id));
$customer = self::createTestCustomer(array('coupon' => $id));
$this->assertTrue(isset($customer->discount));
$this->assertTrue(isset($customer->discount->coupon));
$this->assertSame($id, $customer->discount->coupon->id);
$customer->deleteDiscount();
$this->assertFalse(isset($customer->discount));
$customer = Customer::retrieve($customer->id);
$this->assertFalse(isset($customer->discount));
}
示例5: testCustomerDeleteSource
public function testCustomerDeleteSource()
{
self::authorizeFromEnv();
$token = Token::create(array('card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => date('Y') + 3, 'cvc' => '314')));
$customer = $this->createTestCustomer();
$createdSource = $customer->sources->create(array('source' => $token->id));
$customer->save();
$updatedCustomer = Customer::retrieve($customer->id);
$updatedSources = $updatedCustomer->sources->all();
$this->assertSame(count($updatedSources['data']), 2);
$deleteStatus = $updatedCustomer->sources->retrieve($createdSource->id)->delete();
$this->assertTrue($deleteStatus->deleted);
$updatedCustomer->save();
$postDeleteCustomer = Customer::retrieve($customer->id);
$postDeleteSources = $postDeleteCustomer->sources->all();
$this->assertSame(count($postDeleteSources['data']), 1);
}
示例6: testCustomerSubscriptionAllRetrieve
public function testCustomerSubscriptionAllRetrieve()
{
$planID = 'gold-' . self::randomString();
self::retrieveOrCreatePlan($planID);
$customer = self::createTestCustomer();
$subscription = Subscription::create(array('customer' => $customer->id, 'plan' => $planID));
$planID_2 = 'gold-2-' . self::randomString();
self::retrieveOrCreatePlan($planID_2);
$subscription_2 = Subscription::create(array('customer' => $customer->id, 'plan' => $planID_2));
$customerRetrive = Customer::retrieve($customer->id);
$subscriptions = $customerRetrive->subscriptions->all();
$this->assertSame($subscription_2->id, $subscriptions['data'][0]->id);
$this->assertSame($subscription->id, $subscriptions['data'][1]->id);
$this->assertSame(2, count($subscriptions['data']));
$this->assertSame($customer->id, $subscriptions['data'][0]->customer);
$this->assertSame($planID_2, $subscriptions['data'][0]->plan->id);
$subscriptionRetrieve = $customerRetrive->subscriptions->retrieve($subscription->id);
$this->assertSame($subscription->id, $subscriptionRetrieve->id);
$this->assertSame($planID, $subscriptionRetrieve->plan->id);
}
示例7: __construct
{
public function __construct(DIRT $dirt, $pharmacyId)
{
parent::__construct($dirt, 'Customer', "PharmacyId = {$pharmacyId}");
}
}
try {
$options = ['attributes' => [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_EMULATE_PREPARES => true], 'dirt' => ['driver' => 'mysql', 'host' => 'localhost', 'dbname' => 'rxtrax', 'dsn' => 'mysql:host=localhost;dbname=rxtrax;charset=utf8', 'salt' => '45F5CF1FA4AD99F481BFD4DF5DB832F95F3667DF', 'cacheSession' => true]];
$dirt = new DIRT('dirt', 'root', 'intrepid', $options);
} catch (\PDOException $pdoException) {
die($pdoException->getMessage());
}
$customer = new Customer($dirt, 4);
echo "Number of columns: " . (string) $customer->getColumnCount() . "\n";
for ($i = 1; $i <= 1225; $i++) {
$isLoaded = $customer->retrieve(['Id' => $i]);
if ($isLoaded) {
echo 'Pharmacy Id: ' . (string) $customer->PharmacyId . "\n";
echo 'First Name: ' . $customer->FirstName . "\n";
echo 'Last Name: ' . $customer->LastName . "\n";
echo 'Email: ' . $customer->Email . "\n";
}
}
exit;
$customer->FirstName = 'Marge';
$updateWorked = $customer->update();
echo "Update: " . (string) $updateWorked;
exit;
$customer->FirstName = 'Ralph';
$customer->LastName = 'Bednar';
echo "Last Name: " . $customer->LastName;