1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +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(
"cart/{$cart_id}/checkout/?paymentMethodID=".$method->getID());
} else if ($subscription_id) {
$next_uri = $cancel_uri;
$next_uri = new PhutilURI($cancel_uri);
$next_uri->setQueryParam('added', true);
} else {
$account_uri = $this->getApplicationURI($account->getID().'/');
$next_uri = new PhutilURI($account_uri);

View file

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

View file

@ -4,6 +4,7 @@ final class PhortuneSubscriptionEditController extends PhortuneController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$added = $request->getBool('added');
$subscription = id(new PhortuneSubscriptionQuery())
->setViewer($viewer)
@ -112,6 +113,7 @@ final class PhortuneSubscriptionEditController extends PhortuneController {
pht('Subscription %d', $subscription->getID()),
$view_uri);
$crumbs->addTextCrumb(pht('Edit'));
$crumbs->setBorder(true);
$uri = $this->getApplicationURI($account->getID().'/card/new/');
@ -127,15 +129,19 @@ final class PhortuneSubscriptionEditController extends PhortuneController {
),
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())
->setUser($viewer)
->appendChild(
id(new AphrontFormSelectControl())
->setName('defaultPaymentMethodPHID')
->setLabel(pht('Autopay With'))
->setValue($current_phid)
->setError($e_method)
->setOptions($options))
->appendChild($radio)
->appendChild(
id(new AphrontFormMarkupControl())
->setValue($add_method_button))
@ -151,6 +157,13 @@ final class PhortuneSubscriptionEditController extends PhortuneController {
->setFormErrors($errors)
->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())
->setHeader(pht('Edit %s', $subscription->getSubscriptionName()))
->setHeaderIcon('fa-pencil');