@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow subscriptions to decline to generate an invoice

Summary: This is a useful capability in Phacility for disabled/suspended instances.

Test Plan: Used `bin/phortune invoice` to invoice a disabled instance, saw it decline to invoice.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11837

+21 -1
+7
src/applications/phortune/storage/PhortuneSubscription.php
··· 207 207 $end_epoch); 208 208 } 209 209 210 + public function shouldInvoiceForBillingPeriod($start_epoch, $end_epoch) { 211 + return $this->getImplementation()->shouldInvoiceForBillingPeriod( 212 + $this, 213 + $start_epoch, 214 + $end_epoch); 215 + } 216 + 210 217 public function getPurchaseName( 211 218 PhortuneProduct $product, 212 219 PhortunePurchase $purchase) {
+7
src/applications/phortune/subscription/PhortuneSubscriptionImplementation.php
··· 22 22 $start_epoch, 23 23 $end_epoch); 24 24 25 + public function shouldInvoiceForBillingPeriod( 26 + PhortuneSubscription $subscription, 27 + $start_epoch, 28 + $end_epoch) { 29 + return true; 30 + } 31 + 25 32 public function getCartName( 26 33 PhortuneSubscription $subscription, 27 34 PhortuneCart $cart) {
+7 -1
src/applications/phortune/worker/PhortuneSubscriptionWorker.php
··· 8 8 $range = $this->getBillingPeriodRange($subscription); 9 9 list($last_epoch, $next_epoch) = $range; 10 10 11 + $should_invoice = $subscription->shouldInvoiceForBillingPeriod( 12 + $last_epoch, 13 + $next_epoch); 14 + if (!$should_invoice) { 15 + return; 16 + } 17 + 11 18 $account = $subscription->getAccount(); 12 19 $merchant = $subscription->getMerchant(); 13 20 ··· 20 27 21 28 $cart_implementation = id(new PhortuneSubscriptionCart()) 22 29 ->setSubscription($subscription); 23 - 24 30 25 31 // TODO: This isn't really ideal. It would be better to use an application 26 32 // actor than the original author of the subscription. In particular, if