function test_zApi_Amend() { printResultStart(__FUNCTION__); $messages = array(); $zapi = new zApi(); $date = date('Y-m-d\\TH:i:s'); $amendment = array('EffectiveDate' => $date, 'Name' => 'addproduct' . time(), 'Description' => 'AmendmentTest', 'Status' => 'Completed', 'SubscriptionId' => '4028e69636e2c6590136eae027bf39f7', 'Type' => 'NewProduct', 'ContractEffectiveDate' => $date, 'EffectiveDate' => $date, 'RatePlanData' => array('RatePlan' => array('ProductRatePlanId' => '4028e69736acda1e0136e100fda71c72'))); $amendOptions = array("GenerateInvoice" => false, "ProcessPayments" => false); $previewOptions = array("EnablePreviewMode" => false); //Amend try { $amendResult = $zapi->zAmend($amendment, $amendOptions, $previewOptions); print_r_html($amendResult); } catch (Exception $e) { array_push($messages, "Test Exception: " . $e->getMessage()); } //Report printResultEnd($messages); }
public static function cancelSubscription($subId, $cancelDate, $preview) { $zapi; try { $zapi = new zApi(); } catch (Exception $e) { throw new Exception("INVALID_ZLOGIN"); } date_default_timezone_set('America/Los_Angeles'); $cancelDateFormatted = DateTime::createFromFormat('m/d/Y', $cancelDate)->format('Y-m-d\\TH:i:s'); $date = date('Y-m-d\\TH:i:s'); $amendment = array('Name' => 'Cancellation' . time(), 'Description' => 'Cancelled subscription via the self-service site', 'Status' => 'Completed', 'SubscriptionId' => $subId, 'Type' => 'Cancellation', 'ContractEffectiveDate' => $date, 'ServiceActivationDate' => $date, 'CustomerAcceptanceDate' => $date, 'EffectiveDate' => $cancelDateFormatted); $amendOptions = array("GenerateInvoice" => false, "ProcessPayments" => false); $previewOptions = array("EnablePreviewMode" => $preview); $amendResult = $zapi->zAmend($amendment, $amendOptions, $previewOptions); return $amendResult; }