public function save($app = null) { if ($this->Id == '') { $id = Infusionsoft_InvoiceService::addRecurringOrder($this->ContactId, true, $this->SubscriptionPlanId, $this->Qty, $this->BillingAmt, true, $this->MerchantAccountId, $this->CC1, $this->AffiliateId, 0); $this->Id = $id; } $result = parent::save($app); Infusionsoft_InvoiceService::updateJobRecurringNextBillDate($this->Id, $this->NextBillDate); Infusionsoft_InvoiceService::createInvoiceForRecurring($this->Id); return $result; }
<?php include '../infusionsoft.php'; include 'object_editor_all_tables.php'; include '../tests/testUtils.php'; if (isset($_POST['contactid'])) { $recurring_order_id = Infusionsoft_InvoiceService::addRecurringOrder($_POST['contactid'], true, $_POST['subscriptionplanid'], 0, 0.01, false, 0, 0, 0, 0); $recurringOrder = new Infusionsoft_RecurringOrder($recurring_order_id); $recurringOrder->StartDate = date('Y-m-d H:i:s', strtotime("-1 month")); $recurringOrder->PaidThruDate = date('Y-m-d H:i:s', strtotime("-1 month")); $recurringOrder->save(); echo "<h1>Subscription Created: {$recurring_order_id}</h1>"; } ?> <h1>Create Subscription</h1> <form method="post"> Contact Id: <input type="text" name="contactid" value="1459" placeholder="Contact Id"/><br/> SubscriptionPlanId: <input type="text" name="subscriptionplanid" value="33" placeholder="Subscription Plan / CProgram Id"/><br/> <input type="submit"> </form>
} ?> "><br/> creditCardId: <input type="text" name="creditCardId" value="<?php if (isset($_REQUEST['creditCardId'])) { echo htmlspecialchars($_REQUEST['creditCardId']); } ?> "><br/> affiliateId: <input type="text" name="affiliateId" value="<?php if (isset($_REQUEST['affiliateId'])) { echo htmlspecialchars($_REQUEST['affiliateId']); } ?> "><br/> daysTillCharge: <input type="text" name="daysTillCharge" value="<?php if (isset($_REQUEST['daysTillCharge'])) { echo htmlspecialchars($_REQUEST['daysTillCharge']); } ?> "><br/> <input type="submit"> <input type="hidden" name="go"> </form> <?php include '../infusionsoft.php'; include 'testUtils.php'; if (isset($_REQUEST['go'])) { $out = Infusionsoft_InvoiceService::addRecurringOrder($_REQUEST['contactId'], $_REQUEST['allowDuplicate'], $_REQUEST['cProgramId'], $_REQUEST['qty'], $_REQUEST['price'], $_REQUEST['allowTax'], $_REQUEST['merchantAccountId'], $_REQUEST['creditCardId'], $_REQUEST['affiliateId'], $_REQUEST['daysTillCharge']); var_dump($out); }