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 addRatePlan() { global $messages; $subId = $_REQUEST['subId']; $addRatePlanId = $_REQUEST['rpId']; $chargeAndQty = $_REQUEST['chargeAndQty']; $preview = false; $amRes = Amender::addRatePlan($subId, $addRatePlanId, $chargeAndQty, $preview); $_SESSION['amendSubId'] = $amRes->results->SubscriptionId; $messages = $_SESSION['amendSubId']; }
function test_Amender_addRatePlan() { global $EXISTING_CUSTOMER_ACCOUNT_NAME; printResultStart(__FUNCTION__); $messages = array(); //Retrieve a productRatePlanId from the catalog $prpId; try { $catalog = Catalog::readCache(); $prp = $catalog[0]->products[0]->ratePlans[0]; echo "Previewing AddProduct amendment for customer '" . $EXISTING_CUSTOMER_ACCOUNT_NAME . "' with Product Rate Plan '" . $prp->Name . "' on Product '" . $prp->productName . "' <br>"; $prpId = $prp->Id; } catch (Exception $e) { array_push($messages, $e->getMessage()); printResultEnd($messages); return; } //Test try { $amRes = Amender::addRatePlan($EXISTING_CUSTOMER_ACCOUNT_NAME, $prpId, null, true); print_r_html($amRes); } catch (Exception $e) { array_push($messages, $e->getMessage()); } printResultEnd($messages); }