Skip to content

Commit 301750f

Browse files
author
epriestley
committedJul 7, 2017
Add an after-purchase hook to subscriptions in Phortune
Summary: Ref T12681. We need this to update the "paid until" window on support pacts. (Instance billing doesn't use this because everything just checks if you have unpaid invoices, nothing actually happens when you pay them.) Test Plan: See D18187. Reviewers: chad, amckinley Reviewed By: chad Maniphest Tasks: T12681 Differential Revision: https://secure.phabricator.com/D18188
1 parent 8d11e12 commit 301750f

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
 

‎src/applications/phortune/product/PhortuneSubscriptionProduct.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ public function getPriceAsCurrency(PhortuneProduct $product) {
5050
public function didPurchaseProduct(
5151
PhortuneProduct $product,
5252
PhortunePurchase $purchase) {
53-
// TODO: Callback the subscription.
54-
return;
53+
return $this->getSubscription()->didPurchaseProduct(
54+
$product,
55+
$purchase);
5556
}
5657

5758
public function didRefundProduct(

‎src/applications/phortune/storage/PhortuneSubscription.php

+9
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,15 @@ public function getPurchaseURI(
232232
$purchase);
233233
}
234234

235+
public function didPurchaseProduct(
236+
PhortuneProduct $product,
237+
PhortunePurchase $purchase) {
238+
return $this->getImplementation()->didPurchaseProduct(
239+
$this,
240+
$product,
241+
$purchase);
242+
}
243+
235244

236245
/* -( PhabricatorPolicyInterface )----------------------------------------- */
237246

‎src/applications/phortune/subscription/PhortuneSubscriptionImplementation.php

+8
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,12 @@ public function getPurchaseURI(
4848
PhortunePurchase $purchase) {
4949
return null;
5050
}
51+
52+
public function didPurchaseProduct(
53+
PhortuneSubscription $subscription,
54+
PhortuneProduct $product,
55+
PhortunePurchase $purchase) {
56+
return null;
57+
}
58+
5159
}

0 commit comments

Comments
 (0)
Failed to load comments.