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
This commit is contained in:
@@ -43,6 +43,7 @@ final class PhortuneSubscriptionProduct
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getPriceAsCurrency(PhortuneProduct $product) {
|
public function getPriceAsCurrency(PhortuneProduct $product) {
|
||||||
|
// Prices are calculated by the SubscriptionImplementation.
|
||||||
return PhortuneCurrency::newEmptyCurrency();
|
return PhortuneCurrency::newEmptyCurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,6 +183,13 @@ final class PhortuneSubscription extends PhortuneDAO
|
|||||||
return "/phortune/merchant/{$merchant_id}/subscription/view/{$id}/";
|
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 )----------------------------------------- */
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ abstract class PhortuneSubscriptionImplementation {
|
|||||||
|
|
||||||
abstract public function getRef();
|
abstract public function getRef();
|
||||||
abstract public function getName(PhortuneSubscription $subscription);
|
abstract public function getName(PhortuneSubscription $subscription);
|
||||||
|
abstract public function getCostForBillingPeriodAsCurrency(
|
||||||
|
PhortuneSubscription $subscription,
|
||||||
|
$start_epoch,
|
||||||
|
$end_epoch);
|
||||||
|
|
||||||
protected function getContentSource() {
|
protected function getContentSource() {
|
||||||
return PhabricatorContentSource::newForSource(
|
return PhabricatorContentSource::newForSource(
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker {
|
|||||||
|
|
||||||
$purchase = $cart->newPurchase($actor, $product);
|
$purchase = $cart->newPurchase($actor, $product);
|
||||||
|
|
||||||
// TODO: Consider allowing subscriptions to cost an amount other than one
|
$currency = $subscription->getCostForBillingPeriodAsCurrency(
|
||||||
// dollar and twenty-three cents.
|
$last_epoch,
|
||||||
$currency = PhortuneCurrency::newFromUserInput($actor, '1.23 USD');
|
$next_epoch);
|
||||||
|
|
||||||
$purchase
|
$purchase
|
||||||
->setBasePriceAsCurrency($currency)
|
->setBasePriceAsCurrency($currency)
|
||||||
|
|||||||
Reference in New Issue
Block a user