Esempio n. 1
0
 $accountData->email = $_POST['email'];
 $accountData->currency = $_POST['currency'];
 $accountData->paymentMethodId = null;
 $accountData->address1 = $_POST['address1'];
 $accountData->address2 = $_POST['address2'];
 $accountData->state = $_POST['state'];
 $accountData->country = $_POST['country'];
 $accountData->phone = $_POST['phone'];
 $accountData->length = strlen($accountData->name);
 $accountData->timeZone = 'UTC';
 //$_POST['timeZone'];
 if (!isset($_SESSION['accountId'])) {
     // Create the account
     // The external key is not used in this example
     $accountData->externalKey = uniqid();
     $account = $accountData->create("web-user", "PHP_TEST", "Test for the demo", $tenantHeaders);
     if ($account != null && $account->accountId != null) {
         $_SESSION['accountId'] = $account->accountId;
         $account_created = TRUE;
     } else {
         $account = new Killbill_Account();
         $account_created = FALSE;
     }
 } else {
     // Update the account
     $accountData->accountId = $_SESSION['accountId'];
     // TODO API needs to be fixed
     $currentAccount = $accountData->get($tenantHeaders);
     $accountData->externalKey = $currentAccount->externalKey;
     $account = $accountData->update("web-user", "PHP_TEST", "Test for the demo", $tenantHeaders);
     if ($account != null) {