mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-03 10:28:23 +01:00
1e8c314c81
Summary: Ref T2787. This has some rough edges but basically works. - Users can cancel orders that are in incomplete states (or in complete states, if the application allows them to -- for example, some future application might allow cancellation of billed-but-not-shipped orders). - Merchant controllers can partially or fully refund orders from any state after payment. Test Plan: This is still rough around the edges, but issued Stripe and WePay refunds. Reviewers: btrahan Reviewed By: btrahan Subscribers: chad, epriestley Maniphest Tasks: T2787 Differential Revision: https://secure.phabricator.com/D10664
38 lines
1 KiB
PHP
38 lines
1 KiB
PHP
<?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);
|
|
|
|
abstract public function getName(PhortuneCart $cart);
|
|
abstract public function getCancelURI(PhortuneCart $cart);
|
|
abstract public function getDoneURI(PhortuneCart $cart);
|
|
|
|
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);
|
|
|
|
}
|