1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +01:00

Minor UX tweaks to Phortune autopay

Summary: Fixes T12958. Adds a success message when card is added, also switches to use radio buttons for clarity. Updated redirect uri for deleting methods as well.

Test Plan:
Add cards, remove cards.

{F5091084}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12958

Differential Revision: https://secure.phabricator.com/D18381
This commit is contained in:
Chad Little 2017-08-09 19:31:05 -07:00
parent f68d9ddd1b
commit 92c49c3772
3 changed files with 25 additions and 10 deletions

View file

@ -123,7 +123,8 @@ final class PhortunePaymentMethodCreateController
$next_uri = $this->getApplicationURI( $next_uri = $this->getApplicationURI(
"cart/{$cart_id}/checkout/?paymentMethodID=".$method->getID()); "cart/{$cart_id}/checkout/?paymentMethodID=".$method->getID());
} else if ($subscription_id) { } else if ($subscription_id) {
$next_uri = $cancel_uri; $next_uri = new PhutilURI($cancel_uri);
$next_uri->setQueryParam('added', true);
} else { } else {
$account_uri = $this->getApplicationURI($account->getID().'/'); $account_uri = $this->getApplicationURI($account->getID().'/');
$next_uri = new PhutilURI($account_uri); $next_uri = new PhutilURI($account_uri);

View file

@ -25,11 +25,12 @@ final class PhortunePaymentMethodDisableController
} }
$account = $method->getAccount(); $account = $method->getAccount();
$account_uri = $this->getApplicationURI($account->getID().'/'); $account_id = $account->getID();
$account_uri = $this->getApplicationURI("/account/billing/{$account_id}/");
if ($request->isFormPost()) { if ($request->isFormPost()) {
// TODO: ApplicationTransactions! // TODO: ApplicationTransactions!!!!
$method $method
->setStatus(PhortunePaymentMethod::STATUS_DISABLED) ->setStatus(PhortunePaymentMethod::STATUS_DISABLED)
->save(); ->save();

View file

@ -4,6 +4,7 @@ final class PhortuneSubscriptionEditController extends PhortuneController {
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$added = $request->getBool('added');
$subscription = id(new PhortuneSubscriptionQuery()) $subscription = id(new PhortuneSubscriptionQuery())
->setViewer($viewer) ->setViewer($viewer)
@ -112,6 +113,7 @@ final class PhortuneSubscriptionEditController extends PhortuneController {
pht('Subscription %d', $subscription->getID()), pht('Subscription %d', $subscription->getID()),
$view_uri); $view_uri);
$crumbs->addTextCrumb(pht('Edit')); $crumbs->addTextCrumb(pht('Edit'));
$crumbs->setBorder(true);
$uri = $this->getApplicationURI($account->getID().'/card/new/'); $uri = $this->getApplicationURI($account->getID().'/card/new/');
@ -127,15 +129,19 @@ final class PhortuneSubscriptionEditController extends PhortuneController {
), ),
pht('Add Payment Method...')); pht('Add Payment Method...'));
$radio = id(new AphrontFormRadioButtonControl())
->setName('defaultPaymentMethodPHID')
->setLabel(pht('Autopay With'))
->setValue($current_phid)
->setError($e_method);
foreach ($options as $key => $value) {
$radio->addButton($key, $value, null);
}
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($viewer) ->setUser($viewer)
->appendChild( ->appendChild($radio)
id(new AphrontFormSelectControl())
->setName('defaultPaymentMethodPHID')
->setLabel(pht('Autopay With'))
->setValue($current_phid)
->setError($e_method)
->setOptions($options))
->appendChild( ->appendChild(
id(new AphrontFormMarkupControl()) id(new AphrontFormMarkupControl())
->setValue($add_method_button)) ->setValue($add_method_button))
@ -151,6 +157,13 @@ final class PhortuneSubscriptionEditController extends PhortuneController {
->setFormErrors($errors) ->setFormErrors($errors)
->appendChild($form); ->appendChild($form);
if ($added) {
$info_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_SUCCESS)
->appendChild(pht('Payment method has been successfully added.'));
$box->setInfoView($info_view);
}
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setHeader(pht('Edit %s', $subscription->getSubscriptionName())) ->setHeader(pht('Edit %s', $subscription->getSubscriptionName()))
->setHeaderIcon('fa-pencil'); ->setHeaderIcon('fa-pencil');