Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15378745
D11594.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11594.diff
View Options
diff --git a/src/applications/phortune/product/PhortuneSubscriptionProduct.php b/src/applications/phortune/product/PhortuneSubscriptionProduct.php
--- a/src/applications/phortune/product/PhortuneSubscriptionProduct.php
+++ b/src/applications/phortune/product/PhortuneSubscriptionProduct.php
@@ -43,6 +43,7 @@
}
public function getPriceAsCurrency(PhortuneProduct $product) {
+ // Prices are calculated by the SubscriptionImplementation.
return PhortuneCurrency::newEmptyCurrency();
}
diff --git a/src/applications/phortune/storage/PhortuneSubscription.php b/src/applications/phortune/storage/PhortuneSubscription.php
--- a/src/applications/phortune/storage/PhortuneSubscription.php
+++ b/src/applications/phortune/storage/PhortuneSubscription.php
@@ -183,6 +183,13 @@
return "/phortune/merchant/{$merchant_id}/subscription/view/{$id}/";
}
+ public function getCostForBillingPeriodAsCurrency($start_epoch, $end_epoch) {
+ return $this->getImplementation()->getCostForBillingPeriodAsCurrency(
+ $this,
+ $start_epoch,
+ $end_epoch);
+ }
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/applications/phortune/subscription/PhortuneSubscriptionImplementation.php b/src/applications/phortune/subscription/PhortuneSubscriptionImplementation.php
--- a/src/applications/phortune/subscription/PhortuneSubscriptionImplementation.php
+++ b/src/applications/phortune/subscription/PhortuneSubscriptionImplementation.php
@@ -8,6 +8,10 @@
abstract public function getRef();
abstract public function getName(PhortuneSubscription $subscription);
+ abstract public function getCostForBillingPeriodAsCurrency(
+ PhortuneSubscription $subscription,
+ $start_epoch,
+ $end_epoch);
protected function getContentSource() {
return PhabricatorContentSource::newForSource(
diff --git a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
--- a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
+++ b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
@@ -42,9 +42,9 @@
$purchase = $cart->newPurchase($actor, $product);
- // TODO: Consider allowing subscriptions to cost an amount other than one
- // dollar and twenty-three cents.
- $currency = PhortuneCurrency::newFromUserInput($actor, '1.23 USD');
+ $currency = $subscription->getCostForBillingPeriodAsCurrency(
+ $last_epoch,
+ $next_epoch);
$purchase
->setBasePriceAsCurrency($currency)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 4:42 PM (2 w, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7579117
Default Alt Text
D11594.diff (2 KB)
Attached To
Mode
D11594: Allow subscriptions to cost amounts other than one dollar and twenty three cents
Attached
Detach File
Event Timeline
Log In to Comment