From 1970ebcd7b732768eb81df7df9f875ea60ed47e7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2015 10:28:19 -0700 Subject: [PATCH] Never generate $0.00 invoices Summary: Ref T7769. It might possibly make sense to generate these some day, but for now they aren't payable and we have no use for them. Test Plan: - Generated $0.00 invoices, saw code decline to invoice. - Generated a $7.99 invoice, got an invoice. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7769 Differential Revision: https://secure.phabricator.com/D12878 --- .../phortune/worker/PhortuneSubscriptionWorker.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php index a3235d464f..747b4b3889 100644 --- a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php +++ b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php @@ -15,6 +15,13 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker { return; } + $currency = $subscription->getCostForBillingPeriodAsCurrency( + $last_epoch, + $next_epoch); + if (!$currency->isPositive()) { + return; + } + $account = $subscription->getAccount(); $merchant = $subscription->getMerchant(); @@ -48,10 +55,6 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker { $purchase = $cart->newPurchase($actor, $product); - $currency = $subscription->getCostForBillingPeriodAsCurrency( - $last_epoch, - $next_epoch); - $purchase ->setBasePriceAsCurrency($currency) ->setMetadataValue('subscriptionPHID', $subscription->getPHID())