mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52: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:
parent
f68d9ddd1b
commit
92c49c3772
3 changed files with 25 additions and 10 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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...'));
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($viewer)
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
$radio = id(new AphrontFormRadioButtonControl())
|
||||
->setName('defaultPaymentMethodPHID')
|
||||
->setLabel(pht('Autopay With'))
|
||||
->setValue($current_phid)
|
||||
->setError($e_method)
|
||||
->setOptions($options))
|
||||
->setError($e_method);
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
$radio->addButton($key, $value, null);
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($viewer)
|
||||
->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');
|
||||
|
|
Loading…
Reference in a new issue