print "Credentials: \n";
foreach ($ca_type->fields["credentials"] as $key => $value) {
print " " . $key . " - ";
print " " . $value->label . " (" . $value->visibility . ")\n";
}
print "===========\n\n";
}
}
// create a new CarrierAccount
if (CREATE_NEW_CA) {
try {
$new_ups_account = \EasyPost\CarrierAccount::create(array('type' => "UpsAccount", 'description' => "My third UPS account.", 'reference' => "ups02", 'credentials' => array('account_number' => "A1A1A1", 'user_id' => "UPSDOTCOM_USERNAME", 'password' => "UPSDOTCOM_PASSWORD", 'access_license_number' => "UPS_ACCESS_LICENSE_NUMBER")));
print_r($new_ups_account);
} catch (Exception $e) {
$e->prettyPrint();
}
}
// edit an existing CarrierAccount
if (EDIT_CA) {
$ups_account = \EasyPost\CarrierAccount::retrieve("ups02");
$ups_account->credentials->account_number = "B2B2B2";
$ups_account->description = "My second UPS account.";
$ups_account->save();
print_r($ups_account);
}
// delete a CarrierAccount
if (DELETE_CA) {
$ups_account = \EasyPost\CarrierAccount::retrieve("ups02");
$ups_account->delete();
print_r($ups_account);
}