2014-10-06 14:19:08 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class PhortuneCartImplementation {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
2014-10-08 14:40:02 -07:00
|
|
|
abstract public function getName(PhortuneCart $cart);
|
2014-10-06 14:19:08 -07:00
|
|
|
abstract public function getCancelURI(PhortuneCart $cart);
|
|
|
|
abstract public function getDoneURI(PhortuneCart $cart);
|
|
|
|
|
2014-10-08 15:33:25 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-10-06 14:19:08 -07:00
|
|
|
abstract public function willCreateCart(
|
|
|
|
PhabricatorUser $viewer,
|
|
|
|
PhortuneCart $cart);
|
|
|
|
|
|
|
|
}
|