1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 17:52:43 +01:00
phorge-phorge/src/applications/phortune/cart/PhortuneAdHocCart.php
epriestley 0195e751c6 Support basic ad-hoc invoices in Phortune
Summary:
This allows a merchant to send a user an invoice for something arbitrary, like services rendered.

Two major missing parts:

  - These don't actually get marked as invoices. I'll fix that in the next diff, but it's not entirely trivial because `subscriptionPHID` is currently overloaded to also mean "is invoice".
  - We don't send email automatically. I don't plan to fix that for now, since all our invoicing needs are covered by personal email.

Test Plan:
Merchants have a new "new invoice" option:

{F376999}

This leads to selecting a user and account, and then you can generate the invoice (only one actual "purchase" / line item for the moment). You can add a longer-form remarkup description to contextualize the billable items:

{F377001}

This sends the invoice and takes you to the merchant order overview screen:

{F377002}

For now, you copy/paste that link into a nice personal enterprisey business-to-business email; the recipient sees this:

{F377003}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12478
2015-04-20 10:05:22 -07:00

39 lines
794 B
PHP

<?php
final class PhortuneAdHocCart extends PhortuneCartImplementation {
public function loadImplementationsForCarts(
PhabricatorUser $viewer,
array $carts) {
$results = array();
foreach ($carts as $key => $cart) {
$results[$key] = new PhortuneAdHocCart();
}
return $results;
}
public function getName(PhortuneCart $cart) {
return $cart->getMetadataValue('adhoc.title');
}
public function getDescription(PhortuneCart $cart) {
return $cart->getMetadataValue('adhoc.description');
}
public function getCancelURI(PhortuneCart $cart) {
return null;
}
public function getDoneURI(PhortuneCart $cart) {
return null;
}
public function willCreateCart(
PhabricatorUser $viewer,
PhortuneCart $cart) {
return;
}
}