diff --git a/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php b/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php index 962bb88f0c..e1053e74a1 100644 --- a/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php +++ b/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php @@ -153,7 +153,8 @@ final class PhabricatorPhortuneManagementInvoiceWorkflow array( 'subscriptionPHID' => $subscription->getPHID(), 'trigger.last-epoch' => $last_time, - 'trigger.next-epoch' => $next_time, + 'trigger.this-epoch' => $next_time, + 'manual' => true, ), array( 'objectPHID' => $subscription->getPHID(), diff --git a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php index 233eb5dccb..23cab0386f 100644 --- a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php +++ b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php @@ -187,7 +187,7 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker { // creation date as the start of the billing period. $last_epoch = $subscription->getDateCreated(); } - $this_epoch = idx($data, 'trigger.next-epoch'); + $this_epoch = idx($data, 'trigger.this-epoch'); if (!$last_epoch || !$this_epoch) { throw new PhabricatorWorkerPermanentFailureException( @@ -202,11 +202,13 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker { 'Subscription has invalid billing period.')); } - if (PhabricatorTime::getNow() < $this_epoch) { - throw new Exception( - pht( - 'Refusing to generate a subscription invoice for a billing period '. - 'which ends in the future.')); + if (empty($data['manual'])) { + if (PhabricatorTime::getNow() < $this_epoch) { + throw new Exception( + pht( + 'Refusing to generate a subscription invoice for a billing period '. + 'which ends in the future.')); + } } return array($last_epoch, $this_epoch);