mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Improve the usability of Phortune
Summary: Ref T6881. - Fix dead links. - Let implementations provide more information. - Provide more information to implementations. Test Plan: Links work, invoices show billing periods, fewer "Subscription 6" crumbs, all is well in the world. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T6881 Differential Revision: https://secure.phabricator.com/D11601
This commit is contained in:
parent
77db15c47b
commit
f6015dbb56
11 changed files with 91 additions and 5 deletions
|
@ -26,10 +26,10 @@ final class PhortuneSubscriptionViewController extends PhortuneController {
|
|||
$account_id = $account->getID();
|
||||
$subscription_id = $subscription->getID();
|
||||
|
||||
$title = pht('Subscription: %s', $subscription->getSubscriptionName());
|
||||
$title = $subscription->getSubscriptionFullName();
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($subscription->getSubscriptionName());
|
||||
->setHeader($title);
|
||||
|
||||
$actions = id(new PhabricatorActionListView())
|
||||
->setUser($viewer)
|
||||
|
@ -53,7 +53,7 @@ final class PhortuneSubscriptionViewController extends PhortuneController {
|
|||
} else {
|
||||
$this->addAccountCrumb($crumbs, $account);
|
||||
}
|
||||
$crumbs->addTextCrumb(pht('Subscription %d', $subscription->getID()));
|
||||
$crumbs->addTextCrumb($subscription->getSubscriptionCrumbName());
|
||||
|
||||
$properties = id(new PHUIPropertyListView())
|
||||
->setUser($viewer)
|
||||
|
|
|
@ -31,7 +31,7 @@ final class PhortunePurchasePHIDType extends PhabricatorPHIDType {
|
|||
$id = $purchase->getID();
|
||||
|
||||
$handle->setName($purchase->getFullDisplayName());
|
||||
$handle->setURI("/phortune/purchase/{$id}/");
|
||||
$handle->setURI($purchase->getURI());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,4 +35,10 @@ abstract class PhortuneProductImplementation {
|
|||
return;
|
||||
}
|
||||
|
||||
public function getPurchaseURI(
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,6 +62,22 @@ final class PhortuneSubscriptionProduct
|
|||
return;
|
||||
}
|
||||
|
||||
public function getPurchaseName(
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return $this->getSubscription()->getPurchaseName(
|
||||
$product,
|
||||
$purchase);
|
||||
}
|
||||
|
||||
public function getPurchaseURI(
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return $this->getSubscription()->getPurchaseURI(
|
||||
$product,
|
||||
$purchase);
|
||||
}
|
||||
|
||||
public function loadImplementationsForRefs(
|
||||
PhabricatorUser $viewer,
|
||||
array $refs) {
|
||||
|
|
|
@ -87,6 +87,11 @@ final class PhortuneProduct extends PhortuneDAO
|
|||
$amount);
|
||||
}
|
||||
|
||||
public function getPurchaseURI(PhortunePurchase $purchase) {
|
||||
return $this->getImplementation()->getPurchaseURI(
|
||||
$this,
|
||||
$purchase);
|
||||
}
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
|
|
@ -87,6 +87,10 @@ final class PhortunePurchase extends PhortuneDAO
|
|||
return $this->getProduct()->getPurchaseName($this);
|
||||
}
|
||||
|
||||
public function getURI() {
|
||||
return $this->getProduct()->getPurchaseURI($this);
|
||||
}
|
||||
|
||||
public function getTotalPriceAsCurrency() {
|
||||
return $this->getBasePriceAsCurrency();
|
||||
}
|
||||
|
|
|
@ -168,6 +168,14 @@ final class PhortuneSubscription extends PhortuneDAO
|
|||
return $this->getImplementation()->getName($this);
|
||||
}
|
||||
|
||||
public function getSubscriptionFullName() {
|
||||
return $this->getImplementation()->getFullName($this);
|
||||
}
|
||||
|
||||
public function getSubscriptionCrumbName() {
|
||||
return $this->getImplementation()->getCrumbName($this);
|
||||
}
|
||||
|
||||
public function getCartName(PhortuneCart $cart) {
|
||||
return $this->getImplementation()->getCartName($this, $cart);
|
||||
}
|
||||
|
@ -192,6 +200,24 @@ final class PhortuneSubscription extends PhortuneDAO
|
|||
$end_epoch);
|
||||
}
|
||||
|
||||
public function getPurchaseName(
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return $this->getImplementation()->getPurchaseName(
|
||||
$this,
|
||||
$product,
|
||||
$purchase);
|
||||
}
|
||||
|
||||
public function getPurchaseURI(
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return $this->getImplementation()->getPurchaseURI(
|
||||
$this,
|
||||
$product,
|
||||
$purchase);
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
|
|
@ -8,6 +8,15 @@ abstract class PhortuneSubscriptionImplementation {
|
|||
|
||||
abstract public function getRef();
|
||||
abstract public function getName(PhortuneSubscription $subscription);
|
||||
|
||||
public function getFullName(PhortuneSubscription $subscription) {
|
||||
return $this->getName($subscription);
|
||||
}
|
||||
|
||||
public function getCrumbName(PhortuneSubscription $subscription) {
|
||||
return $this->getName($subscription);
|
||||
}
|
||||
|
||||
abstract public function getCostForBillingPeriodAsCurrency(
|
||||
PhortuneSubscription $subscription,
|
||||
$start_epoch,
|
||||
|
@ -25,4 +34,17 @@ abstract class PhortuneSubscriptionImplementation {
|
|||
return pht('Subscription');
|
||||
}
|
||||
|
||||
public function getPurchaseName(
|
||||
PhortuneSubscription $subscription,
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return $product->getProductName();
|
||||
}
|
||||
|
||||
public function getPurchaseURI(
|
||||
PhortuneSubscription $subscription,
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ final class PhortuneSubscriptionTableView extends AphrontView {
|
|||
array(
|
||||
'href' => $uri,
|
||||
),
|
||||
$subscription->getSubscriptionName()),
|
||||
$subscription->getSubscriptionFullName()),
|
||||
phabricator_datetime($subscription->getDateCreated(), $viewer),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker {
|
|||
$purchase
|
||||
->setBasePriceAsCurrency($currency)
|
||||
->setMetadataValue('subscriptionPHID', $subscription->getPHID())
|
||||
->setMetadataValue('epoch.start', $last_epoch)
|
||||
->setMetadataValue('epoch.end', $next_epoch)
|
||||
->save();
|
||||
|
||||
$cart->setSubscriptionPHID($subscription->getPHID());
|
||||
|
|
|
@ -901,6 +901,11 @@ abstract class PhabricatorBaseEnglishTranslation
|
|||
'Related link:',
|
||||
'Related links:',
|
||||
),
|
||||
|
||||
'You have %d unpaid invoice(s).' => array(
|
||||
'You have an unpaid invoice.',
|
||||
'You have unpaid invoices.',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue