get() public static method

public static get ( $uuid, $client = null )
示例#1
0
 public function testCreateUsageFromSubscription()
 {
     $this->client->addResponse('GET', '/subscriptions/012345678901234567890123456789ab', 'subscriptions/show-200.xml');
     $this->client->addResponse('POST', '/subscriptions/012345678901234567890123456789ab/add_ons/marketing_emails/usage', 'usage/create-201.xml');
     $subscription = Recurly_Subscription::get('012345678901234567890123456789ab', $this->client);
     $usage = $subscription->buildUsage('marketing_emails', $this->client);
     $usage->create();
     $this->assertInstanceOf('Recurly_Usage', $usage);
     $this->assertInstanceOf('Recurly_Stub', $usage->measured_unit);
 }
示例#2
0
文件: aaa.php 项目: ram-1501/rs
                     $createdAt = strtotime($xmlResp->activated_at) . "000";
                     if ($paymentState == 'active') {
                         $api->setPaymentConfig($email, $pass, SERVER_IDENTIFIER, $paymentId, $accountCode, $paymentLicense, $paymentState, $createdAt);
                         $api->setUserLicense($email, SERVER_IDENTIFIER);
                         echo $alertMsg . $paymentLicense . '.';
                     }
                 } catch (Exception $e) {
                     echo $e->getMessage();
                     break;
                 }
             }
         } else {
             try {
                 $subscription = Recurly_Subscription::get($paymentId);
                 $subscription->cancel();
                 $subscription = Recurly_Subscription::get($paymentId);
                 if ($subscription->state == 'canceled') {
                     $api->updateUserPaymentConfig(SERVER_IDENTIFIER, $paymentLicense, $email, $subscription->state);
                     $api->setUserLicense($email, SERVER_IDENTIFIER);
                     echo $alertMsg . $paymentLicense . '.';
                 }
             } catch (Exception $e) {
                 echo $e->getMessage();
                 break;
             }
         }
     } else {
         echo "Error: Incorrect email or password.";
     }
     break;
 case "isLoggedIn":
  public function testUpdateNotes() {
    $this->client->addResponse('GET', '/subscriptions/012345678901234567890123456789ab', 'subscriptions/show-200.xml');
    $this->client->addResponse('PUT', 'https://api.recurly.com/v2/subscriptions/012345678901234567890123456789ab/notes', 'subscriptions/show-200-changed-notes.xml');

    $subscription = Recurly_Subscription::get('012345678901234567890123456789ab', $this->client);

    $notes = array("customer_notes" => "New Customer Notes", "terms_and_condititions" => "New Terms", "vat_reverse_charge_notes" => "New VAT Notes");

    $subscription->updateNotes($notes);

    foreach($notes as $key => $value) {
      $this->assertEquals($subscription->$key, $value);
    }
  }
 public function testPreviewChangeSubscription()
 {
     $this->client->addResponse('GET', '/subscriptions/012345678901234567890123456789ab', 'subscriptions/show-200.xml');
     $this->client->addResponse('POST', 'https://api.recurly.com/v2/subscriptions/012345678901234567890123456789ab/preview', 'subscriptions/preview-200-change.xml');
     $subscription = Recurly_Subscription::get('012345678901234567890123456789ab', $this->client);
     $subscription->plan_code = 'gold';
     $subscription->preview();
     $this->assertEquals('5000', $subscription->cost_in_cents);
     $this->assertEquals('gold', $subscription->plan_code);
 }
function GetUserRecurlySubscription()
{
    $account = GetUserRecurlyAccount();
    return Recurly_Subscription::get($account->account_code);
}
 public function testGetSubscriptionRedemptions()
 {
     $this->client->addResponse('GET', '/subscriptions/012345678901234567890123456789ab', 'subscriptions/show-200.xml');
     $this->client->addResponse('GET', 'https://api.recurly.com/v2/subscriptions/012345678901234567890123456789ab/redemptions', 'subscriptions/redemptions-200.xml');
     $subscription = Recurly_Subscription::get('012345678901234567890123456789ab', $this->client);
     $redemptions = $subscription->redemptions->get();
     $this->assertEquals(2, $redemptions->count());
     foreach ($redemptions as $r) {
         $this->assertInstanceOf('Recurly_CouponRedemption', $r);
     }
 }