/** * Copy an existing RecurringOrder to a new date and delete the existing recurring order AND ALL INVOICES/ORDERS ATTACHED * @param int $orderId The ID of the RecurringOrder to replicate * @param string $newStartDate String date of when to start the new RecurringOrder * @param string $nextBillDate Optional, string date of when to set the NextBillingDate on the new RecurringOrder * @return bool|Infusionsoft_RecurringOrder The newly created RecurringOrder object, or false if there was a problem. */ public static function rescheduleRecurringOrderWithDelete($orderId, $newStartDate, $nextBillDate = null) { $newOrder = self::rescheduleRecurringOrder($orderId, $newStartDate, $nextBillDate); // Make API call to delete the old subscription, THIS REMOVES ALL INVOICES AND ORDERS AS WELL! try { Infusionsoft_InvoiceService::deleteSubscription($orderId); } catch (Exception $e) { CakeLog::write('error', "Problem deleting existing subscription. Id: {$orderId}, Error: " . $e->getMessage()); } return $newOrder; }
<form> subscriptionId: <input type="text" name="subscriptionId" value="<?php if (isset($_REQUEST['subscriptionId'])) { echo htmlspecialchars($_REQUEST['subscriptionId']); } ?> "><br/> <input type="submit"> <input type="hidden" name="go"> </form> <?php include '../infusionsoft.php'; include 'testUtils.php'; if (isset($_REQUEST['go'])) { $out = Infusionsoft_InvoiceService::deleteSubscription($_REQUEST['subscriptionId']); var_dump($out); }