From 29dc9e9ae1d31c067b2441340fcc672651606675 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 10 Feb 2017 08:48:29 -0800 Subject: [PATCH] Make the Phortune Subscription view show "Deleted Payment Method" for deleted payment methods Summary: Fixes T12224. This brings "Autopay" on the View controller into line with how it works on the Edit controller. Test Plan: - Viewed subscriptions with no autopay, valid autopay, and deleted autopay. {F2750725} Reviewers: chad Reviewed By: chad Maniphest Tasks: T12224 Differential Revision: https://secure.phabricator.com/D17334 --- .../PhortuneSubscriptionViewController.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/applications/phortune/controller/PhortuneSubscriptionViewController.php b/src/applications/phortune/controller/PhortuneSubscriptionViewController.php index 0aea396136..daf3daa11d 100644 --- a/src/applications/phortune/controller/PhortuneSubscriptionViewController.php +++ b/src/applications/phortune/controller/PhortuneSubscriptionViewController.php @@ -68,8 +68,23 @@ final class PhortuneSubscriptionViewController extends PhortuneController { $default_method = $subscription->getDefaultPaymentMethodPHID(); if ($default_method) { - $handles = $this->loadViewerHandles(array($default_method)); - $autopay_method = $handles[$default_method]->renderLink(); + $method = id(new PhortunePaymentMethodQuery()) + ->setViewer($viewer) + ->withPHIDs(array($default_method)) + ->withStatuses( + array( + PhortunePaymentMethod::STATUS_ACTIVE, + )) + ->executeOne(); + if ($method) { + $handles = $this->loadViewerHandles(array($default_method)); + $autopay_method = $handles[$default_method]->renderLink(); + } else { + $autopay_method = phutil_tag( + 'em', + array(), + pht('')); + } } else { $autopay_method = phutil_tag( 'em',