public static function planUpgradeDowngrade($subId, $addRatePlanId, $chargeAndQty, $removeRatePlanId, $invoice, $previewOpt) { $removedRatePlan = Amender::removeRatePlan($subId, $removeRatePlanId, $invoice, $previewOpt); $addedRatePlan = Amender::addRatePlan($subId, $addRatePlanId, $chargeAndQty, $previewOpt); $amendResult = array("addedPlanResult" => $addedRatePlan, "removedPlanResult" => $removedRatePlan); return $amendResult; }
function cancelSubscription() { global $messages; $subId = $_REQUEST['subId']; $cancelDate = $_REQUEST['cancelDate']; $previewOpt = false; $amRes = Amender::cancelSubscription($subId, $cancelDate, $previewOpt); $messages = $amRes; }
function test_Amender_updateRatePlan() { global $EXISTING_CUSTOMER_ACCOUNT_NAME; printResultStart(__FUNCTION__); $messages = array(); try { //Get the Rateplan ID of an updatable active plan on this user's subscription $sub = SubscriptionManager::getCurrentSubscriptions($EXISTING_CUSTOMER_ACCOUNT_NAME); $rpId = null; foreach ($sub->active_plans as $rp) { if ($rp->uom != null) { $rpId = $rp->Id; } } if ($rpId == null) { echo "This must have an updatable rate plan to run this test."; printResultEnd($messages); return; } echo "Updating quantity of Rate Plan '" . $rpId . "' on account '" . $EXISTING_CUSTOMER_ACCOUNT_NAME . "'<br>"; //Test $amRes = Amender::updateRatePlan($EXISTING_CUSTOMER_ACCOUNT_NAME, $rpId, 4, true); print_r_html($amRes); /* if($amRes->results->Success){ echo "<br>RemoveProduct amendment successfully created.<br>"; $zapi = new zApi(); echo "Deleting created amendment.<br>"; $deleteResult = $zapi->zDelete(array($amRes->results->AmendmentIds),'Amendment'); print_r_html($deleteResult); }*/ } catch (Exception $e) { array_push($messages, $e->getMessage()); } printResultEnd($messages); }