$autobill = new AutoBill(); $return = $autobill->fetchByMerchantAutoBillId('', $abID); $autobillVID = $return['data']->autobill->VID; print "VID is {$autobillVID} \n"; $modAutoBill = new AutoBill(); $modAutoBill->setVID($autobillVID); $remProduct = new Product(); $remProduct->setMerchantProductId($remID); $remItem = new AutoBillItem(); $remItem->setProduct($remProduct); $addProduct = new Product(); $addProduct->setMerchantProductId($addID); $addItem = new AutoBillItem(); $addItem->setProduct($addProduct); //$addItem->setCampaignCode('promo10'); $replaceModification = new AutoBillItemModification(); $replaceModification->setRemoveAutoBillItem($remItem); $replaceModification->setAddAutoBillItem($addItem); $response = $modAutoBill->modify('', $prorate, $effectiveDate, $changeBillingPlanTo, $replaceModification, $dryrun); print_r($response); if ($response['returnCode'] == 200) { // Now we can force this autobill to show up in autobill.fetchDeltaSince for this time block print "Forcing FDS return by resetting nextBilling date"; $autobill = new AutoBill(); $autobillVID = $response['data']->autobill->VID; $autobillNextBillDate = $response['data']->autobill->nextBilling->timestamp; echo "VID is {$autobillVID} \n"; echo "nextBill is {$autobillNextBillDate} \n"; $autobill = new AutoBill(); $autobill->setVID($autobillVID); $response = $autobill->delayBillingToDate('', $autobillNextBillDate, true);
$addID = $argv[2]; $bpID = $argv[3]; $dryrun = $argv[4]; print "Adding product {$addID} to autobill {$abID} \n"; print "BillingPlan is {$bpID} \n"; print "dryrun is {$dryrun} \n"; $autobill = new AutoBill(); $return = $autobill->fetchByMerchantAutoBillId('', $abID); $remID = $return['data']->autobill->items[0]->product->merchantProductId; $autobillVID = $return['data']->autobill->VID; print "VID is {$autobillVID} \n"; print "item to remove is {$remID} \n"; $modAutoBill = new AutoBill(); $modAutoBill->setVID($autobillVID); $addProduct = new Product(); $addProduct->setMerchantProductId($addID); $remProduct = new Product(); $remProduct->setMerchantProductId($remID); $addItem = new AutoBillItem(); $addItem->setProduct($addProduct); $remItem = new AutoBillItem(); $remItem->setProduct($remProduct); $bp = new BillingPLan(); $bp->setMerchantBillingPlanId($bpID); $mod = new AutoBillItemModification(); $mod->setAddAutoBillItem($addItem); $mod->setRemoveAutoBillItem($remItem); $effectiveDate = 'today'; $prorate = 1; $response = $modAutoBill->modify('', $prorate, $effectiveDate, $bp, array($mod), $dryrun); print_r($response);