1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-23 21:18:19 +01:00
phorge-phorge/src/applications/phortune/cart/PhortuneCartImplementation.php
Joshua Spence b6d745b666 Extend from Phobject
Summary: All classes should extend from some other class. See D13275 for some explanation.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13283
2015-06-15 18:02:27 +10:00

46 lines
1.2 KiB
PHP

<?php
abstract class PhortuneCartImplementation extends Phobject {
/**
* Load implementations for a given set of carts.
*
* Note that this method should return a map using the original keys to
* identify which implementation corresponds to which cart.
*/
abstract public function loadImplementationsForCarts(
PhabricatorUser $viewer,
array $carts);
abstract public function getName(PhortuneCart $cart);
abstract public function getCancelURI(PhortuneCart $cart);
abstract public function getDoneURI(PhortuneCart $cart);
public function getDescription(PhortuneCart $cart) {
return null;
}
public function getDoneActionName(PhortuneCart $cart) {
return pht('Return to Application');
}
public function assertCanCancelOrder(PhortuneCart $cart) {
switch ($cart->getStatus()) {
case PhortuneCart::STATUS_PURCHASED:
throw new Exception(
pht(
'This order can not be cancelled because it has already been '.
'completed.'));
break;
}
}
public function assertCanRefundOrder(PhortuneCart $cart) {
return;
}
abstract public function willCreateCart(
PhabricatorUser $viewer,
PhortuneCart $cart);
}