@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 cost amounts other than one dollar and twenty three cents

Summary: Ref T6881. Sometimes, goods and services cost arbitrary amounts.

Test Plan: See next diff.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6881

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

+15 -3
+1
src/applications/phortune/product/PhortuneSubscriptionProduct.php
··· 43 43 } 44 44 45 45 public function getPriceAsCurrency(PhortuneProduct $product) { 46 + // Prices are calculated by the SubscriptionImplementation. 46 47 return PhortuneCurrency::newEmptyCurrency(); 47 48 } 48 49
+7
src/applications/phortune/storage/PhortuneSubscription.php
··· 183 183 return "/phortune/merchant/{$merchant_id}/subscription/view/{$id}/"; 184 184 } 185 185 186 + public function getCostForBillingPeriodAsCurrency($start_epoch, $end_epoch) { 187 + return $this->getImplementation()->getCostForBillingPeriodAsCurrency( 188 + $this, 189 + $start_epoch, 190 + $end_epoch); 191 + } 192 + 186 193 187 194 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 188 195
+4
src/applications/phortune/subscription/PhortuneSubscriptionImplementation.php
··· 8 8 9 9 abstract public function getRef(); 10 10 abstract public function getName(PhortuneSubscription $subscription); 11 + abstract public function getCostForBillingPeriodAsCurrency( 12 + PhortuneSubscription $subscription, 13 + $start_epoch, 14 + $end_epoch); 11 15 12 16 protected function getContentSource() { 13 17 return PhabricatorContentSource::newForSource(
+3 -3
src/applications/phortune/worker/PhortuneSubscriptionWorker.php
··· 42 42 43 43 $purchase = $cart->newPurchase($actor, $product); 44 44 45 - // TODO: Consider allowing subscriptions to cost an amount other than one 46 - // dollar and twenty-three cents. 47 - $currency = PhortuneCurrency::newFromUserInput($actor, '1.23 USD'); 45 + $currency = $subscription->getCostForBillingPeriodAsCurrency( 46 + $last_epoch, 47 + $next_epoch); 48 48 49 49 $purchase 50 50 ->setBasePriceAsCurrency($currency)